/* 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/@pnet.nim.c.o /Users/runner/work/nightlies/nightlies/nim-2.2.10/dist/atlas/.nimcache/@pnet.nim.c */
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks

#include "nimbase.h"
#include <string.h>
#include <glob.h>
#include <signal.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <poll.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 TNimTypeV2 TNimTypeV2;
typedef struct tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A;
typedef struct tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA;
typedef struct tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg;
typedef struct tyObject_HashSet__9aAVrrL6o7xnFQncOPM0SYQ tyObject_HashSet__9aAVrrL6o7xnFQncOPM0SYQ;
typedef struct tySequence__8Np6tlClE5az1CyqZdN19bQ tySequence__8Np6tlClE5az1CyqZdN19bQ;
typedef struct tySequence__8Np6tlClE5az1CyqZdN19bQ_Content tySequence__8Np6tlClE5az1CyqZdN19bQ_Content;
typedef struct tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig;
typedef struct tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A;
typedef struct tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw;
typedef struct tyTuple__N4J9cV4JZGem3ljqqj5rT0Q tyTuple__N4J9cV4JZGem3ljqqj5rT0Q;
typedef struct tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ;
typedef struct tyTuple__EMes4DT7YbRCwj3TmsFXyA tyTuple__EMes4DT7YbRCwj3TmsFXyA;
typedef struct tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA;
typedef struct tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug;
typedef struct Exception Exception;
typedef struct RootObj RootObj;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ tySequence__3EvzHGO0xyXGnJBUggwfKQ;
typedef struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content;
typedef struct tyObject_IOError__FsM2LSiW5usgjecIvsloBA tyObject_IOError__FsM2LSiW5usgjecIvsloBA;
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
typedef struct tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg;
typedef struct tyObject_Duration__IhPGomXjacpk8ChnxqMuoA tyObject_Duration__IhPGomXjacpk8ChnxqMuoA;
typedef struct tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg;
typedef struct tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw;
typedef struct tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ;
typedef struct tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw;
typedef struct tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
typedef struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw;
struct TNimTypeV2 {
	void* destructor;
	NI size;
	NI16 align;
	NI16 depth;
	NU32* display;
	void* traceImpl;
	void* typeInfoV1;
	NI flags;
	void* vTable[SEQ_DECL_SIZE];
};
struct tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA {
	NI rc;
	NI rootIdx;
};
struct tySequence__8Np6tlClE5az1CyqZdN19bQ {
  NI len; tySequence__8Np6tlClE5az1CyqZdN19bQ_Content* p;
};
struct tyObject_HashSet__9aAVrrL6o7xnFQncOPM0SYQ {
	tySequence__8Np6tlClE5az1CyqZdN19bQ data;
	NI counter;
};
struct tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A {
	tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* context;
	tyObject_HashSet__9aAVrrL6o7xnFQncOPM0SYQ referencedData;
	tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig* extraInternal;
};
struct tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw {
	NI len;
	NI cap;
	tyTuple__N4J9cV4JZGem3ljqqj5rT0Q* d;
};
struct tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ {
	NI len;
	NI cap;
	tyTuple__EMes4DT7YbRCwj3TmsFXyA* d;
};
struct tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A {
	tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw traceStack;
	tyObject_CellSeq__dIiPa2COtDnavhK2KIqxCQ toFree;
	NI freed;
	NI touched;
	NI edges;
	NI rcSum;
	NIM_BOOL keepThreshold;
};
struct tyTuple__N4J9cV4JZGem3ljqqj5rT0Q {
	void** Field0;
	TNimTypeV2* Field1;
};
typedef NIM_CHAR tyArray__gmOxl9bvv9akJHrSHNnFSMHg[4001];
typedef NU8 tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA;
typedef NU8 tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q;
typedef NU8 tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA;
struct tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag {
	int fd;
	NIM_BOOL isBuffered;
	tyArray__gmOxl9bvv9akJHrSHNnFSMHg buffer;
	NI currPos;
	NI bufLen;
	NIM_BOOL isSsl;
	tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* sslHandle;
	tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* sslContext;
	NIM_BOOL sslNoHandshake;
	NIM_BOOL sslHasPeekChar;
	NIM_CHAR sslPeekChar;
	NIM_BOOL sslNoShutdown;
	NI32 lastError;
	tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA domain;
	tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q sockType;
	tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA protocol;
};
typedef NU8 tyEnum_SslProtVersion__63N9cTBSInRxyR9c85mYOFZw;
typedef NU8 tyEnum_SslCVerifyMode__EuQlnQ2XUooe3ihTmPFZaQ;
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg {
	char dummy;
};
struct RootObj {
	TNimTypeV2* m_type;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ {
  NI len; tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content* p;
};
struct Exception {
	RootObj Sup;
	Exception* parent;
	NCSTRING name;
	NimStringV2 message;
	tySequence__3EvzHGO0xyXGnJBUggwfKQ trace;
	Exception* up;
};
struct tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug {
	Exception Sup;
};
struct tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA {
	tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug Sup;
};
typedef N_CDECL_PTR(NI, tyProc__aF4y9aPKIi8D4VGrVvX011Q) (NI a_p0, void* b_p1);
struct tyObject_IOError__FsM2LSiW5usgjecIvsloBA {
	tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug Sup;
};
typedef NCSTRING tyUncheckedArray__nvS6J9clHMUMHfoZd8Ad2zg[1];
typedef NimStringV2 tyArray__pK4u9cQ1bJzH46rrmNu9bPMQ[2];
typedef struct {
N_NIMCALL_PTR(NimStringV2, ClP_0) (NimStringV2 identity_p0, void* ClE_0);
void* ClE_0;
} tyProc__oFHfEKFsiYTMAy9a42cSiKw;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (NimStringV2 hint_p0, tyTuple__UV3llMMYFckfui8YMBuUZA* Result, void* ClE_0);
void* ClE_0;
} tyProc__lYMtBEH0vEMRzoDaCw5CJg;
struct tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig {
	RootObj Sup;
	tyProc__oFHfEKFsiYTMAy9a42cSiKw serverGetPskFunc;
	tyProc__lYMtBEH0vEMRzoDaCw5CJg clientGetPskFunc;
};
typedef NU8 tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w;
typedef NU8 tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w;
typedef int tyArray__4fBsehQGr9cX77f4jRh2sgw[31];
struct tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg {
	tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA val;
	NIM_BOOL has;
};
struct tyObject_Duration__IhPGomXjacpk8ChnxqMuoA {
	NI64 seconds;
	NI nanosecond;
};
struct tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg {
	tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug Sup;
};
struct tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw {
	NI64 ticks;
};
typedef NU8 tyEnum_SslHandshakeType__RgoNg67zPremT9a0QqPHgWQ;
typedef NU8 tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q;
typedef NU8 tyArray__dnD8kjh6rJ1Yy5jHvid0Ow[16];
typedef NU8 tyArray__ZphrDPKIBlVgF9aQajgV8qQ[4];
struct tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ {
	tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q family;
union{
	struct {
	tyArray__dnD8kjh6rJ1Yy5jHvid0Ow address_v6;
} _family_1;
	struct {
	tyArray__ZphrDPKIBlVgF9aQajgV8qQ address_v4;
} _family_2;
};
};
struct tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw {
	tyObject_CatchableError__liO6E8JNJNTVmf9cnXKZiug Sup;
};
struct tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ {
	NI a;
	NI b;
};
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
	NI Field0;
	NI Field1;
};
struct tySequence__8Np6tlClE5az1CyqZdN19bQ_Content { NI cap; tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ data[SEQ_DECL_SIZE]; };
struct tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw {
	NCSTRING procname;
	NI line;
	NCSTRING filename;
};
struct tySequence__3EvzHGO0xyXGnJBUggwfKQ_Content { NI cap; tyObject_StackTraceEntry__lcKzdyiD6sm3eeh28rx7fw data[SEQ_DECL_SIZE]; };
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
	NimStringV2 Field0;
	NimStringV2 Field1;
};
typedef NIM_CHAR tyArray__bErjiHmvISNmC2iIqkq21Q[256];
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2805)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u313)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u813)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3555)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u332)(tySequence__8Np6tlClE5az1CyqZdN19bQ dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u325)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* dest_p0, void* env_p1);
static N_INLINE(void, nimTraceRefDyn)(void* q_p0, void* env_p1);
static N_INLINE(void, add__system_u3076)(tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw* s_p0, void** c_p1, TNimTypeV2* t_p2);
N_LIB_PRIVATE N_NIMCALL(void, resize__system_u3084)(tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw* s_p0);
static N_INLINE(NI, pluspercent___system_u793)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2807)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u288)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicStatic)(void* p_p0, TNimTypeV2* desc_p1);
N_LIB_PRIVATE N_NIMCALL(void, nimRawDispose)(void* p_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u300)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* dest_p0, void* env_p1);
static N_INLINE(void, nimTraceRef)(void* q_p0, TNimTypeV2* desc_p1, void* env_p2);
static N_INLINE(void, nimIncRefCyclic)(void* p_p0, NIM_BOOL cyclic_p1);
N_CDECL(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*, TLS_method)(void);
N_LIB_PRIVATE N_NIMCALL(void, raiseSSLError__pureZnet_u857)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObj)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2904)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u867)(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___system_u3757)(tySequence__3EvzHGO0xyXGnJBUggwfKQ dest_p0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u879)(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA* dest_p0, void* env_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, eqdup___system_u2757)(NimStringV2 src_p0);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e_p0, NCSTRING ename_p1, NCSTRING procname_p2, NCSTRING filename_p3, NI line_p4);
N_CDECL(unsigned long, ERR_peek_last_error)(void);
N_CDECL(NCSTRING, ERR_error_string)(unsigned long e_p0, NCSTRING buf_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, cstrToNimstr)(NCSTRING str_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2760)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1);
static N_INLINE(void, copyMem__system_u1755)(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(NimStringV2, rawNewString)(NI space_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___system_u2751)(NimStringV2* dest_p0);
N_CDECL(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*, SSL_CTX_new)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* meth_p0);
N_CDECL(int, SSL_CTX_set_cipher_list)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* s_p0, NCSTRING ciphers_p1);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0);
N_LIB_PRIVATE N_NIMCALL(unsigned long, getOpenSSLVersion__wrappersZopenssl_u205)(void);
N_CDECL(int, SSL_CTX_set_ciphersuites)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, NCSTRING str_p1);
static N_INLINE(int, SSL_CTX_set_ecdh_auto__wrappersZopenssl_u492)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, int onoff_p1);
N_CDECL(long, SSL_CTX_ctrl)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, int cmd_p1, long larg_p2, void* parg_p3);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i_p0, NI64 a_p1, NI64 b_p2);
N_CDECL(void, SSL_CTX_set_verify)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* s_p0, NI mode_p1, tyProc__aF4y9aPKIi8D4VGrVvX011Q cb_p2);
N_LIB_PRIVATE N_NIMCALL(NI, SSLCTXSetMode__wrappersZopenssl_u418)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, NI mode_p1);
N_LIB_PRIVATE N_NIMCALL(void, loadCertificates__pureZnet_u1423)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, NimStringV2 certFile_p1, NimStringV2 keyFile_p2);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringV2 filename_p0);
N_STDCALL(int, SSL_CTX_use_certificate_chain_file)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, NCSTRING filename_p1);
N_CDECL(int, SSL_CTX_use_PrivateKey_file)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, NCSTRING filename_p1, int typ_p2);
N_CDECL(int, SSL_CTX_check_private_key)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0);
N_CDECL(int, SSL_CTX_load_verify_locations)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, NCSTRING CAfile_p1, NCSTRING CApath_p2);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, existsEnv__stdZenvvars_u20)(NimStringV2 key_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, getEnv__stdZenvvars_u15)(NimStringV2 key_p0, NimStringV2 default_p1);
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosextractFilename)(NimStringV2 path_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, normalizePathEnd__stdZprivateZospaths2_u42)(NimStringV2 path_p0, NIM_BOOL trailingSep_p1);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, nosjoinPath)(NimStringV2 head_p0, NimStringV2 tail_p1);
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__system_u2188)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL, nimSubInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(NIM_BOOL, eqeq___system_u9048)(NCSTRING x_p0, NCSTRING y_p1);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u95)(NimStringV2 msg_p0);
static N_INLINE(NIM_BOOL, nimAddInt)(NI a_p0, NI b_p1, NI* res_p2);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u2754)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nsuEndsWith)(NimStringV2 s_p0, NimStringV2 suffix_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosdirExists)(NimStringV2 dir_p0);
N_LIB_PRIVATE N_NIMCALL(void*, nimNewObjUninit)(NI size_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(tyObject_HashSet__9aAVrrL6o7xnFQncOPM0SYQ, initHashSet__pureZnet_u1488)(NI initialSize_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig*, new__pureZnet_u1543)(void);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2906)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u436)(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u448)(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig* dest_p0, void* env_p1);
N_CDECL(int, SSL_in_init)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__stdZoserrors_u119)(NI32 errorCode_p0, NimStringV2 additionalInfo_p1);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__stdZoserrors_u122)(void);
N_CDECL(void, ERR_clear_error)(void);
N_CDECL(int, SSL_shutdown)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0);
N_CDECL(int, SSL_get_error)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* s_p0, int ret_code_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDisconnectionError__pureZnet_u181)(tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p0, NI32 lastError_p1);
N_LIB_PRIVATE N_NIMCALL(void, socketError__pureZnet_u175)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NI err_p1, NIM_BOOL async_p2, NI32 lastError_p3, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p4);
N_LIB_PRIVATE N_NIMCALL(void, prepareAdd)(NimStringV2* s_p0, NI addLen_p1);
N_LIB_PRIVATE N_NIMCALL(NI32, getSocketError__pureZnet_u1878)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0);
N_CDECL(void, SSL_free)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0);
N_LIB_PRIVATE N_NIMCALL(void, close__pureZnativesockets_u201)(int socket_p0);
N_LIB_PRIVATE N_NIMCALL(tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q, toSockType__pureZnativesockets_u147)(tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA protocol_p0);
N_LIB_PRIVATE N_NIMCALL(struct addrinfo*, getAddrInfo__pureZnativesockets_u276)(NimStringV2 address_p0, NU16 port_p1, tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA domain_p2, tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q sockType_p3, tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA protocol_p4);
N_LIB_PRIVATE N_NIMCALL(tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg, toKnownDomain__pureZnativesockets_u69)(int family_p0);
static N_INLINE(NIM_BOOL, isNone__pureZnativesockets_u385)(tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg self_p0);
static N_INLINE(tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA*, unsafeGet__pureZnet_u2635)(tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg* self_p0);
static N_INLINE(NIM_BOOL, isSome__pureZnativesockets_u364)(tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg self_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NIMCALL(int, createNativeSocket__pureZnativesockets_u235)(tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA domain_p0, tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q sockType_p1, tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA protocol_p2, NIM_BOOL inheritable_p3);
N_LIB_PRIVATE N_NIMCALL(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag*, newSocket__pureZnet_u254)(int fd_p0, tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA domain_p1, tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q sockType_p2, tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA protocol_p3, NIM_BOOL buffered_p4);
N_LIB_PRIVATE N_NIMCALL(void, setSockOptInt__pureZnativesockets_u991)(int socket_p0, NI level_p1, NI optname_p2, NI optval_p3);
N_LIB_PRIVATE N_NIMCALL(NI, send__pureZnet_u2277)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* data_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isClosed__pureZnet_u2013)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0);
N_CDECL(int, SSL_write)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0, NCSTRING buf_p1, NI num_p2);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
N_LIB_PRIVATE N_NIMCALL(NI, recv__pureZnet_u2076)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* data_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(NI, readIntoBuf__pureZnet_u2027)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NI32 flags_p1);
N_LIB_PRIVATE N_NIMCALL(NI, uniRecv__pureZnet_u2016)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* buffer_p1, int size_p2, int flags_p3);
N_CDECL(int, SSL_read)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0, void* buf_p1, NI num_p2);
N_LIB_PRIVATE N_NIMCALL(NI, recv__pureZnet_u2180)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* data_p1, NI size_p2, NI timeout_p3);
N_LIB_PRIVATE N_NIMCALL(NI, waitFor__pureZnet_u2102)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, tyObject_Duration__IhPGomXjacpk8ChnxqMuoA* waited_p1, NI timeout_p2, NI size_p3, NimStringV2 funcName_p4);
N_LIB_PRIVATE N_NIMCALL(NI64, inMilliseconds__pureZtimes_u814)(tyObject_Duration__IhPGomXjacpk8ChnxqMuoA dur_p0);
static N_INLINE(NIM_BOOL, nimSubInt64)(NI64 a_p0, NI64 b_p1, NI64* res_p2);
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2929)(void* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u2122)(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u2134)(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg* dest_p0, void* env_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasDataBuffered__pureZnet_u2010)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* s_p0);
N_CDECL(int, SSL_pending)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw, getMonoTime__stdZmonotimes_u10)(void);
N_LIB_PRIVATE N_NIMCALL(NI, timeoutRead__pureZnet_u135)(int* fd_p0, NI timeout_p1);
N_LIB_PRIVATE N_NIMCALL(void, pluseq___pureZtimes_u1156)(tyObject_Duration__IhPGomXjacpk8ChnxqMuoA* d1_p0, tyObject_Duration__IhPGomXjacpk8ChnxqMuoA d2_p1);
N_LIB_PRIVATE N_NIMCALL(tyObject_Duration__IhPGomXjacpk8ChnxqMuoA, minus___stdZmonotimes_u63)(tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw a_p0, tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw b_p1);
N_LIB_PRIVATE N_NIMCALL(void, wrapSocket__pureZnet_u1772)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* ctx_p0, tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p1);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___pureZnet_u1582)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A** dest_p0, tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* src_p1, NIM_BOOL cyclic_p2);
N_CDECL(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*, SSL_new)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* context_p0);
N_CDECL(int, SSL_set_fd)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0, int fd_p1);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isIpAddress__pureZnet_u829)(NimStringV2 addressStr_p0);
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ, parseIpAddress__pureZnet_u821)(NimStringV2 addressStr_p0);
static N_INLINE(NIM_BOOL, contains__stdZprivateZospaths2_u380)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1);
static N_INLINE(NI, find__stdZprivateZospaths2_u385)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1);
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ, parseIPv6Address__pureZnet_u663)(NimStringV2 addressStr_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___pureZnet_u123)(tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q e_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseFieldErrorStr)(NimStringV2 f_p0, NimStringV2 discVal_p1);
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);
static N_INLINE(NimStringV2, X5BX5D___pureZstrutils_u1291)(NimStringV2 s_p0, tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ 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_u2493)(NimStringV2* s_p0);
static N_INLINE(tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ, dotdot___stdZstrbasics_u48)(NI a_p0, NI b_p1);
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ, parseIPv4Address__pureZnet_u564)(NimStringV2 addressStr_p0);
static N_INLINE(NIM_BOOL, isObjDisplayCheck)(TNimTypeV2* source_p0, NI16 targetDepth_p1, NU32 token_p2);
static N_INLINE(Exception*, nimBorrowCurrentException)(void);
static N_INLINE(void, popCurrentException)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___system_u3719)(Exception** dest_p0, Exception* src_p1, NIM_BOOL cyclic_p2);
N_LIB_PRIVATE N_NIMCALL(NI, SSL_set_tlsext_host_name__wrappersZopenssl_u427)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0, NCSTRING name_p1);
N_CDECL(int, SSL_connect)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0);
N_LIB_PRIVATE N_NIMCALL(void, checkCertName__pureZnet_u1784)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NimStringV2 hostname_p1);
N_LIB_PRIVATE N_NIMCALL(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*, SSL_get_peer_certificate__wrappersZopenssl_u814)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0);
N_CDECL(int, X509_check_host)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* cert_p0, NCSTRING name_p1, int namelen_p2, unsigned int flags_p3, NCSTRING peername_p4);
N_CDECL(void, X509_free)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* cert_p0);
N_CDECL(int, SSL_accept)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ssl_p0);
N_LIB_PRIVATE N_NIMCALL(void, readLine__pureZnet_u2223)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NimStringV2* line_p1, NI timeout_p2, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p3, NI maxLength_p4);
N_LIB_PRIVATE N_NIMCALL(NI, peekChar__pureZnet_u2218)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NIM_CHAR* c_p1);
static N_INLINE(void, nimAddCharV1)(NimStringV2* s_p0, NIM_CHAR c_p1);
N_LIB_PRIVATE TNimTypeV2 NTIv2__AhFePg9cWdCpCeTypFfYs7A_;
N_LIB_PRIVATE TNimTypeV2 NTIv2__TmGWJPpyEwcsRMnCyN509ag_;
N_LIB_PRIVATE TNimTypeV2 NTIv2__QfMdtWYnNv9aNM0cBkSKfkA_;
static const struct {
  NI cap; NIM_CHAR data[18+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_5 = { 18 | NIM_STRLIT_FLAG, "No error reported." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_6 = {18, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_5};
static const struct {
  NI cap; NIM_CHAR data[100+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_7 = { 100 | NIM_STRLIT_FLAG, "Please upgrade your OpenSSL library, it does not support the necessary protocols. OpenSSL error is: " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_8 = {100, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_7};
static const struct {
  NI cap; NIM_CHAR data[28+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_9 = { 28 | NIM_STRLIT_FLAG, "Failed to create TLS context" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_10 = {28, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_9};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_11 = {28, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_9};
static const struct {
  NI cap; NIM_CHAR data[0+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_12 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_13 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_14 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_15 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_16 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
extern TNimTypeV2 NTIv2__FsM2LSiW5usgjecIvsloBA_;
static const struct {
  NI cap; NIM_CHAR data[37+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_17 = { 37 | NIM_STRLIT_FLAG, "Certificate file could not be found: " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_18 = {37, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_17};
static const struct {
  NI cap; NIM_CHAR data[29+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_19 = { 29 | NIM_STRLIT_FLAG, "Key file could not be found: " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_20 = {29, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_19};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_21 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_22 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[40+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_23 = { 40 | NIM_STRLIT_FLAG, "Verification of private key file failed." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_24 = {40, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_23};
static const struct {
  NI cap; NIM_CHAR data[41+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_25 = { 41 | NIM_STRLIT_FLAG, "Failed to load SSL/TLS CA certificate(s)." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_26 = {41, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_25};
static const struct {
  NI cap; NIM_CHAR data[13+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_27 = { 13 | NIM_STRLIT_FLAG, "SSL_CERT_FILE" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_28 = {13, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_27};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_29 = {13, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_27};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_30 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[12+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_31 = { 12 | NIM_STRLIT_FLAG, "SSL_CERT_DIR" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_32 = {12, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_31};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_33 = {12, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_31};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_34 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[1+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_35 = { 1 | NIM_STRLIT_FLAG, "*" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_36 = {1, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_35};
static const struct {
  NI cap; NIM_CHAR data[58+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_38 = { 58 | NIM_STRLIT_FLAG, "osdirs.nim(92, 15) `f`gensym5.gl_pathv[i`gensym5] != nil` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_39 = {58, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_38};
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_41 = { 4 | NIM_STRLIT_FLAG, ".pem" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_42 = {4, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_41};
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_43 = { 4 | NIM_STRLIT_FLAG, ".crt" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_44 = {4, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_43};
static const struct {
  NI cap; NIM_CHAR data[3+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_45 = { 3 | NIM_STRLIT_FLAG, "*.0" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_46 = {3, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_45};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_48 = {58, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_38};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_50 = {1, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_35};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_52 = {58, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_38};
static const struct {
  NI cap; NIM_CHAR data[33+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_54 = { 33 | NIM_STRLIT_FLAG, "No SSL/TLS CA certificates found." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_55 = {33, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_54};
N_LIB_PRIVATE TNimTypeV2 NTIv2__HCHicI3N4HKjbTv49ccrcig_;
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_57 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_58 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[30+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_59 = { 30 | NIM_STRLIT_FLAG, "Couldn\'t add SIGPIPE to Sigset" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_60 = {30, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_59};
static const struct {
  NI cap; NIM_CHAR data[22+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_61 = { 22 | NIM_STRLIT_FLAG, "Couldn\'t block SIGPIPE" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_62 = {22, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_61};
static const struct {
  NI cap; NIM_CHAR data[65+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_63 = { 65 | NIM_STRLIT_FLAG, "TLS/SSL connection failed to initiate, socket closed prematurely." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_64 = {65, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_63};
static const struct {
  NI cap; NIM_CHAR data[26+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_65 = { 26 | NIM_STRLIT_FLAG, "Not enough data on socket." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_66 = {26, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_65};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_67 = {26, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_65};
static const struct {
  NI cap; NIM_CHAR data[41+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_68 = { 41 | NIM_STRLIT_FLAG, "Function for x509 lookup has been called." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_69 = {41, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_68};
static const struct {
  NI cap; NIM_CHAR data[22+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_70 = { 22 | NIM_STRLIT_FLAG, "IO error has occurred " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_71 = {22, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_70};
static const struct {
  NI cap; NIM_CHAR data[54+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_72 = { 54 | NIM_STRLIT_FLAG, "because an EOF was observed that violates the protocol" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_73 = {54, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_72};
static const struct {
  NI cap; NIM_CHAR data[16+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_74 = { 16 | NIM_STRLIT_FLAG, "in the BIO layer" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_75 = {16, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_74};
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_76 = { 2 | NIM_STRLIT_FLAG, ": " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_77 = {2, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_76};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_78 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[13+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_79 = { 13 | NIM_STRLIT_FLAG, "Unknown Error" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_80 = {13, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_79};
static const struct {
  NI cap; NIM_CHAR data[36+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_81 = { 36 | NIM_STRLIT_FLAG, "No valid socket error code available" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_82 = {36, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_81};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_83 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_84 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[24+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_85 = { 24 | NIM_STRLIT_FLAG, "Couldn\'t unblock SIGPIPE" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_86 = {24, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_85};
static const struct {
  NI cap; NIM_CHAR data[34+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_88 = { 34 | NIM_STRLIT_FLAG, "options.nim(380, 3) `self.isSome` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_89 = {34, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_88};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_90 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[40+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_91 = { 40 | NIM_STRLIT_FLAG, "net.nim(269, 3) `fd != osInvalidSocket` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_92 = {40, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_91};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_93 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[26+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_94 = { 26 | NIM_STRLIT_FLAG, "Couldn\'t resolve address: " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_95 = {26, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_94};
static const struct {
  NI cap; NIM_CHAR data[71+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_97 = { 71 | NIM_STRLIT_FLAG, "net.nim(1726, 9) `not socket.isClosed` Cannot `send` on a closed socket" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_98 = {71, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_97};
static const struct {
  NI cap; NIM_CHAR data[24+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_100 = { 24 | NIM_STRLIT_FLAG, "Could not send all data." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_101 = {24, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_100};
static const struct {
  NI cap; NIM_CHAR data[71+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_103 = { 71 | NIM_STRLIT_FLAG, "net.nim(1367, 9) `not socket.isClosed` Cannot `recv` on a closed socket" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_104 = {71, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_103};
static const struct {
  NI cap; NIM_CHAR data[40+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_108 = { 40 | NIM_STRLIT_FLAG, "net.nim(1415, 7) `size - read >= chunk` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_109 = {40, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_108};
static const struct {
  NI cap; NIM_CHAR data[26+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_115 = { 26 | NIM_STRLIT_FLAG, "net.nim(1451, 17) `false` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_116 = {26, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_115};
N_LIB_PRIVATE TNimTypeV2 NTIv2__spNCqmnrI61hixyO1Nuakg_;
static const struct {
  NI cap; NIM_CHAR data[9+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_120 = { 9 | NIM_STRLIT_FLAG, "Call to \'" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_121 = {9, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_120};
static const struct {
  NI cap; NIM_CHAR data[12+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_122 = { 12 | NIM_STRLIT_FLAG, "\' timed out." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_123 = {12, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_122};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_125 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_126 = {9, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_120};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_127 = {12, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_122};
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_129 = { 4 | NIM_STRLIT_FLAG, "recv" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_130 = {4, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_129};
static const struct {
  NI cap; NIM_CHAR data[40+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_132 = { 40 | NIM_STRLIT_FLAG, "net.nim(1488, 5) `avail <= size - read` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_133 = {40, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_132};
static const struct {
  NI cap; NIM_CHAR data[36+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_135 = { 36 | NIM_STRLIT_FLAG, "net.nim(820, 11) `not socket.isSsl` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_136 = {36, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_135};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_137 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_138 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
extern TNimTypeV2 NTIv2__YUzEEs8pGqG7cYmcRoc5rw_;
static const struct {
  NI cap; NIM_CHAR data[26+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_139 = { 26 | NIM_STRLIT_FLAG, "IP Address string is empty" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_140 = {26, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_139};
static const struct {
  NI cap; NIM_CHAR data[18+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_142 = { 18 | NIM_STRLIT_FLAG, "Invalid IP Address" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_143 = {18, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_142};
static const struct {
  NI cap; NIM_CHAR data[57+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_144 = { 57 | NIM_STRLIT_FLAG, "Invalid IP Address. Address contains an invalid separator" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_145 = {57, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_144};
static const struct {
  NI cap; NIM_CHAR data[65+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_146 = { 65 | NIM_STRLIT_FLAG, "Invalid IP Address. Address contains more than one \"::\" separator" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_147 = {65, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_146};
static const struct {
  NI cap; NIM_CHAR data[59+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_148 = { 59 | NIM_STRLIT_FLAG, "Invalid IP Address. The address consists of too many groups" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_149 = {59, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_148};
static const struct {
  NI cap; NIM_CHAR data[74+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_150 = { 74 | NIM_STRLIT_FLAG, "field \'address_v6\' is not accessible for type \'IpAddress\' using \'family = " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_151 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_152 = { 4 | NIM_STRLIT_FLAG, "IPv6" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_153 = {4, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_152};
static const struct {
  NI cap; NIM_CHAR data[4+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_154 = { 4 | NIM_STRLIT_FLAG, "IPv4" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_155 = {4, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_154};
static const struct {
  NI cap; NIM_CHAR data[0+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_156 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_157 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_156};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_159 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const struct {
  NI cap; NIM_CHAR data[50+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_163 = { 50 | NIM_STRLIT_FLAG, "Invalid IP Address. Address may not start with \":\"" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_164 = {50, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_163};
static const struct {
  NI cap; NIM_CHAR data[48+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_166 = { 48 | NIM_STRLIT_FLAG, "Invalid IP Address. Address may not end with \":\"" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_167 = {48, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_166};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_169 = {18, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_142};
static const struct {
  NI cap; NIM_CHAR data[41+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_173 = { 41 | NIM_STRLIT_FLAG, "Invalid IP Address. Value is out of range" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_174 = {41, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_173};
static const struct {
  NI cap; NIM_CHAR data[57+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_175 = { 57 | NIM_STRLIT_FLAG, "Invalid IP Address. Address contains an invalid character" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_176 = {57, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_175};
static const struct {
  NI cap; NIM_CHAR data[93+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_177 = { 93 | NIM_STRLIT_FLAG, "iterators.nim(206, 11) `len(a) == L` the length of the string changed while iterating over it" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_178 = {93, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_177};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_179 = {59, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_148};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_180 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_182 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const struct {
  NI cap; NIM_CHAR data[45+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_190 = { 45 | NIM_STRLIT_FLAG, "Invalid IP address. Octal numbers not allowed" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_191 = {45, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_190};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_193 = {41, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_173};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_194 = {18, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_142};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_195 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_199 = {57, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_175};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_200 = {93, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_177};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_201 = {18, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_142};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_202 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_206 = {59, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_148};
static const struct {
  NI cap; NIM_CHAR data[58+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_207 = { 58 | NIM_STRLIT_FLAG, "Invalid IP Address. The address consists of too few groups" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_208 = {58, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_207};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_213 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_215 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_222 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_150};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_226 = {59, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_148};
static const struct {
  NI cap; NIM_CHAR data[49+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_227 = { 49 | NIM_STRLIT_FLAG, "Invalid IP address. Octal numbers are not allowed" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_228 = {49, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_227};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_230 = {41, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_173};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_231 = {59, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_148};
static const struct {
  NI cap; NIM_CHAR data[74+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_232 = { 74 | NIM_STRLIT_FLAG, "field \'address_v4\' is not accessible for type \'IpAddress\' using \'family = " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_233 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_232};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_235 = {57, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_175};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_237 = {18, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_142};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_238 = {74, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_232};
static const struct {
  NI cap; NIM_CHAR data[31+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_239 = { 31 | NIM_STRLIT_FLAG, "net.nim(838, 7) `socket.isSsl` " };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_240 = {31, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_239};
static const struct {
  NI cap; NIM_CHAR data[25+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_241 = { 25 | NIM_STRLIT_FLAG, "No SSL certificate found." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_242 = {25, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_241};
static const struct {
  NI cap; NIM_CHAR data[29+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_243 = { 29 | NIM_STRLIT_FLAG, "SSL Certificate check failed." };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_244 = {29, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_243};
static const struct {
  NI cap; NIM_CHAR data[17+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_245 = { 17 | NIM_STRLIT_FLAG, "SSL import failed" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_246 = {17, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_245};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_247 = {0, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_12};
static const struct {
  NI cap; NIM_CHAR data[8+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_248 = { 8 | NIM_STRLIT_FLAG, "readLine" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_249 = {8, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_248};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_250 = {8, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_248};
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__XqsrSBxhOTPgLQ9cX4MmV4A_252 = { 2 | NIM_STRLIT_FLAG, "\015\012" };
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_253 = {2, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_252};
static const NimStringV2 TM__XqsrSBxhOTPgLQ9cX4MmV4A_254 = {2, (NimStrPayload*)&TM__XqsrSBxhOTPgLQ9cX4MmV4A_252};
extern NIM_CONST tyArray__pK4u9cQ1bJzH46rrmNu9bPMQ certificatePaths__pureZssl95certs_u3;
static NIM_CONST NU32 TM__XqsrSBxhOTPgLQ9cX4MmV4A_2[1] = {291388928};
N_LIB_PRIVATE TNimTypeV2 NTIv2__AhFePg9cWdCpCeTypFfYs7A_ = {.destructor = (void*)rttiDestroy__pureZnet_u2805, .size = sizeof(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A), .align = (NI16) NIM_ALIGNOF(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A), .depth = 0, .display = TM__XqsrSBxhOTPgLQ9cX4MmV4A_2, .traceImpl = (void*)eqtrace___pureZnet_u325, .flags = 0};
static NIM_CONST NU32 TM__XqsrSBxhOTPgLQ9cX4MmV4A_3[1] = {1637229568};
N_LIB_PRIVATE TNimTypeV2 NTIv2__TmGWJPpyEwcsRMnCyN509ag_ = {.destructor = (void*)rttiDestroy__pureZnet_u2807, .size = sizeof(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag), .align = (NI16) NIM_ALIGNOF(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag), .depth = 0, .display = TM__XqsrSBxhOTPgLQ9cX4MmV4A_3, .traceImpl = (void*)eqtrace___pureZnet_u300, .flags = 0};
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4198;
static NIM_CONST NU32 TM__XqsrSBxhOTPgLQ9cX4MmV4A_4[4] = {3701606400, 1285336064, 599397120, 4078810368};
N_LIB_PRIVATE TNimTypeV2 NTIv2__QfMdtWYnNv9aNM0cBkSKfkA_ = {.destructor = (void*)rttiDestroy__pureZnet_u2904, .size = sizeof(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA), .align = (NI16) NIM_ALIGNOF(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA), .depth = 3, .display = TM__XqsrSBxhOTPgLQ9cX4MmV4A_4, .traceImpl = (void*)eqtrace___pureZnet_u879, .flags = 0};
static NIM_CONST NU32 TM__XqsrSBxhOTPgLQ9cX4MmV4A_56[2] = {3701606400, 568487936};
N_LIB_PRIVATE TNimTypeV2 NTIv2__HCHicI3N4HKjbTv49ccrcig_ = {.destructor = (void*)rttiDestroy__pureZnet_u2906, .size = sizeof(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig), .align = (NI16) NIM_ALIGNOF(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig), .depth = 1, .display = TM__XqsrSBxhOTPgLQ9cX4MmV4A_56, .traceImpl = (void*)eqtrace___pureZnet_u448, .flags = 0};
extern int osInvalidSocket__pureZnativesockets_u48;
static NIM_CONST NU32 TM__XqsrSBxhOTPgLQ9cX4MmV4A_119[4] = {3701606400, 1285336064, 599397120, 2470619648};
N_LIB_PRIVATE TNimTypeV2 NTIv2__spNCqmnrI61hixyO1Nuakg_ = {.destructor = (void*)rttiDestroy__pureZnet_u2929, .size = sizeof(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg), .align = (NI16) NIM_ALIGNOF(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg), .depth = 3, .display = TM__XqsrSBxhOTPgLQ9cX4MmV4A_119, .traceImpl = (void*)eqtrace___pureZnet_u2134, .flags = 0};
extern NIM_THREADVAR Exception* currException__system_u3686;
static N_INLINE(NI, minuspercent___system_u813)(NI x_p0, NI y_p1) {
	NI result;
	result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
	return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
	NIM_BOOL result;
	result = NIM_FALSE;
	{
		tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA* cell_1;
		NI T5_;
		if (!!((p_p0 == NIM_NIL))) goto LA3_;
		T5_ = (NI)0;
		T5_ = minuspercent___system_u813(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
		cell_1 = ((tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA*) (T5_));
		{
			if (!((NI)((*cell_1).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
			result = NIM_TRUE;
		}
		goto LA6_;
LA8_: ;
		{
			(*cell_1).rc = minuspercent___system_u813((*cell_1).rc, ((NI)16));
		}
LA6_: ;
		rememberCycle__system_u3555(result, cell_1, (*((TNimTypeV2**) (p_p0))));
	}
LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u313)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).extraInternal);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose((*dest_p0).extraInternal);
	}
LA4_: ;
	eqdestroy___pureZnet_u332((*dest_p0).referencedData.data);
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2805)(void* dest_p0) {
	eqdestroy___pureZnet_u313(((tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A*) (dest_p0)));
}
static N_INLINE(NI, pluspercent___system_u793)(NI x_p0, NI y_p1) {
	NI result;
	result = ((NI) ((NU)((NU64)(((NU) (x_p0))) + (NU64)(((NU) (y_p1))))));
	return result;
}
static N_INLINE(void, add__system_u3076)(tyObject_CellSeq__ssWvVk43J2HePNvNGK2tCw* s_p0, void** c_p1, TNimTypeV2* t_p2) {
	void** colontmp_;
	TNimTypeV2* colontmp__2;
	{
		if (!((*s_p0).cap <= (*s_p0).len)) goto LA3_;
		resize__system_u3084(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_u793((*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__1z8AJ0tfLlYlFBizZRHD7A* j_1;
		if (!!(((*p_1) == NIM_NIL))) goto LA3_;
		j_1 = ((tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A*) (env_p1));
		add__system_u3076((&(*j_1).traceStack), p_1, (*((TNimTypeV2**) ((*p_1)))));
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u325)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* dest_p0, void* env_p1) {
	nimTraceRefDyn(&(*dest_p0).extraInternal, env_p1);
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicStatic)(void* p_p0, TNimTypeV2* desc_p1) {
	NIM_BOOL result;
	result = NIM_FALSE;
	{
		tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA* cell_1;
		NI T5_;
		if (!!((p_p0 == NIM_NIL))) goto LA3_;
		T5_ = (NI)0;
		T5_ = minuspercent___system_u813(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
		cell_1 = ((tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA*) (T5_));
		{
			if (!((NI)((*cell_1).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
			result = NIM_TRUE;
		}
		goto LA6_;
LA8_: ;
		{
			(*cell_1).rc = minuspercent___system_u813((*cell_1).rc, ((NI)16));
		}
LA6_: ;
		rememberCycle__system_u3555(result, cell_1, desc_p1);
	}
LA3_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u288)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicStatic((*dest_p0).sslContext, ((TNimTypeV2*) ((&NTIv2__AhFePg9cWdCpCeTypFfYs7A_))));
		if (!T3_) goto LA4_;
		eqdestroy___pureZnet_u313((&(*(*dest_p0).sslContext)));
		nimRawDispose((*dest_p0).sslContext, ((NI)8));
	}
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2807)(void* dest_p0) {
	eqdestroy___pureZnet_u288(((tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag*) (dest_p0)));
}
static N_INLINE(void, nimTraceRef)(void* q_p0, TNimTypeV2* desc_p1, void* env_p2) {
	void** p_1;
	p_1 = ((void**) (q_p0));
	{
		tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A* j_1;
		if (!!(((*p_1) == NIM_NIL))) goto LA3_;
		j_1 = ((tyObject_GcEnv__1z8AJ0tfLlYlFBizZRHD7A*) (env_p2));
		add__system_u3076((&(*j_1).traceStack), p_1, desc_p1);
	}
LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u300)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* dest_p0, void* env_p1) {
	nimTraceRef(&(*dest_p0).sslContext, ((TNimTypeV2*) ((&NTIv2__AhFePg9cWdCpCeTypFfYs7A_))), env_p1);
}
static N_INLINE(void, nimIncRefCyclic)(void* p_p0, NIM_BOOL cyclic_p1) {
	tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA* h_1;
	NI T1_;
	T1_ = (NI)0;
	T1_ = minuspercent___system_u813(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
	h_1 = ((tyObject_RefHeader__BVEqx9abcuAhztUEHxbqQJA*) (T1_));
	(*h_1).rc = pluspercent___system_u793((*h_1).rc, ((NI)16));
}
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___pureZnet_u1582)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A** dest_p0, tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* src_p1, NIM_BOOL cyclic_p2) {
	tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* 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_ = nimDecRefIsLastCyclicStatic(colontmp_, ((TNimTypeV2*) ((&NTIv2__AhFePg9cWdCpCeTypFfYs7A_))));
		if (!T7_) goto LA8_;
		eqdestroy___pureZnet_u313((&(*colontmp_)));
		nimRawDispose(colontmp_, ((NI)8));
	}
LA8_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqsink___pureZnet_u1590)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A** dest_p0, tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* src_p1) {
	tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* colontmp_;
	colontmp_ = (*dest_p0);
	(*dest_p0) = src_p1;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicStatic(colontmp_, ((TNimTypeV2*) ((&NTIv2__AhFePg9cWdCpCeTypFfYs7A_))));
		if (!T3_) goto LA4_;
		eqdestroy___pureZnet_u313((&(*colontmp_)));
		nimRawDispose(colontmp_, ((NI)8));
	}
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u867)(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).Sup.Sup.up);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose((*dest_p0).Sup.Sup.up);
	}
LA4_: ;
	eqdestroy___system_u3757((*dest_p0).Sup.Sup.trace);
	if ((*dest_p0).Sup.Sup.message.p && !((*dest_p0).Sup.Sup.message.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Sup.Sup.message.p);
}
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = nimDecRefIsLastCyclicDyn((*dest_p0).Sup.Sup.parent);
		if (!T8_) goto LA9_;
		nimDestroyAndDispose((*dest_p0).Sup.Sup.parent);
	}
LA9_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (&nimInErrorMode__system_u4198);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2904)(void* dest_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	eqdestroy___pureZnet_u867(((tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA*) (dest_p0)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u879)(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA* dest_p0, void* env_p1) {
	nimTraceRefDyn(&(*dest_p0).Sup.Sup.parent, env_p1);
	nimTraceRefDyn(&(*dest_p0).Sup.Sup.up, env_p1);
}
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_u1755)(void* dest_p0, void* source_p1, NI size_p2) {
	nimCopyMem(dest_p0, source_p1, size_p2);
}
static N_INLINE(void, appendString)(NimStringV2* dest_p0, NimStringV2 src_p1) {
	{
		if (!(((NI)0) < src_p1.len)) goto LA3_;
		copyMem__system_u1755(((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, raiseSSLError__pureZnet_u857)(NimStringV2 s_p0) {
	NimStringV2 errStr_1;
	unsigned long err_1;
	NCSTRING T12_;
	tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA* T16_;
	NimStringV2 blitTmp_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	errStr_1.len = 0; errStr_1.p = NIM_NIL;
	{
		NimStringV2 colontmpD_;
		tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA* T6_;
		if (!!((s_p0.len == 0))) goto LA4_;
		T6_ = NIM_NIL;
		T6_ = (tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA*) nimNewObj(sizeof(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA), NIM_ALIGNOF(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA));
		(*T6_).Sup.Sup.Sup.m_type = (&NTIv2__QfMdtWYnNv9aNM0cBkSKfkA_);
		(*T6_).Sup.Sup.name = "SslError";
		colontmpD_ = eqdup___system_u2757(s_p0);
		(*T6_).Sup.Sup.message = colontmpD_;
		(*T6_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T6_, "SslError", "raiseSSLError", "net.nim", 567);
goto LA1_;
	}
LA4_: ;
	err_1 = ERR_peek_last_error();
	{
		tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA* T11_;
		if (!(err_1 == ((NU)0))) goto LA9_;
		T11_ = NIM_NIL;
		T11_ = (tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA*) nimNewObj(sizeof(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA), NIM_ALIGNOF(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA));
		(*T11_).Sup.Sup.Sup.m_type = (&NTIv2__QfMdtWYnNv9aNM0cBkSKfkA_);
		(*T11_).Sup.Sup.name = "SslError";
		(*T11_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_6;
		(*T11_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T11_, "SslError", "raiseSSLError", "net.nim", 570);
goto LA1_;
	}
LA9_: ;
	T12_ = (NCSTRING)0;
	T12_ = ERR_error_string(err_1, ((NCSTRING) NIM_NIL));
	errStr_1 = cstrToNimstr(T12_);
	switch (err_1) {
	case ((unsigned long)336032814):
	case ((unsigned long)336032784):
	{
		NimStringV2 T14_;
		T14_.len = 0; T14_.p = NIM_NIL;
		T14_ = rawNewString(errStr_1.len + 100);
appendString((&T14_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_8);
appendString((&T14_), errStr_1);
		eqsink___system_u2760((&errStr_1), T14_);
	}
	break;
	default:
	{
	}
	break;
	}
	T16_ = NIM_NIL;
	T16_ = (tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA*) nimNewObj(sizeof(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA), NIM_ALIGNOF(tyObject_SslError__QfMdtWYnNv9aNM0cBkSKfkA));
	(*T16_).Sup.Sup.Sup.m_type = (&NTIv2__QfMdtWYnNv9aNM0cBkSKfkA_);
	(*T16_).Sup.Sup.name = "SslError";
	blitTmp_1 = errStr_1;
	eqwasMoved___system_u2751((&errStr_1));
	(*T16_).Sup.Sup.message = blitTmp_1;
	(*T16_).Sup.Sup.parent = ((Exception*) NIM_NIL);
	raiseExceptionEx((Exception*)T16_, "SslError", "raiseSSLError", "net.nim", 578);
goto LA1_;
	{
		LA1_:;
	}
	{
		if (errStr_1.p && !(errStr_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(errStr_1.p);
}
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringV2 s_p0) {
	NCSTRING result;
	{
		if (!(s_p0.len == ((NI)0))) goto LA3_;
		result = "";
	}
	goto LA1_;
LA3_: ;
	{
		result = ((NCSTRING) ((*s_p0.p).data));
	}
LA1_: ;
	return result;
}
static N_INLINE(int, SSL_CTX_set_ecdh_auto__wrappersZopenssl_u492)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, int onoff_p1) {
	int result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (int)0;
	{
		NIM_BOOL T3_;
		unsigned long T4_;
		unsigned long T6_;
		long T9_;
		T3_ = (NIM_BOOL)0;
		T4_ = (unsigned long)0;
		T4_ = getOpenSSLVersion__wrappersZopenssl_u205();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T3_ = ((NU64)(T4_) < (NU64)(((NU)269484032)));
		if (T3_) goto LA5_;
		T6_ = (unsigned long)0;
		T6_ = getOpenSSLVersion__wrappersZopenssl_u205();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T3_ = (T6_ == ((NU)536870912));
LA5_: ;
		if (!T3_) goto LA7_;
		T9_ = (long)0;
		T9_ = SSL_CTX_ctrl(ctx_p0, ((int)94), ((long) (onoff_p1)), NIM_NIL);
		if ((T9_) < ((int)(-2147483647 -1)) || (T9_) > ((int)2147483647)){ raiseRangeErrorI(T9_, ((int)(-2147483647 -1)), ((int)2147483647)); goto BeforeRet_;
		}
		result = ((int) (T9_));
	}
	goto LA1_;
LA7_: ;
	{
		result = ((int)1);
	}
LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, loadCertificates__pureZnet_u1423)(tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* ctx_p0, NimStringV2 certFile_p1, NimStringV2 keyFile_p2) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		NIM_BOOL T3_;
		NIM_BOOL T5_;
		tyObject_IOError__FsM2LSiW5usgjecIvsloBA* T8_;
		NimStringV2 T9_;
		T3_ = (NIM_BOOL)0;
		T3_ = !((certFile_p1.len == 0));
		if (!(T3_)) goto LA4_;
		T5_ = (NIM_BOOL)0;
		T5_ = nosfileExists(certFile_p1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T3_ = !(T5_);
LA4_: ;
		if (!T3_) goto LA6_;
		T8_ = NIM_NIL;
		T8_ = (tyObject_IOError__FsM2LSiW5usgjecIvsloBA*) nimNewObj(sizeof(tyObject_IOError__FsM2LSiW5usgjecIvsloBA), NIM_ALIGNOF(tyObject_IOError__FsM2LSiW5usgjecIvsloBA));
		(*T8_).Sup.Sup.Sup.m_type = (&NTIv2__FsM2LSiW5usgjecIvsloBA_);
		(*T8_).Sup.Sup.name = "IOError";
		T9_.len = 0; T9_.p = NIM_NIL;
		T9_ = rawNewString(certFile_p1.len + 37);
appendString((&T9_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_18);
appendString((&T9_), certFile_p1);
		(*T8_).Sup.Sup.message = T9_;
		(*T8_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T8_, "IOError", "loadCertificates", "net.nim", 605);
goto BeforeRet_;
	}
LA6_: ;
	{
		NIM_BOOL T12_;
		NIM_BOOL T14_;
		tyObject_IOError__FsM2LSiW5usgjecIvsloBA* T17_;
		NimStringV2 T18_;
		T12_ = (NIM_BOOL)0;
		T12_ = !((keyFile_p2.len == 0));
		if (!(T12_)) goto LA13_;
		T14_ = (NIM_BOOL)0;
		T14_ = nosfileExists(keyFile_p2);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T12_ = !(T14_);
LA13_: ;
		if (!T12_) goto LA15_;
		T17_ = NIM_NIL;
		T17_ = (tyObject_IOError__FsM2LSiW5usgjecIvsloBA*) nimNewObj(sizeof(tyObject_IOError__FsM2LSiW5usgjecIvsloBA), NIM_ALIGNOF(tyObject_IOError__FsM2LSiW5usgjecIvsloBA));
		(*T17_).Sup.Sup.Sup.m_type = (&NTIv2__FsM2LSiW5usgjecIvsloBA_);
		(*T17_).Sup.Sup.name = "IOError";
		T18_.len = 0; T18_.p = NIM_NIL;
		T18_ = rawNewString(keyFile_p2.len + 29);
appendString((&T18_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_20);
appendString((&T18_), keyFile_p2);
		(*T17_).Sup.Sup.message = T18_;
		(*T17_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T17_, "IOError", "loadCertificates", "net.nim", 608);
goto BeforeRet_;
	}
LA15_: ;
	{
		int ret_1;
		if (!!((certFile_p1.len == 0))) goto LA21_;
		ret_1 = SSL_CTX_use_certificate_chain_file(ctx_p0, nimToCStringConv(certFile_p1));
		{
			if (!!((ret_1 == ((NI32)1)))) goto LA25_;
			raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_21);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA25_: ;
	}
LA21_: ;
	{
		if (!!((keyFile_p2.len == 0))) goto LA29_;
		{
			int T33_;
			T33_ = (int)0;
			T33_ = SSL_CTX_use_PrivateKey_file(ctx_p0, nimToCStringConv(keyFile_p2), ((int)1));
			if (!!((T33_ == ((NI32)1)))) goto LA34_;
			raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_22);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA34_: ;
		{
			int T38_;
			T38_ = (int)0;
			T38_ = SSL_CTX_check_private_key(ctx_p0);
			if (!!((T38_ == ((NI32)1)))) goto LA39_;
			raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_24);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA39_: ;
	}
LA29_: ;
	}BeforeRet_: ;
}
static N_INLINE(void, eqdestroy___system_u281)(NimStringV2 x_p0) {
}
static N_INLINE(void, nimSetMem__system_u2188)(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_u2188(p_p0, ((int)0), size_p1);
}
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, eqeq___system_u9048)(NCSTRING x_p0, NCSTRING y_p1) {
	NIM_BOOL result;
	{
		if (!(((void*) (x_p0)) == ((void*) (y_p1)))) goto LA3_;
		result = NIM_TRUE;
	}
	goto LA1_;
LA3_: ;
	{
		NIM_BOOL T6_;
		T6_ = (NIM_BOOL)0;
		T6_ = (((void*) (x_p0)) == NIM_NIL);
		if (T6_) goto LA7_;
		T6_ = (((void*) (y_p1)) == NIM_NIL);
LA7_: ;
		if (!T6_) goto LA8_;
		result = NIM_FALSE;
	}
	goto LA1_;
LA8_: ;
	{
		int T11_;
		T11_ = (int)0;
		T11_ = strcmp(x_p0, y_p1);
		result = (T11_ == ((NI32)0));
	}
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;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u1555)(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig* 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(void, eqdestroy___pureZnet_u436)(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).clientGetPskFunc.ClE_0);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose((*dest_p0).clientGetPskFunc.ClE_0);
	}
LA4_: ;
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = nimDecRefIsLastCyclicDyn((*dest_p0).serverGetPskFunc.ClE_0);
		if (!T8_) goto LA9_;
		nimDestroyAndDispose((*dest_p0).serverGetPskFunc.ClE_0);
	}
LA9_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2906)(void* dest_p0) {
	eqdestroy___pureZnet_u436(((tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig*) (dest_p0)));
}
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u448)(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig* dest_p0, void* env_p1) {
	nimTraceRefDyn((&(*dest_p0).serverGetPskFunc.ClE_0), env_p1);
	nimTraceRefDyn((&(*dest_p0).clientGetPskFunc.ClE_0), env_p1);
}
N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___pureZnet_u1552)(tyObject_SslContextExtraInternalcolonObjectType___HCHicI3N4HKjbTv49ccrcig** dest_p0) {
	(*dest_p0) = 0;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A*, newContext__pureZnet_u1430)(tyEnum_SslProtVersion__63N9cTBSInRxyR9c85mYOFZw protVersion_p0, tyEnum_SslCVerifyMode__EuQlnQ2XUooe3ihTmPFZaQ verifyMode_p1, NimStringV2 certFile_p2, NimStringV2 keyFile_p3, NimStringV2 cipherList_p4, NimStringV2 caDir_p5, NimStringV2 caFile_p6, NimStringV2 ciphersuites_p7) {
	tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* result;
	tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* mtd_1;
	tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* newCTX_1;
	unsigned long sslVersion_1;
	NI T36_;
	tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* T304_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = NIM_NIL;
	mtd_1 = (tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*)0;
	mtd_1 = TLS_method();
	{
		if (!(mtd_1 == ((tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*) NIM_NIL))) goto LA3_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_10);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	newCTX_1 = SSL_CTX_new(mtd_1);
	{
		if (!(newCTX_1 == ((tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*) NIM_NIL))) goto LA7_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA7_: ;
	{
		int T11_;
		T11_ = (int)0;
		T11_ = SSL_CTX_set_cipher_list(newCTX_1, nimToCStringConv(cipherList_p4));
		if (!!((T11_ == ((NI32)1)))) goto LA12_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_13);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA12_: ;
	sslVersion_1 = getOpenSSLVersion__wrappersZopenssl_u205();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NIM_BOOL T16_;
		T16_ = (NIM_BOOL)0;
		T16_ = ((NU64)(((NU)269488128)) <= (NU64)(sslVersion_1));
		if (!(T16_)) goto LA17_;
		T16_ = !((sslVersion_1 == ((NU)536870912)));
LA17_: ;
		if (!T16_) goto LA18_;
		{
			int T22_;
			T22_ = (int)0;
			T22_ = SSL_CTX_set_ciphersuites(newCTX_1, nimToCStringConv(ciphersuites_p7));
			if (!!((T22_ == ((NI32)1)))) goto LA23_;
			raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_14);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA23_: ;
	}
LA18_: ;
	{
		int T27_;
		T27_ = (int)0;
		T27_ = SSL_CTX_set_ecdh_auto__wrappersZopenssl_u492(newCTX_1, ((int)1));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!((T27_ == ((NI32)1)))) goto LA28_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_15);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA28_: ;
	switch (verifyMode_p1) {
	case ((tyEnum_SslCVerifyMode__EuQlnQ2XUooe3ihTmPFZaQ)1):
	case ((tyEnum_SslCVerifyMode__EuQlnQ2XUooe3ihTmPFZaQ)2):
	{
		SSL_CTX_set_verify(newCTX_1, ((NI)1), NIM_NIL);
	}
	break;
	case ((tyEnum_SslCVerifyMode__EuQlnQ2XUooe3ihTmPFZaQ)0):
	{
		SSL_CTX_set_verify(newCTX_1, ((NI)0), NIM_NIL);
	}
	break;
	default: __builtin_unreachable();
	}
	{
		if (!(newCTX_1 == ((tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*) NIM_NIL))) goto LA34_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_16);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA34_: ;
	T36_ = (NI)0;
	T36_ = SSLCTXSetMode__wrappersZopenssl_u418(newCTX_1, ((NI)4));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(void)(T36_);
	loadCertificates__pureZnet_u1423(newCTX_1, certFile_p2, keyFile_p3);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!!((verifyMode_p1 == ((tyEnum_SslCVerifyMode__EuQlnQ2XUooe3ihTmPFZaQ)0)))) goto LA39_;
		{
			NIM_BOOL T43_;
			NCSTRING colontmpD_;
			NCSTRING colontmpD__2;
			NCSTRING colontmpD__3;
			NCSTRING colontmpD__4;
			T43_ = (NIM_BOOL)0;
			T43_ = !((caDir_p5.len == 0));
			if (T43_) goto LA44_;
			T43_ = !((caFile_p6.len == 0));
LA44_: ;
			if (!T43_) goto LA45_;
			colontmpD_ = (NCSTRING)0;
			colontmpD__2 = (NCSTRING)0;
			colontmpD__3 = (NCSTRING)0;
			colontmpD__4 = (NCSTRING)0;
			{
				NCSTRING T49_;
				NCSTRING T55_;
				int T61_;
				tyObject_IOError__FsM2LSiW5usgjecIvsloBA* T64_;
				T49_ = (NCSTRING)0;
				{
					if (!(caFile_p6.len == 0)) goto LA52_;
					colontmpD_ = ((NCSTRING) NIM_NIL);
					T49_ = colontmpD_;
				}
				goto LA50_;
LA52_: ;
				{
					colontmpD__2 = nimToCStringConv(caFile_p6);
					T49_ = colontmpD__2;
				}
LA50_: ;
				T55_ = (NCSTRING)0;
				{
					if (!(caDir_p5.len == 0)) goto LA58_;
					colontmpD__3 = ((NCSTRING) NIM_NIL);
					T55_ = colontmpD__3;
				}
				goto LA56_;
LA58_: ;
				{
					colontmpD__4 = nimToCStringConv(caDir_p5);
					T55_ = colontmpD__4;
				}
LA56_: ;
				T61_ = (int)0;
				T61_ = SSL_CTX_load_verify_locations(newCTX_1, T49_, T55_);
				if (!!((T61_ == ((NI32)1)))) goto LA62_;
				T64_ = NIM_NIL;
				T64_ = (tyObject_IOError__FsM2LSiW5usgjecIvsloBA*) nimNewObj(sizeof(tyObject_IOError__FsM2LSiW5usgjecIvsloBA), NIM_ALIGNOF(tyObject_IOError__FsM2LSiW5usgjecIvsloBA));
				(*T64_).Sup.Sup.Sup.m_type = (&NTIv2__FsM2LSiW5usgjecIvsloBA_);
				(*T64_).Sup.Sup.name = "IOError";
				(*T64_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_26;
				(*T64_).Sup.Sup.parent = ((Exception*) NIM_NIL);
				raiseExceptionEx((Exception*)T64_, "IOError", "newContext", "net.nim", 715);
goto BeforeRet_;
			}
LA62_: ;
		}
		goto LA41_;
LA45_: ;
		{
			NIM_BOOL colontmpD__5;
			NIM_BOOL colontmpD__6;
			NIM_BOOL found_1;
			NIM_BOOL useEnvVars_1;
			colontmpD__5 = (NIM_BOOL)0;
			colontmpD__6 = (NIM_BOOL)0;
			found_1 = NIM_FALSE;
			{
				if (!(verifyMode_p1 == ((tyEnum_SslCVerifyMode__EuQlnQ2XUooe3ihTmPFZaQ)2))) goto LA68_;
				colontmpD__5 = NIM_TRUE;
				useEnvVars_1 = colontmpD__5;
			}
			goto LA66_;
LA68_: ;
			{
				colontmpD__6 = NIM_FALSE;
				useEnvVars_1 = colontmpD__6;
			}
LA66_: ;
			{
				NimStringV2 fn_1;
				fn_1.len = 0; fn_1.p = NIM_NIL;
				{
					NIM_BOOL T75_;
					NimStringV2 colontmpD__7;
					NimStringV2 T80_;
					T75_ = (NIM_BOOL)0;
					T75_ = useEnvVars_1;
					if (!(T75_)) goto LA76_;
					T75_ = existsEnv__stdZenvvars_u20(TM__XqsrSBxhOTPgLQ9cX4MmV4A_28);
					if (NIM_UNLIKELY(*nimErr_)) goto LA72_;
LA76_: ;
					if (!T75_) goto LA77_;
					colontmpD__7.len = 0; colontmpD__7.p = NIM_NIL;
					T80_.len = 0; T80_.p = NIM_NIL;
					T80_ = getEnv__stdZenvvars_u15(TM__XqsrSBxhOTPgLQ9cX4MmV4A_29, TM__XqsrSBxhOTPgLQ9cX4MmV4A_30);
					if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T80_); goto LA79_;}
					eqsink___system_u2760((&fn_1), T80_);
					{
						NimStringV2 colontmpD__8;
						colontmpD__7 = nosextractFilename(fn_1);
						if (NIM_UNLIKELY(*nimErr_)) goto LA79_;
						if (!(colontmpD__7.len == 0)) goto LA83_;
						colontmpD__8.len = 0; colontmpD__8.p = NIM_NIL;
						{
							int T88_;
							colontmpD__8 = normalizePathEnd__stdZprivateZospaths2_u42(fn_1, NIM_FALSE);
							if (NIM_UNLIKELY(*nimErr_)) goto LA85_;
							T88_ = (int)0;
							T88_ = SSL_CTX_load_verify_locations(newCTX_1, ((NCSTRING) NIM_NIL), nimToCStringConv(colontmpD__8));
							if (!(T88_ == ((NI32)1))) goto LA89_;
							found_1 = NIM_TRUE;
							if (colontmpD__8.p && !(colontmpD__8.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__8.p);
}
							if (colontmpD__7.p && !(colontmpD__7.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__7.p);
}
							if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
							goto LA71;
						}
LA89_: ;
						{
							LA85_:;
						}
						{
							if (colontmpD__8.p && !(colontmpD__8.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__8.p);
}
						}
						if (NIM_UNLIKELY(*nimErr_)) goto LA79_;
					}
					goto LA81_;
LA83_: ;
					{
						int T94_;
						T94_ = (int)0;
						T94_ = SSL_CTX_load_verify_locations(newCTX_1, nimToCStringConv(fn_1), ((NCSTRING) NIM_NIL));
						if (!(T94_ == ((NI32)1))) goto LA95_;
						found_1 = NIM_TRUE;
						if (colontmpD__7.p && !(colontmpD__7.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__7.p);
}
						if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
						goto LA71;
					}
					goto LA81_;
LA95_: ;
LA81_: ;
					{
						LA79_:;
					}
					{
						if (colontmpD__7.p && !(colontmpD__7.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__7.p);
}
					}
					if (NIM_UNLIKELY(*nimErr_)) goto LA72_;
				}
				goto LA73_;
LA77_: ;
				{
					NIM_BOOL T100_;
					NimStringV2 p_1;
					T100_ = (NIM_BOOL)0;
					T100_ = useEnvVars_1;
					if (!(T100_)) goto LA101_;
					T100_ = existsEnv__stdZenvvars_u20(TM__XqsrSBxhOTPgLQ9cX4MmV4A_32);
					if (NIM_UNLIKELY(*nimErr_)) goto LA72_;
LA101_: ;
					if (!T100_) goto LA102_;
					p_1.len = 0; p_1.p = NIM_NIL;
					p_1 = getEnv__stdZenvvars_u15(TM__XqsrSBxhOTPgLQ9cX4MmV4A_33, TM__XqsrSBxhOTPgLQ9cX4MmV4A_34);
					if (NIM_UNLIKELY(*nimErr_)) goto LA104_;
					{
						NimStringV2 fn_2;
						NimStringV2 colontmp_;
						NimStringV2 T107_;
						glob_t fX60gensym5__1;
						NI resX60gensym5__1;
						int T108_;
						fn_2.len = 0; fn_2.p = NIM_NIL;
						colontmp_.len = 0; colontmp_.p = NIM_NIL;
						T107_.len = 0; T107_.p = NIM_NIL;
						T107_ = nosjoinPath(p_1, TM__XqsrSBxhOTPgLQ9cX4MmV4A_36);
						if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T107_); goto LA106_;}
						eqsink___system_u2760((&colontmp_), T107_);
						nimZeroMem((void*)(&fX60gensym5__1), sizeof(glob_t));
						resX60gensym5__1 = (NI)0;
						fX60gensym5__1.gl_offs = ((NI)0);
						fX60gensym5__1.gl_pathc = ((NI)0);
						fX60gensym5__1.gl_pathv = ((NCSTRING*) NIM_NIL);
						T108_ = (int)0;
						T108_ = glob(nimToCStringConv(colontmp_), ((int)0), NIM_NIL, (&fX60gensym5__1));
						resX60gensym5__1 = ((NI) (T108_));
						{
							if (!(resX60gensym5__1 == ((NI)0))) goto LA112_;
							{
								NI iX60gensym5__1;
								NI colontmp__2;
								NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_37;
								NI res_1;
								iX60gensym5__1 = (NI)0;
								colontmp__2 = (NI)0;
								if (nimSubInt(fX60gensym5__1.gl_pathc, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_37)) { raiseOverflow(); goto LA109_;
								};
								colontmp__2 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_37);
								res_1 = ((NI)0);
								{
									while (1) {
										NimStringV2 pathX60gensym5__1;
										NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_40;
										if (!(res_1 <= colontmp__2)) goto LA116;
										pathX60gensym5__1.len = 0; pathX60gensym5__1.p = NIM_NIL;
										iX60gensym5__1 = ((NI) (res_1));
										{
											NIM_BOOL T120_;
											T120_ = (NIM_BOOL)0;
											T120_ = eqeq___system_u9048(fX60gensym5__1.gl_pathv[iX60gensym5__1], ((NCSTRING) NIM_NIL));
											if (!!(!(T120_))) goto LA121_;
											failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_39);
											if (NIM_UNLIKELY(*nimErr_)) goto LA117_;
										}
LA121_: ;
										pathX60gensym5__1 = cstrToNimstr(fX60gensym5__1.gl_pathv[iX60gensym5__1]);
										{
											NIM_BOOL T125_;
											NimStringV2 colontmpD__9;
											T125_ = (NIM_BOOL)0;
											T125_ = nosfileExists(pathX60gensym5__1);
											if (NIM_UNLIKELY(*nimErr_)) goto LA117_;
											if (!T125_) goto LA126_;
											colontmpD__9.len = 0; colontmpD__9.p = NIM_NIL;
											eqsink___system_u2760((&fn_2), pathX60gensym5__1);
											eqwasMoved___system_u2751((&pathX60gensym5__1));
											eqsink___system_u2760((&fn_1), fn_2);
											eqwasMoved___system_u2751((&fn_2));
											{
												NimStringV2 colontmpD__10;
												colontmpD__9 = nosextractFilename(fn_1);
												if (NIM_UNLIKELY(*nimErr_)) goto LA128_;
												if (!(colontmpD__9.len == 0)) goto LA131_;
												colontmpD__10.len = 0; colontmpD__10.p = NIM_NIL;
												{
													int T136_;
													colontmpD__10 = normalizePathEnd__stdZprivateZospaths2_u42(fn_1, NIM_FALSE);
													if (NIM_UNLIKELY(*nimErr_)) goto LA133_;
													T136_ = (int)0;
													T136_ = SSL_CTX_load_verify_locations(newCTX_1, ((NCSTRING) NIM_NIL), nimToCStringConv(colontmpD__10));
													if (!(T136_ == ((NI32)1))) goto LA137_;
													found_1 = NIM_TRUE;
													if (colontmpD__10.p && !(colontmpD__10.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__10.p);
}
													if (colontmpD__9.p && !(colontmpD__9.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__9.p);
}
													if (pathX60gensym5__1.p && !(pathX60gensym5__1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__1.p);
}
													globfree((&fX60gensym5__1));
													if (colontmp_.p && !(colontmp_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp_.p);
}
													if (fn_2.p && !(fn_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_2.p);
}
													if (p_1.p && !(p_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_1.p);
}
													if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
													goto LA71;
												}
LA137_: ;
												{
													LA133_:;
												}
												{
													if (colontmpD__10.p && !(colontmpD__10.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__10.p);
}
												}
												if (NIM_UNLIKELY(*nimErr_)) goto LA128_;
											}
											goto LA129_;
LA131_: ;
											{
												int T142_;
												T142_ = (int)0;
												T142_ = SSL_CTX_load_verify_locations(newCTX_1, nimToCStringConv(fn_1), ((NCSTRING) NIM_NIL));
												if (!(T142_ == ((NI32)1))) goto LA143_;
												found_1 = NIM_TRUE;
												if (colontmpD__9.p && !(colontmpD__9.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__9.p);
}
												if (pathX60gensym5__1.p && !(pathX60gensym5__1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__1.p);
}
												globfree((&fX60gensym5__1));
												if (colontmp_.p && !(colontmp_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp_.p);
}
												if (fn_2.p && !(fn_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_2.p);
}
												if (p_1.p && !(p_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_1.p);
}
												if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
												goto LA71;
											}
											goto LA129_;
LA143_: ;
LA129_: ;
											{
												LA128_:;
											}
											{
												if (colontmpD__9.p && !(colontmpD__9.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__9.p);
}
											}
											if (NIM_UNLIKELY(*nimErr_)) goto LA117_;
										}
LA126_: ;
										if (nimAddInt(res_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_40)) { raiseOverflow(); goto LA117_;
										};
										res_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_40);
										{
											LA117_:;
										}
										{
											if (pathX60gensym5__1.p && !(pathX60gensym5__1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__1.p);
}
										}
										if (NIM_UNLIKELY(*nimErr_)) goto LA109_;
									} LA116: ;
								}
							}
						}
LA112_: ;
						{
							LA109_:;
						}
						{
							globfree((&fX60gensym5__1));
						}
						if (NIM_UNLIKELY(*nimErr_)) goto LA106_;
						{
							LA106_:;
						}
						{
							if (colontmp_.p && !(colontmp_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp_.p);
}
							if (fn_2.p && !(fn_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_2.p);
}
						}
						if (NIM_UNLIKELY(*nimErr_)) goto LA104_;
					}
					{
						LA104_:;
					}
					{
						if (p_1.p && !(p_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_1.p);
}
					}
					if (NIM_UNLIKELY(*nimErr_)) goto LA72_;
				}
				goto LA73_;
LA102_: ;
				{
					{
						NimStringV2 p_2;
						NI i_1;
						p_2.len = 0; p_2.p = NIM_NIL;
						i_1 = ((NI)0);
						{
							while (1) {
								eqcopy___system_u2754((&p_2), certificatePaths__pureZssl95certs_u3[(i_1)- 0]);
								{
									NIM_BOOL T162_;
									T162_ = (NIM_BOOL)0;
									T162_ = nsuEndsWith(p_2, TM__XqsrSBxhOTPgLQ9cX4MmV4A_42);
									if (NIM_UNLIKELY(*nimErr_)) goto LA157_;
									if (T162_) goto LA163_;
									T162_ = nsuEndsWith(p_2, TM__XqsrSBxhOTPgLQ9cX4MmV4A_44);
									if (NIM_UNLIKELY(*nimErr_)) goto LA157_;
LA163_: ;
									if (!T162_) goto LA164_;
									{
										NIM_BOOL T168_;
										NimStringV2 colontmpD__11;
										T168_ = (NIM_BOOL)0;
										T168_ = nosfileExists(p_2);
										if (NIM_UNLIKELY(*nimErr_)) goto LA157_;
										if (!T168_) goto LA169_;
										colontmpD__11.len = 0; colontmpD__11.p = NIM_NIL;
										eqsink___system_u2760((&fn_1), p_2);
										eqwasMoved___system_u2751((&p_2));
										{
											NimStringV2 colontmpD__12;
											colontmpD__11 = nosextractFilename(fn_1);
											if (NIM_UNLIKELY(*nimErr_)) goto LA171_;
											if (!(colontmpD__11.len == 0)) goto LA174_;
											colontmpD__12.len = 0; colontmpD__12.p = NIM_NIL;
											{
												int T179_;
												colontmpD__12 = normalizePathEnd__stdZprivateZospaths2_u42(fn_1, NIM_FALSE);
												if (NIM_UNLIKELY(*nimErr_)) goto LA176_;
												T179_ = (int)0;
												T179_ = SSL_CTX_load_verify_locations(newCTX_1, ((NCSTRING) NIM_NIL), nimToCStringConv(colontmpD__12));
												if (!(T179_ == ((NI32)1))) goto LA180_;
												found_1 = NIM_TRUE;
												if (colontmpD__12.p && !(colontmpD__12.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__12.p);
}
												if (colontmpD__11.p && !(colontmpD__11.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__11.p);
}
												if (p_2.p && !(p_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_2.p);
}
												if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
												goto LA71;
											}
LA180_: ;
											{
												LA176_:;
											}
											{
												if (colontmpD__12.p && !(colontmpD__12.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__12.p);
}
											}
											if (NIM_UNLIKELY(*nimErr_)) goto LA171_;
										}
										goto LA172_;
LA174_: ;
										{
											int T185_;
											T185_ = (int)0;
											T185_ = SSL_CTX_load_verify_locations(newCTX_1, nimToCStringConv(fn_1), ((NCSTRING) NIM_NIL));
											if (!(T185_ == ((NI32)1))) goto LA186_;
											found_1 = NIM_TRUE;
											if (colontmpD__11.p && !(colontmpD__11.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__11.p);
}
											if (p_2.p && !(p_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_2.p);
}
											if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
											goto LA71;
										}
										goto LA172_;
LA186_: ;
LA172_: ;
										{
											LA171_:;
										}
										{
											if (colontmpD__11.p && !(colontmpD__11.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__11.p);
}
										}
										if (NIM_UNLIKELY(*nimErr_)) goto LA157_;
									}
LA169_: ;
								}
								goto LA160_;
LA164_: ;
								{
									NIM_BOOL T191_;
									T191_ = (NIM_BOOL)0;
									T191_ = nosdirExists(p_2);
									if (NIM_UNLIKELY(*nimErr_)) goto LA157_;
									if (!T191_) goto LA192_;
									{
										NimStringV2 fn_3;
										NimStringV2 colontmp__3;
										NimStringV2 T196_;
										glob_t fX60gensym5__2;
										NI resX60gensym5__2;
										int T197_;
										fn_3.len = 0; fn_3.p = NIM_NIL;
										colontmp__3.len = 0; colontmp__3.p = NIM_NIL;
										fn_3.len = 0; fn_3.p = NIM_NIL;
										colontmp__3.len = 0; colontmp__3.p = NIM_NIL;
										T196_.len = 0; T196_.p = NIM_NIL;
										T196_ = nosjoinPath(p_2, TM__XqsrSBxhOTPgLQ9cX4MmV4A_46);
										if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T196_); goto LA195_;}
										eqsink___system_u2760((&colontmp__3), T196_);
										nimZeroMem((void*)(&fX60gensym5__2), sizeof(glob_t));
										resX60gensym5__2 = (NI)0;
										fX60gensym5__2.gl_offs = ((NI)0);
										fX60gensym5__2.gl_pathc = ((NI)0);
										fX60gensym5__2.gl_pathv = ((NCSTRING*) NIM_NIL);
										T197_ = (int)0;
										T197_ = glob(nimToCStringConv(colontmp__3), ((int)0), NIM_NIL, (&fX60gensym5__2));
										resX60gensym5__2 = ((NI) (T197_));
										{
											if (!(resX60gensym5__2 == ((NI)0))) goto LA201_;
											{
												NI iX60gensym5__2;
												NI colontmp__4;
												NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_47;
												NI res_2;
												iX60gensym5__2 = (NI)0;
												colontmp__4 = (NI)0;
												if (nimSubInt(fX60gensym5__2.gl_pathc, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_47)) { raiseOverflow(); goto LA198_;
												};
												colontmp__4 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_47);
												res_2 = ((NI)0);
												{
													while (1) {
														NimStringV2 pathX60gensym5__2;
														NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_49;
														if (!(res_2 <= colontmp__4)) goto LA205;
														pathX60gensym5__2.len = 0; pathX60gensym5__2.p = NIM_NIL;
														iX60gensym5__2 = ((NI) (res_2));
														{
															NIM_BOOL T209_;
															T209_ = (NIM_BOOL)0;
															T209_ = eqeq___system_u9048(fX60gensym5__2.gl_pathv[iX60gensym5__2], ((NCSTRING) NIM_NIL));
															if (!!(!(T209_))) goto LA210_;
															failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_48);
															if (NIM_UNLIKELY(*nimErr_)) goto LA206_;
														}
LA210_: ;
														pathX60gensym5__2 = cstrToNimstr(fX60gensym5__2.gl_pathv[iX60gensym5__2]);
														{
															NIM_BOOL T214_;
															NimStringV2 colontmpD__13;
															NimStringV2 T218_;
															T214_ = (NIM_BOOL)0;
															T214_ = nosfileExists(pathX60gensym5__2);
															if (NIM_UNLIKELY(*nimErr_)) goto LA206_;
															if (!T214_) goto LA215_;
															colontmpD__13.len = 0; colontmpD__13.p = NIM_NIL;
															eqsink___system_u2760((&fn_3), pathX60gensym5__2);
															eqwasMoved___system_u2751((&pathX60gensym5__2));
															T218_.len = 0; T218_.p = NIM_NIL;
															T218_ = normalizePathEnd__stdZprivateZospaths2_u42(p_2, NIM_TRUE);
															if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T218_); goto LA217_;}
															eqsink___system_u2760((&fn_1), T218_);
															{
																NimStringV2 colontmpD__14;
																colontmpD__13 = nosextractFilename(fn_1);
																if (NIM_UNLIKELY(*nimErr_)) goto LA217_;
																if (!(colontmpD__13.len == 0)) goto LA221_;
																colontmpD__14.len = 0; colontmpD__14.p = NIM_NIL;
																{
																	int T226_;
																	colontmpD__14 = normalizePathEnd__stdZprivateZospaths2_u42(fn_1, NIM_FALSE);
																	if (NIM_UNLIKELY(*nimErr_)) goto LA223_;
																	T226_ = (int)0;
																	T226_ = SSL_CTX_load_verify_locations(newCTX_1, ((NCSTRING) NIM_NIL), nimToCStringConv(colontmpD__14));
																	if (!(T226_ == ((NI32)1))) goto LA227_;
																	found_1 = NIM_TRUE;
																	if (colontmpD__14.p && !(colontmpD__14.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__14.p);
}
																	if (colontmpD__13.p && !(colontmpD__13.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__13.p);
}
																	if (pathX60gensym5__2.p && !(pathX60gensym5__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__2.p);
}
																	globfree((&fX60gensym5__2));
																	if (colontmp__3.p && !(colontmp__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp__3.p);
}
																	if (fn_3.p && !(fn_3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_3.p);
}
																	if (p_2.p && !(p_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_2.p);
}
																	if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
																	goto LA71;
																}
LA227_: ;
																{
																	LA223_:;
																}
																{
																	if (colontmpD__14.p && !(colontmpD__14.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__14.p);
}
																}
																if (NIM_UNLIKELY(*nimErr_)) goto LA217_;
															}
															goto LA219_;
LA221_: ;
															{
																int T232_;
																T232_ = (int)0;
																T232_ = SSL_CTX_load_verify_locations(newCTX_1, nimToCStringConv(fn_1), ((NCSTRING) NIM_NIL));
																if (!(T232_ == ((NI32)1))) goto LA233_;
																found_1 = NIM_TRUE;
																if (colontmpD__13.p && !(colontmpD__13.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__13.p);
}
																if (pathX60gensym5__2.p && !(pathX60gensym5__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__2.p);
}
																globfree((&fX60gensym5__2));
																if (colontmp__3.p && !(colontmp__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp__3.p);
}
																if (fn_3.p && !(fn_3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_3.p);
}
																if (p_2.p && !(p_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_2.p);
}
																if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
																goto LA71;
															}
															goto LA219_;
LA233_: ;
LA219_: ;
															if (colontmpD__13.p && !(colontmpD__13.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__13.p);
}
															if (pathX60gensym5__2.p && !(pathX60gensym5__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__2.p);
}
															globfree((&fX60gensym5__2));
															if (colontmp__3.p && !(colontmp__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp__3.p);
}
															if (fn_3.p && !(fn_3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_3.p);
}
															goto LA194;
															{
																LA217_:;
															}
															{
																if (colontmpD__13.p && !(colontmpD__13.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__13.p);
}
															}
															if (NIM_UNLIKELY(*nimErr_)) goto LA206_;
														}
LA215_: ;
														if (nimAddInt(res_2, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_49)) { raiseOverflow(); goto LA206_;
														};
														res_2 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_49);
														{
															LA206_:;
														}
														{
															if (pathX60gensym5__2.p && !(pathX60gensym5__2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__2.p);
}
														}
														if (NIM_UNLIKELY(*nimErr_)) goto LA198_;
													} LA205: ;
												}
											}
										}
LA201_: ;
										{
											LA198_:;
										}
										{
											globfree((&fX60gensym5__2));
										}
										if (NIM_UNLIKELY(*nimErr_)) goto LA195_;
										{
											LA195_:;
										}
										{
											if (colontmp__3.p && !(colontmp__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp__3.p);
}
											if (fn_3.p && !(fn_3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_3.p);
}
										}
										if (NIM_UNLIKELY(*nimErr_)) goto LA157_;
									} LA194: ;
									{
										NimStringV2 fn_4;
										NimStringV2 colontmp__5;
										NimStringV2 T245_;
										glob_t fX60gensym5__3;
										NI resX60gensym5__3;
										int T246_;
										fn_4.len = 0; fn_4.p = NIM_NIL;
										colontmp__5.len = 0; colontmp__5.p = NIM_NIL;
										fn_4.len = 0; fn_4.p = NIM_NIL;
										colontmp__5.len = 0; colontmp__5.p = NIM_NIL;
										T245_.len = 0; T245_.p = NIM_NIL;
										T245_ = nosjoinPath(p_2, TM__XqsrSBxhOTPgLQ9cX4MmV4A_50);
										if (NIM_UNLIKELY(*nimErr_)) {eqdestroy___system_u281(T245_); goto LA244_;}
										eqsink___system_u2760((&colontmp__5), T245_);
										nimZeroMem((void*)(&fX60gensym5__3), sizeof(glob_t));
										resX60gensym5__3 = (NI)0;
										fX60gensym5__3.gl_offs = ((NI)0);
										fX60gensym5__3.gl_pathc = ((NI)0);
										fX60gensym5__3.gl_pathv = ((NCSTRING*) NIM_NIL);
										T246_ = (int)0;
										T246_ = glob(nimToCStringConv(colontmp__5), ((int)0), NIM_NIL, (&fX60gensym5__3));
										resX60gensym5__3 = ((NI) (T246_));
										{
											if (!(resX60gensym5__3 == ((NI)0))) goto LA250_;
											{
												NI iX60gensym5__3;
												NI colontmp__6;
												NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_51;
												NI res_3;
												iX60gensym5__3 = (NI)0;
												colontmp__6 = (NI)0;
												if (nimSubInt(fX60gensym5__3.gl_pathc, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_51)) { raiseOverflow(); goto LA247_;
												};
												colontmp__6 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_51);
												res_3 = ((NI)0);
												{
													while (1) {
														NimStringV2 pathX60gensym5__3;
														NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_53;
														if (!(res_3 <= colontmp__6)) goto LA254;
														pathX60gensym5__3.len = 0; pathX60gensym5__3.p = NIM_NIL;
														iX60gensym5__3 = ((NI) (res_3));
														{
															NIM_BOOL T258_;
															T258_ = (NIM_BOOL)0;
															T258_ = eqeq___system_u9048(fX60gensym5__3.gl_pathv[iX60gensym5__3], ((NCSTRING) NIM_NIL));
															if (!!(!(T258_))) goto LA259_;
															failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_52);
															if (NIM_UNLIKELY(*nimErr_)) goto LA255_;
														}
LA259_: ;
														pathX60gensym5__3 = cstrToNimstr(fX60gensym5__3.gl_pathv[iX60gensym5__3]);
														{
															NIM_BOOL T263_;
															NimStringV2 colontmpD__15;
															T263_ = (NIM_BOOL)0;
															T263_ = nosfileExists(pathX60gensym5__3);
															if (NIM_UNLIKELY(*nimErr_)) goto LA255_;
															if (!T263_) goto LA264_;
															colontmpD__15.len = 0; colontmpD__15.p = NIM_NIL;
															eqsink___system_u2760((&fn_4), pathX60gensym5__3);
															eqwasMoved___system_u2751((&pathX60gensym5__3));
															eqsink___system_u2760((&fn_1), fn_4);
															eqwasMoved___system_u2751((&fn_4));
															{
																NimStringV2 colontmpD__16;
																colontmpD__15 = nosextractFilename(fn_1);
																if (NIM_UNLIKELY(*nimErr_)) goto LA266_;
																if (!(colontmpD__15.len == 0)) goto LA269_;
																colontmpD__16.len = 0; colontmpD__16.p = NIM_NIL;
																{
																	int T274_;
																	colontmpD__16 = normalizePathEnd__stdZprivateZospaths2_u42(fn_1, NIM_FALSE);
																	if (NIM_UNLIKELY(*nimErr_)) goto LA271_;
																	T274_ = (int)0;
																	T274_ = SSL_CTX_load_verify_locations(newCTX_1, ((NCSTRING) NIM_NIL), nimToCStringConv(colontmpD__16));
																	if (!(T274_ == ((NI32)1))) goto LA275_;
																	found_1 = NIM_TRUE;
																	if (colontmpD__16.p && !(colontmpD__16.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__16.p);
}
																	if (colontmpD__15.p && !(colontmpD__15.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__15.p);
}
																	if (pathX60gensym5__3.p && !(pathX60gensym5__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__3.p);
}
																	globfree((&fX60gensym5__3));
																	if (colontmp__5.p && !(colontmp__5.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp__5.p);
}
																	if (fn_4.p && !(fn_4.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_4.p);
}
																	if (p_2.p && !(p_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_2.p);
}
																	if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
																	goto LA71;
																}
LA275_: ;
																{
																	LA271_:;
																}
																{
																	if (colontmpD__16.p && !(colontmpD__16.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__16.p);
}
																}
																if (NIM_UNLIKELY(*nimErr_)) goto LA266_;
															}
															goto LA267_;
LA269_: ;
															{
																int T280_;
																T280_ = (int)0;
																T280_ = SSL_CTX_load_verify_locations(newCTX_1, nimToCStringConv(fn_1), ((NCSTRING) NIM_NIL));
																if (!(T280_ == ((NI32)1))) goto LA281_;
																found_1 = NIM_TRUE;
																if (colontmpD__15.p && !(colontmpD__15.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__15.p);
}
																if (pathX60gensym5__3.p && !(pathX60gensym5__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__3.p);
}
																globfree((&fX60gensym5__3));
																if (colontmp__5.p && !(colontmp__5.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp__5.p);
}
																if (fn_4.p && !(fn_4.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_4.p);
}
																if (p_2.p && !(p_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_2.p);
}
																if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
																goto LA71;
															}
															goto LA267_;
LA281_: ;
LA267_: ;
															{
																LA266_:;
															}
															{
																if (colontmpD__15.p && !(colontmpD__15.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD__15.p);
}
															}
															if (NIM_UNLIKELY(*nimErr_)) goto LA255_;
														}
LA264_: ;
														if (nimAddInt(res_3, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_53)) { raiseOverflow(); goto LA255_;
														};
														res_3 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_53);
														{
															LA255_:;
														}
														{
															if (pathX60gensym5__3.p && !(pathX60gensym5__3.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(pathX60gensym5__3.p);
}
														}
														if (NIM_UNLIKELY(*nimErr_)) goto LA247_;
													} LA254: ;
												}
											}
										}
LA250_: ;
										{
											LA247_:;
										}
										{
											globfree((&fX60gensym5__3));
										}
										if (NIM_UNLIKELY(*nimErr_)) goto LA244_;
										{
											LA244_:;
										}
										{
											if (colontmp__5.p && !(colontmp__5.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp__5.p);
}
											if (fn_4.p && !(fn_4.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_4.p);
}
										}
										if (NIM_UNLIKELY(*nimErr_)) goto LA157_;
									}
								}
								goto LA160_;
LA192_: ;
LA160_: ;
								{
									if (!(((NI)1) <= i_1)) goto LA293_;
									goto LA158;
								}
LA293_: ;
								i_1 += ((NI)1);
							}
						} LA158: ;
						{
							LA157_:;
						}
						{
							if (p_2.p && !(p_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(p_2.p);
}
						}
						if (NIM_UNLIKELY(*nimErr_)) goto LA72_;
					}
				}
LA73_: ;
				{
					LA72_:;
				}
				{
					if (fn_1.p && !(fn_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(fn_1.p);
}
				}
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			} LA71: ;
			{
				tyObject_IOError__FsM2LSiW5usgjecIvsloBA* T303_;
				if (!!(found_1)) goto LA301_;
				T303_ = NIM_NIL;
				T303_ = (tyObject_IOError__FsM2LSiW5usgjecIvsloBA*) nimNewObj(sizeof(tyObject_IOError__FsM2LSiW5usgjecIvsloBA), NIM_ALIGNOF(tyObject_IOError__FsM2LSiW5usgjecIvsloBA));
				(*T303_).Sup.Sup.Sup.m_type = (&NTIv2__FsM2LSiW5usgjecIvsloBA_);
				(*T303_).Sup.Sup.name = "IOError";
				(*T303_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_55;
				(*T303_).Sup.Sup.parent = ((Exception*) NIM_NIL);
				raiseExceptionEx((Exception*)T303_, "IOError", "newContext", "net.nim", 731);
goto BeforeRet_;
			}
LA301_: ;
		}
LA41_: ;
	}
LA39_: ;
	T304_ = NIM_NIL;
	T304_ = (tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A*) nimNewObjUninit(sizeof(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A), NIM_ALIGNOF(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A));
	(*T304_).context = newCTX_1;
	(*T304_).referencedData = initHashSet__pureZnet_u1488(((NI)64));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(*T304_).extraInternal = new__pureZnet_u1543();
	result = T304_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u1579)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicStatic(dest_p0, ((TNimTypeV2*) ((&NTIv2__AhFePg9cWdCpCeTypFfYs7A_))));
		if (!T3_) goto LA4_;
		eqdestroy___pureZnet_u313((&(*dest_p0)));
		nimRawDispose(dest_p0, ((NI)8));
	}
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDisconnectionError__pureZnet_u181)(tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p0, NI32 lastError_p1) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	NIM_BOOL T3_;
	NIM_BOOL T4_;
	T1_ = (NIM_BOOL)0;
	T1_ = ((flags_p0 &((NU8)1<<((NU)((((tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w)1)))&7U)))!=0);
	if (!(T1_)) goto LA2_;
	T3_ = (NIM_BOOL)0;
	T4_ = (NIM_BOOL)0;
	T4_ = (lastError_p1 == ECONNRESET);
	if (T4_) goto LA5_;
	T4_ = (lastError_p1 == EPIPE);
LA5_: ;
	T3_ = T4_;
	if (T3_) goto LA6_;
	T3_ = (lastError_p1 == ENETRESET);
LA6_: ;
	T1_ = T3_;
LA2_: ;
	result = T1_;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI32, getSocketError__pureZnet_u1878)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0) {
	NI32 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI32)0;
	result = osLastError__stdZoserrors_u122();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!(result == ((NI32)0))) goto LA3_;
		result = (*socket_p0).lastError;
	}
LA3_: ;
	{
		if (!(result == ((NI32)0))) goto LA7_;
		raiseOSError__stdZoserrors_u119(result, TM__XqsrSBxhOTPgLQ9cX4MmV4A_82);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA7_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, socketError__pureZnet_u175)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NI err_p1, NIM_BOOL async_p2, NI32 lastError_p3, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p4) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		if (!(*socket_p0).isSsl) goto LA3_;
		{
			int ret_1;
			if (!(err_p1 <= ((NI)0))) goto LA7_;
			if ((err_p1) < ((int)(-2147483647 -1)) || (err_p1) > ((int)2147483647)){ raiseRangeErrorI(err_p1, ((int)(-2147483647 -1)), ((int)2147483647)); goto BeforeRet_;
			}
			ret_1 = SSL_get_error((*socket_p0).sslHandle, ((int) (err_p1)));
			switch (ret_1) {
			case ((int)6):
			{
				raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_64);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			case ((int)7):
			case ((int)8):
			{
				{
					if (!async_p2) goto LA13_;
					goto BeforeRet_;
				}
				goto LA11_;
LA13_: ;
				{
					raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_66);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA11_: ;
			}
			break;
			case ((int)3):
			case ((int)2):
			{
				{
					if (!async_p2) goto LA19_;
					goto BeforeRet_;
				}
				goto LA17_;
LA19_: ;
				{
					raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_67);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA17_: ;
			}
			break;
			case ((int)4):
			{
				raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_69);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			case ((int)5):
			{
				NI32 osErr_1;
				(*socket_p0).sslNoShutdown = NIM_TRUE;
				osErr_1 = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T26_;
					NimStringV2 errStr_1;
					unsigned long sslErr_1;
					T26_ = (NIM_BOOL)0;
					T26_ = isDisconnectionError__pureZnet_u181(flags_p4, osErr_1);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (!!(T26_)) goto LA27_;
					errStr_1.len = 0; errStr_1.p = NIM_NIL;
					errStr_1 = TM__XqsrSBxhOTPgLQ9cX4MmV4A_71;
					sslErr_1 = ERR_peek_last_error();
					{
						NIM_BOOL T32_;
						T32_ = (NIM_BOOL)0;
						T32_ = (sslErr_1 == ((NU)0));
						if (!(T32_)) goto LA33_;
						T32_ = (err_p1 == ((NI)0));
LA33_: ;
						if (!T32_) goto LA34_;
						prepareAdd((&errStr_1), 54);
appendString((&errStr_1), TM__XqsrSBxhOTPgLQ9cX4MmV4A_73);
					}
					goto LA30_;
LA34_: ;
					{
						NIM_BOOL T37_;
						T37_ = (NIM_BOOL)0;
						T37_ = (sslErr_1 == ((NU)0));
						if (!(T37_)) goto LA38_;
						T37_ = (err_p1 == ((NI)-1));
LA38_: ;
						if (!T37_) goto LA39_;
						prepareAdd((&errStr_1), 16);
appendString((&errStr_1), TM__XqsrSBxhOTPgLQ9cX4MmV4A_75);
					}
					goto LA30_;
LA39_: ;
					{
						NimStringV2 errStr_2;
						NimStringV2 colontmpD_;
						NCSTRING T43_;
						NimStringV2 T44_;
						errStr_2.len = 0; errStr_2.p = NIM_NIL;
						colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
						T43_ = (NCSTRING)0;
						T43_ = ERR_error_string(sslErr_1, ((NCSTRING) NIM_NIL));
						errStr_2 = cstrToNimstr(T43_);
						T44_.len = 0; T44_.p = NIM_NIL;
						T44_ = rawNewString(errStr_2.len + errStr_2.len + 2);
appendString((&T44_), errStr_2);
appendString((&T44_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_77);
appendString((&T44_), errStr_2);
						colontmpD_ = T44_;
						raiseSSLError__pureZnet_u857(colontmpD_);
						if (NIM_UNLIKELY(*nimErr_)) goto LA42_;
						{
							LA42_:;
						}
						{
							if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
							if (errStr_2.p && !(errStr_2.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(errStr_2.p);
}
						}
						if (NIM_UNLIKELY(*nimErr_)) goto LA29_;
					}
LA30_: ;
					raiseOSError__stdZoserrors_u119(osErr_1, errStr_1);
					if (NIM_UNLIKELY(*nimErr_)) goto LA29_;
					{
						LA29_:;
					}
					{
						if (errStr_1.p && !(errStr_1.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(errStr_1.p);
}
					}
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA27_: ;
			}
			break;
			case ((int)1):
			{
				(*socket_p0).sslNoShutdown = NIM_TRUE;
				raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_78);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			default:
			{
				raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_80);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			}
		}
LA7_: ;
	}
LA3_: ;
	{
		NIM_BOOL T53_;
		NI32 colontmpD__2;
		NI32 colontmpD__3;
		NI32 lastE_1;
		T53_ = (NIM_BOOL)0;
		T53_ = (err_p1 == ((NI)-1));
		if (!(T53_)) goto LA54_;
		T53_ = !((*socket_p0).isSsl);
LA54_: ;
		if (!T53_) goto LA55_;
		colontmpD__2 = (NI32)0;
		colontmpD__3 = (NI32)0;
		{
			if (!(((NI) (lastError_p3)) == ((NI)-1))) goto LA59_;
			colontmpD__2 = getSocketError__pureZnet_u1878(socket_p0);
			if (NIM_UNLIKELY(*nimErr_)) goto LA61_;
			lastE_1 = colontmpD__2;
			{
				LA61_:;
			}
			{
			}
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		goto LA57_;
LA59_: ;
		{
			colontmpD__3 = lastError_p3;
			lastE_1 = colontmpD__3;
		}
LA57_: ;
		{
			NIM_BOOL T67_;
			T67_ = (NIM_BOOL)0;
			T67_ = isDisconnectionError__pureZnet_u181(flags_p4, lastE_1);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!!(T67_)) goto LA68_;
			{
				if (!async_p2) goto LA72_;
				{
					NIM_BOOL T76_;
					T76_ = (NIM_BOOL)0;
					T76_ = (lastE_1 == EAGAIN);
					if (T76_) goto LA77_;
					T76_ = (lastE_1 == EWOULDBLOCK);
LA77_: ;
					if (!T76_) goto LA78_;
					goto BeforeRet_;
				}
				goto LA74_;
LA78_: ;
				{
					raiseOSError__stdZoserrors_u119(lastE_1, TM__XqsrSBxhOTPgLQ9cX4MmV4A_83);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA74_: ;
			}
			goto LA70_;
LA72_: ;
			{
				raiseOSError__stdZoserrors_u119(lastE_1, TM__XqsrSBxhOTPgLQ9cX4MmV4A_84);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
LA70_: ;
		}
LA68_: ;
	}
LA55_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, close__pureZnet_u1942)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p1) {
NIM_BOOL oldNimErrFin40_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		NIM_BOOL T4_;
		T4_ = (NIM_BOOL)0;
		T4_ = (*socket_p0).isSsl;
		if (!(T4_)) goto LA5_;
		T4_ = !(((*socket_p0).sslHandle == ((tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*) NIM_NIL)));
LA5_: ;
		if (!T4_) goto LA6_;
		{
			NIM_BOOL T10_;
			int T12_;
			sigset_t oldSetX60gensym117__1;
			sigset_t watchSetX60gensym117__1;
			NIM_BOOL alreadyBlockedX60gensym117__1;
			int T39_;
			int res_1;
			T10_ = (NIM_BOOL)0;
			T10_ = !((*socket_p0).sslNoShutdown);
			if (!(T10_)) goto LA11_;
			T12_ = (int)0;
			T12_ = SSL_in_init((*socket_p0).sslHandle);
			T10_ = (T12_ == ((NI32)0));
LA11_: ;
			if (!T10_) goto LA13_;
			nimZeroMem((void*)(&oldSetX60gensym117__1), sizeof(sigset_t));
			nimZeroMem((void*)(&watchSetX60gensym117__1), sizeof(sigset_t));
			{
				int T17_;
				NI32 T20_;
				T17_ = (int)0;
				T17_ = sigemptyset((&oldSetX60gensym117__1));
				if (!(T17_ == ((NI32)-1))) goto LA18_;
				T20_ = (NI32)0;
				T20_ = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__stdZoserrors_u119(T20_, TM__XqsrSBxhOTPgLQ9cX4MmV4A_57);
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
LA18_: ;
			{
				int T23_;
				NI32 T26_;
				T23_ = (int)0;
				T23_ = sigemptyset((&watchSetX60gensym117__1));
				if (!(T23_ == ((NI32)-1))) goto LA24_;
				T26_ = (NI32)0;
				T26_ = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__stdZoserrors_u119(T26_, TM__XqsrSBxhOTPgLQ9cX4MmV4A_58);
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
LA24_: ;
			{
				int T29_;
				NI32 T32_;
				T29_ = (int)0;
				T29_ = sigaddset((&watchSetX60gensym117__1), SIGPIPE);
				if (!(T29_ == ((NI32)-1))) goto LA30_;
				T32_ = (NI32)0;
				T32_ = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__stdZoserrors_u119(T32_, TM__XqsrSBxhOTPgLQ9cX4MmV4A_60);
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
LA30_: ;
			{
				int T35_;
				NI32 T38_;
				T35_ = (int)0;
				T35_ = pthread_sigmask(SIG_BLOCK, (&watchSetX60gensym117__1), (&oldSetX60gensym117__1));
				if (!(T35_ == ((NI32)-1))) goto LA36_;
				T38_ = (NI32)0;
				T38_ = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__stdZoserrors_u119(T38_, TM__XqsrSBxhOTPgLQ9cX4MmV4A_62);
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
LA36_: ;
			T39_ = (int)0;
			T39_ = sigismember((&oldSetX60gensym117__1), SIGPIPE);
			alreadyBlockedX60gensym117__1 = (T39_ == ((NI32)1));
			ERR_clear_error();
			res_1 = SSL_shutdown((*socket_p0).sslHandle);
			{
				if (!(res_1 == ((NI32)0))) goto LA43_;
			}
			goto LA41_;
LA43_: ;
			{
				NI32 err_1;
				int sslError_1;
				if (!!((res_1 == ((NI32)1)))) goto LA46_;
				err_1 = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
				sslError_1 = SSL_get_error((*socket_p0).sslHandle, res_1);
				{
					NIM_BOOL T50_;
					T50_ = (NIM_BOOL)0;
					T50_ = (sslError_1 == ((NI32)6));
					if (T50_) goto LA51_;
					T50_ = (sslError_1 == ((NI32)5));
LA51_: ;
					if (!T50_) goto LA52_;
					{
						NIM_BOOL T56_;
						T56_ = (NIM_BOOL)0;
						T56_ = isDisconnectionError__pureZnet_u181(flags_p1, err_1);
						if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
						if (!!(T56_)) goto LA57_;
						socketError__pureZnet_u175(socket_p0, ((NI) (res_1)), NIM_FALSE, err_1, flags_p1);
						if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
					}
LA57_: ;
				}
				goto LA48_;
LA52_: ;
				{
					socketError__pureZnet_u175(socket_p0, ((NI) (res_1)), NIM_FALSE, err_1, flags_p1);
					if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
				}
LA48_: ;
			}
			goto LA41_;
LA46_: ;
LA41_: ;
			{
				LA40_:;
			}
			{
				oldNimErrFin40_ = *nimErr_; *nimErr_ = NIM_FALSE;
				{
					if (!!(alreadyBlockedX60gensym117__1)) goto LA64_;
					{
						int T68_;
						NI32 T71_;
						T68_ = (int)0;
						T68_ = pthread_sigmask(SIG_UNBLOCK, (&watchSetX60gensym117__1), (&oldSetX60gensym117__1));
						if (!(T68_ == ((NI32)-1))) goto LA69_;
						T71_ = (NI32)0;
						T71_ = osLastError__stdZoserrors_u122();
						if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
						raiseOSError__stdZoserrors_u119(T71_, TM__XqsrSBxhOTPgLQ9cX4MmV4A_86);
						if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
					}
LA69_: ;
				}
LA64_: ;
				*nimErr_ = oldNimErrFin40_;
			}
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
		}
LA13_: ;
	}
LA6_: ;
	{
		LA1_:;
	}
	{
		oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
		{
			NIM_BOOL T76_;
			T76_ = (NIM_BOOL)0;
			T76_ = (*socket_p0).isSsl;
			if (!(T76_)) goto LA77_;
			T76_ = !(((*socket_p0).sslHandle == ((tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*) NIM_NIL)));
LA77_: ;
			if (!T76_) goto LA78_;
			SSL_free((*socket_p0).sslHandle);
			(*socket_p0).sslHandle = ((tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*) NIM_NIL);
		}
LA78_: ;
		close__pureZnativesockets_u201((*socket_p0).fd);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		(*socket_p0).fd = osInvalidSocket__pureZnativesockets_u48;
		*nimErr_ = oldNimErrFin1_;
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqsink___pureZnet_u525)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag** dest_p0, tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* src_p1) {
	tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* colontmp_;
	colontmp_ = (*dest_p0);
	(*dest_p0) = src_p1;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicStatic(colontmp_, ((TNimTypeV2*) ((&NTIv2__TmGWJPpyEwcsRMnCyN509ag_))));
		if (!T3_) goto LA4_;
		eqdestroy___pureZnet_u288((&(*colontmp_)));
		nimRawDispose(colontmp_, ((NI)8));
	}
LA4_: ;
}
static N_INLINE(NIM_BOOL, isNone__pureZnativesockets_u385)(tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg self_p0) {
	NIM_BOOL result;
	result = !(self_p0.has);
	return result;
}
static N_INLINE(NIM_BOOL, isSome__pureZnativesockets_u364)(tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg self_p0) {
	NIM_BOOL result;
	result = self_p0.has;
	return result;
}
static N_INLINE(tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA*, unsafeGet__pureZnet_u2635)(tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg* self_p0) {
	tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA*)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = isSome__pureZnativesockets_u364((*self_p0));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!(T3_)) goto LA4_;
		failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_89);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA4_: ;
	result = (&(*self_p0).val);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag*, newSocket__pureZnet_u254)(int fd_p0, tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA domain_p1, tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q sockType_p2, tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA protocol_p3, NIM_BOOL buffered_p4) {
	tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* result;
	tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* T5_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = NIM_NIL;
	{
		if (!!(!((fd_p0 == osInvalidSocket__pureZnativesockets_u48)))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_92);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	T5_ = NIM_NIL;
	T5_ = (tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag*) nimNewObj(sizeof(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag), NIM_ALIGNOF(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag));
	(*T5_).fd = fd_p0;
	(*T5_).isBuffered = buffered_p4;
	(*T5_).domain = domain_p1;
	(*T5_).sockType = sockType_p2;
	(*T5_).protocol = protocol_p3;
	result = T5_;
	{
		if (!buffered_p4) goto LA8_;
		(*result).currPos = ((NI)0);
	}
LA8_: ;
	setSockOptInt__pureZnativesockets_u991(fd_p0, ((NI) (SOL_SOCKET)), ((NI) (SO_NOSIGPIPE)), ((NI)1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag*, dial__pureZnet_u2532)(NimStringV2 address_p0, NU16 port_p1, tyEnum_Protocol__x11L2EqCXuQVMDp2SGyCyA protocol_p2, NIM_BOOL buffered_p3) {
	tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* result;
	tyEnum_SockType__wyAiWULDFVysRokh4hHr7Q sockType_1;
	struct addrinfo* aiList_1;
	tyArray__4fBsehQGr9cX77f4jRh2sgw fdPerDomain_1;
	NIM_BOOL success_1;
	NI32 lastError_1;
	struct addrinfo* it_1;
	tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA domain_1;
	int lastFd_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = NIM_NIL;
	sockType_1 = toSockType__pureZnativesockets_u147(protocol_p2);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	aiList_1 = getAddrInfo__pureZnativesockets_u276(address_p0, port_p1, ((tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA)0), sockType_1, protocol_p2);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	nimZeroMem((void*)fdPerDomain_1, sizeof(tyArray__4fBsehQGr9cX77f4jRh2sgw));
	nimZeroMem((void*)fdPerDomain_1, sizeof(tyArray__4fBsehQGr9cX77f4jRh2sgw));
	{
		NI i_1;
		NI res_1;
		i_1 = (NI)0;
		res_1 = ((NI)0);
		{
			while (1) {
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_87;
				if (!(res_1 <= ((NI)30))) goto LA3;
				i_1 = ((NI) (res_1));
				fdPerDomain_1[(i_1)- 0] = osInvalidSocket__pureZnativesockets_u48;
				if (nimAddInt(res_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_87)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_87);
			} LA3: ;
		}
	}
	success_1 = NIM_FALSE;
	lastError_1 = 0;
	it_1 = aiList_1;
	domain_1 = 0;
	lastFd_1 = 0;
	{
		while (1) {
			if (!!((it_1 == ((struct addrinfo*) NIM_NIL)))) goto LA5;
			{
				tyObject_Option__lf3iZ9bSOr0IZPtb2xh5Ylg domainOpt_1;
				tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA* T12_;
				domainOpt_1 = toKnownDomain__pureZnativesockets_u69((*it_1).ai_family);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T9_;
					T9_ = (NIM_BOOL)0;
					T9_ = isNone__pureZnativesockets_u385(domainOpt_1);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (!T9_) goto LA10_;
					it_1 = (*it_1).ai_next;
					goto LA6;
				}
LA10_: ;
				T12_ = (tyEnum_Domain__MfMl870GtGGt9bzO9cicdWqA*)0;
				T12_ = unsafeGet__pureZnet_u2635((&domainOpt_1));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				domain_1 = (*T12_);
				if ((NU)(domain_1) > (NU)(30)){ raiseIndexError2(domain_1, 30); goto BeforeRet_;
				}
				lastFd_1 = fdPerDomain_1[(domain_1)- 0];
				{
					if (!(lastFd_1 == osInvalidSocket__pureZnativesockets_u48)) goto LA15_;
					lastFd_1 = createNativeSocket__pureZnativesockets_u235(domain_1, sockType_1, protocol_p2, NIM_FALSE);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					{
						NI32 err_1;
						if (!(lastFd_1 == osInvalidSocket__pureZnativesockets_u48)) goto LA19_;
						err_1 = osLastError__stdZoserrors_u122();
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						freeaddrinfo(aiList_1);
						{
							NI i_2;
							int fd_1;
							NI i_3;
							i_2 = (NI)0;
							fd_1 = (int)0;
							i_3 = ((NI)0);
							{
								while (1) {
									i_2 = i_3;
									fd_1 = fdPerDomain_1[(i_3)- 0];
									{
										NIM_BOOL T26_;
										T26_ = (NIM_BOOL)0;
										T26_ = !((fd_1 == osInvalidSocket__pureZnativesockets_u48));
										if (!(T26_)) goto LA27_;
										T26_ = !((i_2 == ((NI)-1)));
LA27_: ;
										if (!T26_) goto LA28_;
										close__pureZnativesockets_u201(fd_1);
										if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
									}
LA28_: ;
									{
										if (!(((NI)30) <= i_3)) goto LA32_;
										goto LA22;
									}
LA32_: ;
									i_3 += ((NI)1);
								}
							} LA22: ;
						}
						raiseOSError__stdZoserrors_u119(err_1, TM__XqsrSBxhOTPgLQ9cX4MmV4A_90);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
LA19_: ;
					if ((NU)(domain_1) > (NU)(30)){ raiseIndexError2(domain_1, 30); goto BeforeRet_;
					}
					fdPerDomain_1[(domain_1)- 0] = lastFd_1;
				}
LA15_: ;
				{
					int T36_;
					T36_ = (int)0;
					T36_ = connect(lastFd_1, (*it_1).ai_addr, (*it_1).ai_addrlen);
					if (!(T36_ == ((NI32)0))) goto LA37_;
					success_1 = NIM_TRUE;
					goto LA4;
				}
LA37_: ;
				lastError_1 = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				it_1 = (*it_1).ai_next;
			} LA6: ;
		} LA5: ;
	} LA4: ;
	freeaddrinfo(aiList_1);
	{
		NI i_4;
		int fd_2;
		NI i_5;
		i_4 = (NI)0;
		fd_2 = (int)0;
		i_5 = ((NI)0);
		{
			while (1) {
				i_4 = i_5;
				fd_2 = fdPerDomain_1[(i_5)- 0];
				{
					NIM_BOOL T44_;
					T44_ = (NIM_BOOL)0;
					T44_ = !((fd_2 == osInvalidSocket__pureZnativesockets_u48));
					if (!(T44_)) goto LA45_;
					T44_ = !((i_4 == domain_1));
LA45_: ;
					if (!T44_) goto LA46_;
					close__pureZnativesockets_u201(fd_2);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA46_: ;
				{
					if (!(((NI)30) <= i_5)) goto LA50_;
					goto LA40;
				}
LA50_: ;
				i_5 += ((NI)1);
			}
		} LA40: ;
	}
	{
		if (!success_1) goto LA54_;
		result = newSocket__pureZnet_u254(lastFd_1, domain_1, sockType_1, protocol_p2, buffered_p3);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA52_;
LA54_: ;
	{
		if (!!((lastError_1 == ((NI32)0)))) goto LA57_;
		close__pureZnativesockets_u201(lastFd_1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		result = 0;
		raiseOSError__stdZoserrors_u119(lastError_1, TM__XqsrSBxhOTPgLQ9cX4MmV4A_93);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA52_;
LA57_: ;
	{
		tyObject_IOError__FsM2LSiW5usgjecIvsloBA* T60_;
		NimStringV2 T61_;
		close__pureZnativesockets_u201(lastFd_1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T60_ = NIM_NIL;
		T60_ = (tyObject_IOError__FsM2LSiW5usgjecIvsloBA*) nimNewObj(sizeof(tyObject_IOError__FsM2LSiW5usgjecIvsloBA), NIM_ALIGNOF(tyObject_IOError__FsM2LSiW5usgjecIvsloBA));
		(*T60_).Sup.Sup.Sup.m_type = (&NTIv2__FsM2LSiW5usgjecIvsloBA_);
		(*T60_).Sup.Sup.name = "IOError";
		T61_.len = 0; T61_.p = NIM_NIL;
		T61_ = rawNewString(address_p0.len + 26);
appendString((&T61_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_95);
appendString((&T61_), address_p0);
		(*T60_).Sup.Sup.message = T61_;
		(*T60_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T60_, "IOError", "dial", "net.nim", 2049);
goto BeforeRet_;
	}
LA52_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u514)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicStatic(dest_p0, ((TNimTypeV2*) ((&NTIv2__TmGWJPpyEwcsRMnCyN509ag_))));
		if (!T3_) goto LA4_;
		eqdestroy___pureZnet_u288((&(*dest_p0)));
		nimRawDispose(dest_p0, ((NI)8));
	}
LA4_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isClosed__pureZnet_u2013)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0) {
	NIM_BOOL result;
	result = ((*socket_p0).fd == osInvalidSocket__pureZnativesockets_u48);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, send__pureZnet_u2277)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* data_p1, NI size_p2) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = isClosed__pureZnet_u2013(socket_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!(!(T3_))) goto LA4_;
		failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_98);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA4_: ;
	{
		int T10_;
		if (!(*socket_p0).isSsl) goto LA8_;
		ERR_clear_error();
		T10_ = (int)0;
		T10_ = SSL_write((*socket_p0).sslHandle, ((NCSTRING) (data_p1)), size_p2);
		result = ((NI) (T10_));
		goto BeforeRet_;
	}
LA8_: ;
	if ((size_p2) < ((int)(-2147483647 -1)) || (size_p2) > ((int)2147483647)){ raiseRangeErrorI(size_p2, ((int)(-2147483647 -1)), ((int)2147483647)); goto BeforeRet_;
	}
	result = send((*socket_p0).fd, data_p1, ((NI) (((int) (size_p2)))), ((NI32)0));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, send__pureZnet_u2287)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NimStringV2 data_p1, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p2, NI maxRetries_p3) {
	NI written_1;
	NI attempts_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	written_1 = ((NI)0);
	attempts_1 = ((NI)0);
	{
		while (1) {
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_96;
			NI sent_1;
			if (nimSubInt(data_p1.len, written_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_96)) { raiseOverflow(); goto BeforeRet_;
			};
			if (!(((NI)0) < (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_96))) goto LA2;
			sent_1 = send__pureZnet_u2277(socket_p0, ((void*) (nimToCStringConv(data_p1))), data_p1.len);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				NI32 lastError_1;
				NIM_BOOL isBlockingErr_1;
				NIM_BOOL T7_;
				NIM_BOOL T8_;
				if (!(sent_1 < ((NI)0))) goto LA5_;
				lastError_1 = osLastError__stdZoserrors_u122();
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				T7_ = (NIM_BOOL)0;
				T8_ = (NIM_BOOL)0;
				T8_ = (lastError_1 == EINTR);
				if (T8_) goto LA9_;
				T8_ = (lastError_1 == EWOULDBLOCK);
LA9_: ;
				T7_ = T8_;
				if (T7_) goto LA10_;
				T7_ = (lastError_1 == EAGAIN);
LA10_: ;
				isBlockingErr_1 = T7_;
				{
					NI32 lastError_2;
					if (!!(isBlockingErr_1)) goto LA13_;
					lastError_2 = osLastError__stdZoserrors_u122();
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					socketError__pureZnet_u175(socket_p0, ((NI)-1), NIM_FALSE, lastError_2, flags_p2);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
				goto LA11_;
LA13_: ;
				{
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_99;
					if (nimAddInt(attempts_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_99)) { raiseOverflow(); goto BeforeRet_;
					};
					attempts_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_99);
					{
						NI32 T20_;
						if (!(maxRetries_p3 < attempts_1)) goto LA18_;
						T20_ = (NI32)0;
						T20_ = osLastError__stdZoserrors_u122();
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						raiseOSError__stdZoserrors_u119(T20_, TM__XqsrSBxhOTPgLQ9cX4MmV4A_101);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
LA18_: ;
				}
LA11_: ;
			}
			goto LA3_;
LA5_: ;
			{
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_102;
				if (nimAddInt(written_1, sent_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_102)) { raiseOverflow(); goto BeforeRet_;
				};
				written_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_102);
			}
LA3_: ;
		} LA2: ;
	}
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI, uniRecv__pureZnet_u2016)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* buffer_p1, int size_p2, int flags_p3) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = ((NI)0);
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = isClosed__pureZnet_u2013(socket_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!(!(T3_))) goto LA4_;
		failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_104);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA4_: ;
	{
		int T10_;
		if (!(*socket_p0).isSsl) goto LA8_;
		ERR_clear_error();
		T10_ = (int)0;
		T10_ = SSL_read((*socket_p0).sslHandle, buffer_p1, ((NI) (size_p2)));
		result = ((NI) (T10_));
		goto BeforeRet_;
	}
LA8_: ;
	result = recv((*socket_p0).fd, buffer_p1, ((NI) (size_p2)), flags_p3);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, readIntoBuf__pureZnet_u2027)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NI32 flags_p1) {
	NI result;
	tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = ((NI)0);
	T1_ = NIM_NIL;
	T1_ = socket_p0;
	result = uniRecv__pureZnet_u2016(T1_, ((void*) ((*socket_p0).buffer)), ((int)4000), flags_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NI32 T6_;
		if (!(result < ((NI)0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__stdZoserrors_u122();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		(*socket_p0).lastError = T6_;
	}
LA4_: ;
	{
		if (!(result <= ((NI)0))) goto LA9_;
		(*socket_p0).bufLen = ((NI)0);
		(*socket_p0).currPos = ((NI)0);
		goto BeforeRet_;
	}
LA9_: ;
	(*socket_p0).bufLen = result;
	(*socket_p0).currPos = ((NI)0);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, recv__pureZnet_u2076)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* data_p1, NI size_p2) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (!(size_p2 == ((NI)0))) goto LA3_;
		goto BeforeRet_;
	}
LA3_: ;
	{
		NI read_1;
		if (!(*socket_p0).isBuffered) goto LA7_;
		{
			NI res_1;
			if (!((*socket_p0).bufLen == ((NI)0))) goto LA11_;
			res_1 = readIntoBuf__pureZnet_u2027(socket_p0, ((NI32)0));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				if (!(res_1 <= ((NI)0))) goto LA15_;
				{
					if (!NIM_FALSE) goto LA19_;
					result = ((NI)0);
					goto BeforeRet_;
				}
				goto LA17_;
LA19_: ;
				{
					result = res_1;
					goto BeforeRet_;
				}
LA17_: ;
			}
LA15_: ;
		}
LA11_: ;
		read_1 = ((NI)0);
		{
			while (1) {
				NI chunk_1;
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_105;
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_106;
				NCSTRING d_1;
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_110;
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_111;
				if (!(read_1 < size_p2)) goto LA23;
				{
					NI res_2;
					if (!((*socket_p0).bufLen <= (*socket_p0).currPos)) goto LA26_;
					res_2 = readIntoBuf__pureZnet_u2027(socket_p0, ((NI32)0));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					{
						if (!(res_2 <= ((NI)0))) goto LA30_;
						{
							if (!(((NI)0) < read_1)) goto LA34_;
							result = read_1;
							goto BeforeRet_;
						}
						goto LA32_;
LA34_: ;
						{
							result = res_2;
							goto BeforeRet_;
						}
LA32_: ;
					}
LA30_: ;
				}
LA26_: ;
				if (nimSubInt((*socket_p0).bufLen, (*socket_p0).currPos, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_105)) { raiseOverflow(); goto BeforeRet_;
				};
				if (nimSubInt(size_p2, read_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_106)) { raiseOverflow(); goto BeforeRet_;
				};
				chunk_1 = (((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_105) <= (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_106)) ? (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_105) : (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_106));
				d_1 = ((NCSTRING) (data_p1));
				{
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_107;
					if (nimSubInt(size_p2, read_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_107)) { raiseOverflow(); goto BeforeRet_;
					};
					if (!!((chunk_1 <= (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_107)))) goto LA39_;
					failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_109);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA39_: ;
				if ((NU)((*socket_p0).currPos) > (NU)(4000)){ raiseIndexError2((*socket_p0).currPos, 4000); goto BeforeRet_;
				}
				if ((chunk_1) < ((NI)0) || (chunk_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(chunk_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
				}
				copyMem__system_u1755(((void*) ((&d_1[read_1]))), ((void*) ((&(*socket_p0).buffer[((*socket_p0).currPos)- 0]))), (chunk_1));
				if (nimAddInt(read_1, chunk_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_110)) { raiseOverflow(); goto BeforeRet_;
				};
				read_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_110);
				if (nimAddInt((*socket_p0).currPos, chunk_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_111)) { raiseOverflow(); goto BeforeRet_;
				};
				(*socket_p0).currPos = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_111);
			} LA23: ;
		}
		result = read_1;
	}
	goto LA5_;
LA7_: ;
	{
		{
			if (!(*socket_p0).isSsl) goto LA44_;
			{
				if (!(*socket_p0).sslHasPeekChar) goto LA48_;
				copyMem__system_u1755(data_p1, ((void*) ((&(*socket_p0).sslPeekChar))), ((NI)1));
				(*socket_p0).sslHasPeekChar = NIM_FALSE;
				{
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_112;
					NCSTRING d_2;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_113;
					NI T54_;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_114;
					if (nimSubInt(size_p2, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_112)) { raiseOverflow(); goto BeforeRet_;
					};
					if (!(((NI)0) < (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_112))) goto LA52_;
					d_2 = ((NCSTRING) (data_p1));
					if (nimSubInt(size_p2, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_113)) { raiseOverflow(); goto BeforeRet_;
					};
					if (((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_113)) < ((int)(-2147483647 -1)) || ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_113)) > ((int)2147483647)){ raiseRangeErrorI((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_113), ((int)(-2147483647 -1)), ((int)2147483647)); goto BeforeRet_;
					}
					T54_ = (NI)0;
					T54_ = uniRecv__pureZnet_u2016(socket_p0, ((void*) ((&d_2[((NI)1)]))), ((int) ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_113))), ((NI32)0));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (nimAddInt(T54_, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_114)) { raiseOverflow(); goto BeforeRet_;
					};
					result = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_114);
				}
				goto LA50_;
LA52_: ;
				{
					result = ((NI)1);
				}
LA50_: ;
			}
			goto LA46_;
LA48_: ;
			{
				if ((size_p2) < ((int)(-2147483647 -1)) || (size_p2) > ((int)2147483647)){ raiseRangeErrorI(size_p2, ((int)(-2147483647 -1)), ((int)2147483647)); goto BeforeRet_;
				}
				result = uniRecv__pureZnet_u2016(socket_p0, data_p1, ((int) (size_p2)), ((NI32)0));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
LA46_: ;
		}
		goto LA42_;
LA44_: ;
		{
			if ((size_p2) < ((int)(-2147483647 -1)) || (size_p2) > ((int)2147483647)){ raiseRangeErrorI(size_p2, ((int)(-2147483647 -1)), ((int)2147483647)); goto BeforeRet_;
			}
			result = recv((*socket_p0).fd, data_p1, ((NI) (((int) (size_p2)))), ((NI32)0));
		}
LA42_: ;
		{
			NI32 T62_;
			if (!(result < ((NI)0))) goto LA60_;
			T62_ = (NI32)0;
			T62_ = osLastError__stdZoserrors_u122();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			(*socket_p0).lastError = T62_;
		}
LA60_: ;
	}
LA5_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, nimSubInt64)(NI64 a_p0, NI64 b_p1, NI64* res_p2) {
	NIM_BOOL result;
	NI64 r_1;
	result = (NIM_BOOL)0;
	r_1 = ((NI64) ((NU64)((NU64)(((NU64) (a_p0))) - (NU64)(((NU64) (b_p1))))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (IL64(0) <= (NI64)(r_1 ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (IL64(0) <= (NI64)(r_1 ^ (NI64)((NU64) ~(b_p1))));
LA4_: ;
		if (!T3_) goto LA5_;
		(*res_p2) = r_1;
	}
	goto LA1_;
LA5_: ;
	{
		result = NIM_TRUE;
	}
LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZnet_u2122)(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg* dest_p0) {
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).Sup.Sup.up);
		if (!T3_) goto LA4_;
		nimDestroyAndDispose((*dest_p0).Sup.Sup.up);
	}
LA4_: ;
	eqdestroy___system_u3757((*dest_p0).Sup.Sup.trace);
	if ((*dest_p0).Sup.Sup.message.p && !((*dest_p0).Sup.Sup.message.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared((*dest_p0).Sup.Sup.message.p);
}
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = nimDecRefIsLastCyclicDyn((*dest_p0).Sup.Sup.parent);
		if (!T8_) goto LA9_;
		nimDestroyAndDispose((*dest_p0).Sup.Sup.parent);
	}
LA9_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, rttiDestroy__pureZnet_u2929)(void* dest_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	eqdestroy___pureZnet_u2122(((tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg*) (dest_p0)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqtrace___pureZnet_u2134)(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg* dest_p0, void* env_p1) {
	nimTraceRefDyn(&(*dest_p0).Sup.Sup.parent, env_p1);
	nimTraceRefDyn(&(*dest_p0).Sup.Sup.up, env_p1);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasDataBuffered__pureZnet_u2010)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* s_p0) {
	NIM_BOOL result;
	result = NIM_FALSE;
	{
		NIM_BOOL T5_;
		if (!(*s_p0).isBuffered) goto LA3_;
		T5_ = (NIM_BOOL)0;
		T5_ = (((NI)0) < (*s_p0).bufLen);
		if (!(T5_)) goto LA6_;
		T5_ = !(((*s_p0).currPos == (*s_p0).bufLen));
LA6_: ;
		result = T5_;
	}
LA3_: ;
	{
		NIM_BOOL T9_;
		T9_ = (NIM_BOOL)0;
		T9_ = (*s_p0).isSsl;
		if (!(T9_)) goto LA10_;
		T9_ = !(result);
LA10_: ;
		if (!T9_) goto LA11_;
		result = (*s_p0).sslHasPeekChar;
	}
LA11_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, timeoutRead__pureZnet_u135)(int* fd_p0, NI timeout_p1) {
	NI result;
	struct pollfd tpollfdX60gensym0__1;
	int T1_;
{	result = (NI)0;
	nimZeroMem((void*)(&tpollfdX60gensym0__1), sizeof(struct pollfd));
	tpollfdX60gensym0__1.fd = ((int) ((*fd_p0)));
	tpollfdX60gensym0__1.events = (NI16)(POLLIN | POLLPRI);
	if ((timeout_p1) < ((int)(-2147483647 -1)) || (timeout_p1) > ((int)2147483647)){ raiseRangeErrorI(timeout_p1, ((int)(-2147483647 -1)), ((int)2147483647)); goto BeforeRet_;
	}
	T1_ = (int)0;
	T1_ = poll((&tpollfdX60gensym0__1), ((nfds_t)1), ((int) (timeout_p1)));
	result = ((NI) (T1_));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, waitFor__pureZnet_u2102)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, tyObject_Duration__IhPGomXjacpk8ChnxqMuoA* waited_p1, NI timeout_p2, NI size_p3, NimStringV2 funcName_p4) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = ((NI)1);
	{
		if (!(size_p3 <= ((NI)0))) goto LA3_;
		{
			if (!NIM_TRUE) goto LA7_;
			failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_116);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA7_: ;
	}
LA3_: ;
	{
		if (!(timeout_p2 == ((NI)-1))) goto LA11_;
		result = size_p3;
		goto BeforeRet_;
	}
LA11_: ;
	{
		NIM_BOOL T15_;
		NIM_BOOL T16_;
		NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_117;
		T15_ = (NIM_BOOL)0;
		T16_ = (NIM_BOOL)0;
		T16_ = (*socket_p0).isBuffered;
		if (!(T16_)) goto LA17_;
		T16_ = !(((*socket_p0).bufLen == ((NI)0)));
LA17_: ;
		T15_ = T16_;
		if (!(T15_)) goto LA18_;
		T15_ = !(((*socket_p0).bufLen == (*socket_p0).currPos));
LA18_: ;
		if (!T15_) goto LA19_;
		if (nimSubInt((*socket_p0).bufLen, (*socket_p0).currPos, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_117)) { raiseOverflow(); goto BeforeRet_;
		};
		result = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_117);
		result = ((result <= size_p3) ? result : size_p3);
	}
	goto LA13_;
LA19_: ;
	{
		NI colontmpD_;
		NI colontmpD__2;
		tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw startTime_1;
		NI selRet_1;
		tyObject_MonoTime__OPj9am9cm67Ww8xBOG3ksEhw T60_;
		tyObject_Duration__IhPGomXjacpk8ChnxqMuoA T61_;
		colontmpD_ = (NI)0;
		colontmpD__2 = (NI)0;
		{
			NI64 T24_;
			NI64 TM__XqsrSBxhOTPgLQ9cX4MmV4A_118;
			tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg* T27_;
			NimStringV2 T28_;
			T24_ = (NI64)0;
			T24_ = inMilliseconds__pureZtimes_u814((*waited_p1));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (nimSubInt64(((NI64) (timeout_p2)), T24_, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_118)) { raiseOverflow(); goto BeforeRet_;
			};
			if (!((NI64)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_118) < IL64(1))) goto LA25_;
			T27_ = NIM_NIL;
			T27_ = (tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg*) nimNewObj(sizeof(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg), NIM_ALIGNOF(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg));
			(*T27_).Sup.Sup.Sup.m_type = (&NTIv2__spNCqmnrI61hixyO1Nuakg_);
			(*T27_).Sup.Sup.name = "TimeoutError";
			T28_.len = 0; T28_.p = NIM_NIL;
			T28_ = rawNewString(funcName_p4.len + 21);
appendString((&T28_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_121);
appendString((&T28_), funcName_p4);
appendString((&T28_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_123);
			(*T27_).Sup.Sup.message = T28_;
			(*T27_).Sup.Sup.parent = ((Exception*) NIM_NIL);
			raiseExceptionEx((Exception*)T27_, "TimeoutError", "waitFor", "net.nim", 1459);
goto BeforeRet_;
		}
LA25_: ;
		{
			int sslPending_1;
			if (!(*socket_p0).isSsl) goto LA31_;
			{
				NIM_BOOL T35_;
				T35_ = (NIM_BOOL)0;
				T35_ = hasDataBuffered__pureZnet_u2010(socket_p0);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				if (!T35_) goto LA36_;
				result = ((NI)1);
				goto BeforeRet_;
			}
LA36_: ;
			sslPending_1 = SSL_pending((*socket_p0).sslHandle);
			{
				if (!!((sslPending_1 == ((NI32)0)))) goto LA40_;
				result = ((((NI) (sslPending_1)) <= size_p3) ? ((NI) (sslPending_1)) : size_p3);
				goto BeforeRet_;
			}
LA40_: ;
		}
LA31_: ;
		startTime_1 = getMonoTime__stdZmonotimes_u10();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		{
			NIM_BOOL T44_;
			T44_ = (NIM_BOOL)0;
			T44_ = hasDataBuffered__pureZnet_u2010(socket_p0);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!T44_) goto LA45_;
			colontmpD_ = ((NI)1);
			selRet_1 = colontmpD_;
		}
		goto LA42_;
LA45_: ;
		{
			NI64 T48_;
			NI64 TM__XqsrSBxhOTPgLQ9cX4MmV4A_124;
			T48_ = (NI64)0;
			T48_ = inMilliseconds__pureZtimes_u814((*waited_p1));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (nimSubInt64(((NI64) (timeout_p2)), T48_, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_124)) { raiseOverflow(); goto BeforeRet_;
			};
			colontmpD__2 = timeoutRead__pureZnet_u135((&(*socket_p0).fd), ((NI) ((NI64)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_124))));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			selRet_1 = colontmpD__2;
		}
LA42_: ;
		{
			NI32 T53_;
			if (!(selRet_1 < ((NI)0))) goto LA51_;
			T53_ = (NI32)0;
			T53_ = osLastError__stdZoserrors_u122();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			raiseOSError__stdZoserrors_u119(T53_, TM__XqsrSBxhOTPgLQ9cX4MmV4A_125);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA51_: ;
		{
			tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg* T58_;
			NimStringV2 T59_;
			if (!!((selRet_1 == ((NI)1)))) goto LA56_;
			T58_ = NIM_NIL;
			T58_ = (tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg*) nimNewObj(sizeof(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg), NIM_ALIGNOF(tyObject_TimeoutError__spNCqmnrI61hixyO1Nuakg));
			(*T58_).Sup.Sup.Sup.m_type = (&NTIv2__spNCqmnrI61hixyO1Nuakg_);
			(*T58_).Sup.Sup.name = "TimeoutError";
			T59_.len = 0; T59_.p = NIM_NIL;
			T59_ = rawNewString(funcName_p4.len + 21);
appendString((&T59_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_126);
appendString((&T59_), funcName_p4);
appendString((&T59_), TM__XqsrSBxhOTPgLQ9cX4MmV4A_127);
			(*T58_).Sup.Sup.message = T59_;
			(*T58_).Sup.Sup.parent = ((Exception*) NIM_NIL);
			raiseExceptionEx((Exception*)T58_, "TimeoutError", "waitFor", "net.nim", 1476);
goto BeforeRet_;
		}
LA56_: ;
		T60_ = getMonoTime__stdZmonotimes_u10();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T61_ = minus___stdZmonotimes_u63(T60_, startTime_1);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		pluseq___pureZtimes_u1156(waited_p1, T61_);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA13_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, recv__pureZnet_u2180)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, void* data_p1, NI size_p2, NI timeout_p3) {
	NI result;
	tyObject_Duration__IhPGomXjacpk8ChnxqMuoA waited_1;
	NI read_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	nimZeroMem((void*)(&waited_1), sizeof(tyObject_Duration__IhPGomXjacpk8ChnxqMuoA));
	read_1 = ((NI)0);
	{
		while (1) {
			NI avail_1;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_128;
			NCSTRING d_1;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_134;
			if (!(read_1 < size_p2)) goto LA2;
			if (nimSubInt(size_p2, read_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_128)) { raiseOverflow(); goto BeforeRet_;
			};
			avail_1 = waitFor__pureZnet_u2102(socket_p0, (&waited_1), timeout_p3, (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_128), TM__XqsrSBxhOTPgLQ9cX4MmV4A_130);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			d_1 = ((NCSTRING) (data_p1));
			{
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_131;
				if (nimSubInt(size_p2, read_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_131)) { raiseOverflow(); goto BeforeRet_;
				};
				if (!!((avail_1 <= (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_131)))) goto LA5_;
				failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_133);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
LA5_: ;
			result = recv__pureZnet_u2076(socket_p0, ((void*) ((&d_1[read_1]))), avail_1);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				if (!(result == ((NI)0))) goto LA9_;
				goto LA1;
			}
LA9_: ;
			{
				if (!(result < ((NI)0))) goto LA13_;
				goto BeforeRet_;
			}
LA13_: ;
			if (nimAddInt(read_1, result, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_134)) { raiseOverflow(); goto BeforeRet_;
			};
			read_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_134);
		} LA2: ;
	} LA1: ;
	result = read_1;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, recv__pureZnet_u2204)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NimStringV2* data_p1, NI size_p2, NI timeout_p3, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p4) {
	NI result;
	NI T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	if ((size_p2) < ((NI)0) || (size_p2) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(size_p2, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	setLengthStrV2((&(*data_p1)), (size_p2));
	T1_ = (NI)0;
	{
		if (!(timeout_p3 == ((NI)-1))) goto LA4_;
		result = recv__pureZnet_u2076(socket_p0, ((void*) (nimToCStringConv((*data_p1)))), size_p2);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA2_;
LA4_: ;
	{
		result = recv__pureZnet_u2180(socket_p0, ((void*) (nimToCStringConv((*data_p1)))), size_p2, timeout_p3);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA2_: ;
	{
		NI32 lastError_1;
		if (!(result < ((NI)0))) goto LA9_;
		setLengthStrV2((&(*data_p1)), ((NI)0));
		lastError_1 = getSocketError__pureZnet_u1878(socket_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		socketError__pureZnet_u175(socket_p0, result, NIM_FALSE, lastError_1, flags_p4);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA7_;
LA9_: ;
	{
		if ((result) < ((NI)0) || (result) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(result, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
		}
		setLengthStrV2((&(*data_p1)), (result));
	}
LA7_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, wrapSocket__pureZnet_u1772)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* ctx_p0, tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		if (!!(!((*socket_p1).isSsl))) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_136);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	(*socket_p1).isSsl = NIM_TRUE;
	eqcopy___pureZnet_u1582(&(*socket_p1).sslContext, ctx_p0, NIM_TRUE);
	(*socket_p1).sslHandle = SSL_new((*(*socket_p1).sslContext).context);
	(*socket_p1).sslNoHandshake = NIM_FALSE;
	(*socket_p1).sslHasPeekChar = NIM_FALSE;
	(*socket_p1).sslNoShutdown = NIM_FALSE;
	{
		if (!((*socket_p1).sslHandle == ((tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*) NIM_NIL))) goto LA7_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_137);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA7_: ;
	{
		int T11_;
		T11_ = (int)0;
		T11_ = SSL_set_fd((*socket_p1).sslHandle, (*socket_p1).fd);
		if (!!((T11_ == ((NI32)1)))) goto LA12_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_138);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA12_: ;
	}BeforeRet_: ;
}
static N_INLINE(NI, find__stdZprivateZospaths2_u385)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1) {
	NI result;
{	result = ((NI)0);
	{
		NIM_CHAR i_1;
		NI i_2;
		i_1 = (NIM_CHAR)0;
		i_2 = ((NI)0);
		{
			while (1) {
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_141;
				if (!(i_2 < a_p0Len_0)) goto LA3;
				if (i_2 < 0 || i_2 >= a_p0Len_0){ raiseIndexError2(i_2,a_p0Len_0-1); goto BeforeRet_;
				}
				i_1 = a_p0[i_2];
				{
					if (!((NU8)(i_1) == (NU8)(item_p1))) goto LA6_;
					goto BeforeRet_;
				}
LA6_: ;
				if (nimAddInt(result, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_141)) { raiseOverflow(); goto BeforeRet_;
				};
				result = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_141);
				i_2 += ((NI)1);
			} LA3: ;
		}
	}
	result = ((NI)-1);
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, contains__stdZprivateZospaths2_u380)(NIM_CHAR* a_p0, NI a_p0Len_0, NIM_CHAR item_p1) {
	NIM_BOOL result;
	NI T1_;
{	T1_ = (NI)0;
	T1_ = find__stdZprivateZospaths2_u385(a_p0, a_p0Len_0, item_p1);
	result = (((NI)0) <= T1_);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___pureZnet_u123)(tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q e_p0) {
	NimStringV2 result;
	switch (e_p0) {
	case ((tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q)0):
	{
		result = TM__XqsrSBxhOTPgLQ9cX4MmV4A_153;
	}
	break;
	case ((tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q)1):
	{
		result = TM__XqsrSBxhOTPgLQ9cX4MmV4A_155;
	}
	break;
	default:
	{
		result = TM__XqsrSBxhOTPgLQ9cX4MmV4A_157;
	}
	break;
	}
	return result;
}
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(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(NimStringV2, X5BX5D___pureZstrutils_u1291)(NimStringV2 s_p0, tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ x_p1) {
	NimStringV2 result;
	NI a_1;
	NI L_1;
	NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_186;
	NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_187;
{	result.len = 0; result.p = NIM_NIL;
	a_1 = x_p1.a;
	if (nimSubInt(x_p1.b, a_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_186)) { raiseOverflow(); goto BeforeRet_;
	};
	if (nimAddInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_186), ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_187)) { raiseOverflow(); goto BeforeRet_;
	};
	L_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_187);
	if ((L_1) < ((NI)0) || (L_1) > ((NI)IL64(9223372036854775807))){ raiseRangeErrorI(L_1, ((NI)0), ((NI)IL64(9223372036854775807))); goto BeforeRet_;
	}
	result = mnewString((L_1));
	{
		NI i_1;
		NI i_2;
		i_1 = (NI)0;
		i_2 = ((NI)0);
		{
			while (1) {
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_188;
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_189;
				if (!(i_2 < L_1)) goto LA3;
				i_1 = i_2;
				if (i_1 < 0 || i_1 >= result.len){ raiseIndexError2(i_1,result.len-1); goto BeforeRet_;
				}
				nimPrepareStrMutationV2((&result));
				if (nimAddInt(i_1, a_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_188)) { raiseOverflow(); goto BeforeRet_;
				};
				if ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_188) < 0 || (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_188) >= s_p0.len){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_188),s_p0.len-1); goto BeforeRet_;
				}
				result.p->data[i_1] = s_p0.p->data[(NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_188)];
				if (nimAddInt(i_2, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_189)) { raiseOverflow(); goto BeforeRet_;
				};
				i_2 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_189);
			} LA3: ;
		}
	}
	}BeforeRet_: ;
	return result;
}
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;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ, parseIPv6Address__pureZnet_u663)(NimStringV2 addressStr_p0) {
	tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ result;
	NI groupCount_1;
	NI currentGroupStart_1;
	NU32 currentShort_1;
	NIM_BOOL separatorValid_1;
	NI dualColonGroup_1;
	NIM_BOOL lastWasColon_1;
	NI v4StartPos_1;
	NI byteCount_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ));
	result.family = ((tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q)0);
	nimZeroMem((void*)result._family_1.address_v6, sizeof(tyArray__dnD8kjh6rJ1Yy5jHvid0Ow));
	{
		tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T5_;
		if (!(addressStr_p0.len < ((NI)2))) goto LA3_;
		T5_ = NIM_NIL;
		T5_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
		(*T5_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
		(*T5_).Sup.Sup.name = "ValueError";
		(*T5_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_143;
		(*T5_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T5_, "ValueError", "parseIPv6Address", "net.nim", 359);
goto BeforeRet_;
	}
LA3_: ;
	groupCount_1 = ((NI)0);
	currentGroupStart_1 = ((NI)0);
	currentShort_1 = ((NU32)0);
	separatorValid_1 = NIM_TRUE;
	dualColonGroup_1 = ((NI)-1);
	lastWasColon_1 = NIM_FALSE;
	v4StartPos_1 = ((NI)-1);
	byteCount_1 = ((NI)0);
	{
		NI i_1;
		NIM_CHAR c_1;
		NI i_2;
		NI L_1;
		i_1 = (NI)0;
		c_1 = (NIM_CHAR)0;
		i_2 = ((NI)0);
		L_1 = addressStr_p0.len;
		{
			while (1) {
				if (!(i_2 < L_1)) goto LA8;
				i_1 = i_2;
				if (i_2 < 0 || i_2 >= addressStr_p0.len){ raiseIndexError2(i_2,addressStr_p0.len-1); goto BeforeRet_;
				}
				c_1 = addressStr_p0.p->data[i_2];
				{
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_168;
					if (!((NU8)(c_1) == (NU8)(58))) goto LA11_;
					{
						tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T17_;
						if (!!(separatorValid_1)) goto LA15_;
						T17_ = NIM_NIL;
						T17_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
						(*T17_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
						(*T17_).Sup.Sup.name = "ValueError";
						(*T17_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_145;
						(*T17_).Sup.Sup.parent = ((Exception*) NIM_NIL);
						raiseExceptionEx((Exception*)T17_, "ValueError", "parseIPv6Address", "net.nim", 374);
goto BeforeRet_;
					}
LA15_: ;
					{
						if (!lastWasColon_1) goto LA20_;
						{
							tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T26_;
							if (!!((dualColonGroup_1 == ((NI)-1)))) goto LA24_;
							T26_ = NIM_NIL;
							T26_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
							(*T26_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
							(*T26_).Sup.Sup.name = "ValueError";
							(*T26_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_147;
							(*T26_).Sup.Sup.parent = ((Exception*) NIM_NIL);
							raiseExceptionEx((Exception*)T26_, "ValueError", "parseIPv6Address", "net.nim", 378);
goto BeforeRet_;
						}
LA24_: ;
						dualColonGroup_1 = groupCount_1;
						separatorValid_1 = NIM_FALSE;
					}
					goto LA18_;
LA20_: ;
					{
						NIM_BOOL T28_;
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_158;
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_160;
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_161;
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_162;
						T28_ = (NIM_BOOL)0;
						T28_ = !((i_1 == ((NI)0)));
						if (!(T28_)) goto LA29_;
						T28_ = !((i_1 == (addressStr_p0.len-1)));
LA29_: ;
						if (!T28_) goto LA30_;
						{
							tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T36_;
							if (!(((NI)8) <= groupCount_1)) goto LA34_;
							T36_ = NIM_NIL;
							T36_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
							(*T36_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
							(*T36_).Sup.Sup.name = "ValueError";
							(*T36_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_149;
							(*T36_).Sup.Sup.parent = ((Exception*) NIM_NIL);
							raiseExceptionEx((Exception*)T36_, "ValueError", "parseIPv6Address", "net.nim", 384);
goto BeforeRet_;
						}
LA34_: ;
						if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 						{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_151, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
						}
						if (nimMulInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_158)) { raiseOverflow(); goto BeforeRet_;
						};
						if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_158)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_158), 15); goto BeforeRet_;
						}
						result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_158))- 0] = ((NU8) ((NU32)((NU32)(currentShort_1) >> (NU64)(((NI)8) & (32 - 1)))));
						if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 						{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_159, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
						}
						if (nimMulInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_160)) { raiseOverflow(); goto BeforeRet_;
						};
						if (nimAddInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_160), ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_161)) { raiseOverflow(); goto BeforeRet_;
						};
						if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_161)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_161), 15); goto BeforeRet_;
						}
						result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_161))- 0] = ((NU8) ((NU32)(currentShort_1 & ((NU32)255))));
						currentShort_1 = ((NU32)0);
						if (nimAddInt(groupCount_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_162)) { raiseOverflow(); goto BeforeRet_;
						};
						groupCount_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_162);
						{
							if (!!((dualColonGroup_1 == ((NI)-1)))) goto LA39_;
							separatorValid_1 = NIM_FALSE;
						}
LA39_: ;
					}
					goto LA18_;
LA30_: ;
					{
						if (!(i_1 == ((NI)0))) goto LA42_;
						{
							tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T48_;
							if (((NI)1) < 0 || ((NI)1) >= addressStr_p0.len){ raiseIndexError2(((NI)1),addressStr_p0.len-1); goto BeforeRet_;
							}
							if (!!(((NU8)(addressStr_p0.p->data[((NI)1)]) == (NU8)(58)))) goto LA46_;
							T48_ = NIM_NIL;
							T48_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
							(*T48_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
							(*T48_).Sup.Sup.name = "ValueError";
							(*T48_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_164;
							(*T48_).Sup.Sup.parent = ((Exception*) NIM_NIL);
							raiseExceptionEx((Exception*)T48_, "ValueError", "parseIPv6Address", "net.nim", 393);
goto BeforeRet_;
						}
LA46_: ;
					}
					goto LA18_;
LA42_: ;
					{
						{
							NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_165;
							tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T54_;
							if (nimSubInt((addressStr_p0.len-1), ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_165)) { raiseOverflow(); goto BeforeRet_;
							};
							if ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_165) < 0 || (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_165) >= addressStr_p0.len){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_165),addressStr_p0.len-1); goto BeforeRet_;
							}
							if (!!(((NU8)(addressStr_p0.p->data[(NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_165)]) == (NU8)(58)))) goto LA52_;
							T54_ = NIM_NIL;
							T54_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
							(*T54_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
							(*T54_).Sup.Sup.name = "ValueError";
							(*T54_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_167;
							(*T54_).Sup.Sup.parent = ((Exception*) NIM_NIL);
							raiseExceptionEx((Exception*)T54_, "ValueError", "parseIPv6Address", "net.nim", 397);
goto BeforeRet_;
						}
LA52_: ;
					}
LA18_: ;
					lastWasColon_1 = NIM_TRUE;
					if (nimAddInt(i_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_168)) { raiseOverflow(); goto BeforeRet_;
					};
					currentGroupStart_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_168);
				}
				goto LA9_;
LA11_: ;
				{
					if (!((NU8)(c_1) == (NU8)(46))) goto LA56_;
					{
						NIM_BOOL T60_;
						NIM_BOOL T61_;
						tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T66_;
						T60_ = (NIM_BOOL)0;
						T61_ = (NIM_BOOL)0;
						T61_ = (i_1 < ((NI)3));
						if (T61_) goto LA62_;
						T61_ = !(separatorValid_1);
LA62_: ;
						T60_ = T61_;
						if (T60_) goto LA63_;
						T60_ = (((NI)7) <= groupCount_1);
LA63_: ;
						if (!T60_) goto LA64_;
						T66_ = NIM_NIL;
						T66_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
						(*T66_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
						(*T66_).Sup.Sup.name = "ValueError";
						(*T66_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_169;
						(*T66_).Sup.Sup.parent = ((Exception*) NIM_NIL);
						raiseExceptionEx((Exception*)T66_, "ValueError", "parseIPv6Address", "net.nim", 403);
goto BeforeRet_;
					}
LA64_: ;
					v4StartPos_1 = currentGroupStart_1;
					currentShort_1 = ((NU32)0);
					separatorValid_1 = NIM_FALSE;
					goto LA6;
				}
				goto LA9_;
LA56_: ;
				{
					if (!(((NU8)(c_1)) >= ((NU8)(48)) && ((NU8)(c_1)) <= ((NU8)(57)) || ((NU8)(c_1)) >= ((NU8)(65)) && ((NU8)(c_1)) <= ((NU8)(70)) || ((NU8)(c_1)) >= ((NU8)(97)) && ((NU8)(c_1)) <= ((NU8)(102)))) goto LA68_;
					{
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_170;
						if (!(((NU8)(c_1)) >= ((NU8)(48)) && ((NU8)(c_1)) <= ((NU8)(57)))) goto LA72_;
						if (nimSubInt(((NU8)(c_1)), ((NI)48), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_170)) { raiseOverflow(); goto BeforeRet_;
						};
						currentShort_1 = (NU32)((NU32)((NU32)((NU64)(currentShort_1) << (NU64)(((NI)4) & (32 - 1)))) + (NU32)(((NU32) ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_170)))));
					}
					goto LA70_;
LA72_: ;
					{
						NIM_BOOL T75_;
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_171;
						T75_ = (NIM_BOOL)0;
						T75_ = ((NU8)(97) <= (NU8)(c_1));
						if (!(T75_)) goto LA76_;
						T75_ = ((NU8)(c_1) <= (NU8)(102));
LA76_: ;
						if (!T75_) goto LA77_;
						if (nimSubInt(((NU8)(c_1)), ((NI)97), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_171)) { raiseOverflow(); goto BeforeRet_;
						};
						currentShort_1 = (NU32)((NU32)((NU32)((NU32)((NU32)((NU64)(currentShort_1) << (NU64)(((NI)4) & (32 - 1)))) + (NU32)(((NU32) ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_171)))))) + (NU32)(((NU32)10)));
					}
					goto LA70_;
LA77_: ;
					{
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_172;
						if (nimSubInt(((NU8)(c_1)), ((NI)65), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_172)) { raiseOverflow(); goto BeforeRet_;
						};
						currentShort_1 = (NU32)((NU32)((NU32)((NU32)((NU32)((NU64)(currentShort_1) << (NU64)(((NI)4) & (32 - 1)))) + (NU32)(((NU32) ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_172)))))) + (NU32)(((NU32)10)));
					}
LA70_: ;
					{
						tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T84_;
						if (!((NU32)(((NU32)65535)) < (NU32)(currentShort_1))) goto LA82_;
						T84_ = NIM_NIL;
						T84_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
						(*T84_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
						(*T84_).Sup.Sup.name = "ValueError";
						(*T84_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_174;
						(*T84_).Sup.Sup.parent = ((Exception*) NIM_NIL);
						raiseExceptionEx((Exception*)T84_, "ValueError", "parseIPv6Address", "net.nim", 416);
goto BeforeRet_;
					}
LA82_: ;
					lastWasColon_1 = NIM_FALSE;
					separatorValid_1 = NIM_TRUE;
				}
				goto LA9_;
LA68_: ;
				{
					tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T86_;
					T86_ = NIM_NIL;
					T86_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
					(*T86_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
					(*T86_).Sup.Sup.name = "ValueError";
					(*T86_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_176;
					(*T86_).Sup.Sup.parent = ((Exception*) NIM_NIL);
					raiseExceptionEx((Exception*)T86_, "ValueError", "parseIPv6Address", "net.nim", 421);
goto BeforeRet_;
				}
LA9_: ;
				i_2 += ((NI)1);
				{
					if (!!((addressStr_p0.len == L_1))) goto LA89_;
					failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_178);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
LA89_: ;
			} LA8: ;
		}
	} LA6: ;
	{
		if (!(v4StartPos_1 == ((NI)-1))) goto LA93_;
		{
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_181;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_183;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_184;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_185;
			if (!separatorValid_1) goto LA97_;
			{
				tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T103_;
				if (!(((NI)8) <= groupCount_1)) goto LA101_;
				T103_ = NIM_NIL;
				T103_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
				(*T103_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
				(*T103_).Sup.Sup.name = "ValueError";
				(*T103_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_179;
				(*T103_).Sup.Sup.parent = ((Exception*) NIM_NIL);
				raiseExceptionEx((Exception*)T103_, "ValueError", "parseIPv6Address", "net.nim", 428);
goto BeforeRet_;
			}
LA101_: ;
			if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 			{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_180, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
			}
			if (nimMulInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_181)) { raiseOverflow(); goto BeforeRet_;
			};
			if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_181)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_181), 15); goto BeforeRet_;
			}
			result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_181))- 0] = ((NU8) ((NU32)((NU32)(currentShort_1) >> (NU64)(((NI)8) & (32 - 1)))));
			if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 			{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_182, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
			}
			if (nimMulInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_183)) { raiseOverflow(); goto BeforeRet_;
			};
			if (nimAddInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_183), ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_184)) { raiseOverflow(); goto BeforeRet_;
			};
			if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_184)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_184), 15); goto BeforeRet_;
			}
			result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_184))- 0] = ((NU8) ((NU32)(currentShort_1 & ((NU32)255))));
			if (nimAddInt(groupCount_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_185)) { raiseOverflow(); goto BeforeRet_;
			};
			groupCount_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_185);
		}
LA97_: ;
	}
	goto LA91_;
LA93_: ;
	{
		NIM_BOOL leadingZero_1;
		NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_203;
		NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_204;
		NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_205;
		leadingZero_1 = NIM_FALSE;
		{
			NimStringV2 colontmp_;
			NI i_3;
			NIM_CHAR c_2;
			tyObject_HSlice__atPNPXY5GObvliR9b4ZIorQ T107_;
			NI i_4;
			NI L_2;
			colontmp_.len = 0; colontmp_.p = NIM_NIL;
			i_3 = (NI)0;
			c_2 = (NIM_CHAR)0;
			T107_ = dotdot___stdZstrbasics_u48(v4StartPos_1, (addressStr_p0.len-1));
			colontmp_ = X5BX5D___pureZstrutils_u1291(addressStr_p0, T107_);
			if (NIM_UNLIKELY(*nimErr_)) goto LA106_;
			i_4 = ((NI)0);
			L_2 = colontmp_.len;
			{
				while (1) {
					if (!(i_4 < L_2)) goto LA109;
					i_3 = i_4;
					if (i_4 < 0 || i_4 >= colontmp_.len){ raiseIndexError2(i_4,colontmp_.len-1); goto LA106_;
					}
					c_2 = colontmp_.p->data[i_4];
					{
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_192;
						if (!(((NU8)(c_2)) >= ((NU8)(48)) && ((NU8)(c_2)) <= ((NU8)(57)))) goto LA112_;
						{
							tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T118_;
							if (!leadingZero_1) goto LA116_;
							T118_ = NIM_NIL;
							T118_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
							(*T118_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
							(*T118_).Sup.Sup.name = "ValueError";
							(*T118_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_191;
							(*T118_).Sup.Sup.parent = ((Exception*) NIM_NIL);
							raiseExceptionEx((Exception*)T118_, "ValueError", "parseIPv6Address", "net.nim", 438);
goto LA106_;
						}
LA116_: ;
						if (nimSubInt(((NU8)(c_2)), ((NI)48), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_192)) { raiseOverflow(); goto LA106_;
						};
						currentShort_1 = (NU32)((NU32)((NU32)((NU32)(currentShort_1) * (NU32)(((NU32)10)))) + (NU32)(((NU32) ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_192)))));
						{
							if (!(currentShort_1 == ((NU32)0))) goto LA121_;
							leadingZero_1 = NIM_TRUE;
						}
						goto LA119_;
LA121_: ;
						{
							tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T126_;
							if (!((NU32)(((NU32)255)) < (NU32)(currentShort_1))) goto LA124_;
							T126_ = NIM_NIL;
							T126_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
							(*T126_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
							(*T126_).Sup.Sup.name = "ValueError";
							(*T126_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_193;
							(*T126_).Sup.Sup.parent = ((Exception*) NIM_NIL);
							raiseExceptionEx((Exception*)T126_, "ValueError", "parseIPv6Address", "net.nim", 444);
goto LA106_;
						}
						goto LA119_;
LA124_: ;
LA119_: ;
						separatorValid_1 = NIM_TRUE;
					}
					goto LA110_;
LA112_: ;
					{
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_196;
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_197;
						NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_198;
						if (!((NU8)(c_2) == (NU8)(46))) goto LA128_;
						{
							NIM_BOOL T132_;
							tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T136_;
							T132_ = (NIM_BOOL)0;
							T132_ = !(separatorValid_1);
							if (T132_) goto LA133_;
							T132_ = (((NI)3) <= byteCount_1);
LA133_: ;
							if (!T132_) goto LA134_;
							T136_ = NIM_NIL;
							T136_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
							(*T136_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
							(*T136_).Sup.Sup.name = "ValueError";
							(*T136_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_194;
							(*T136_).Sup.Sup.parent = ((Exception*) NIM_NIL);
							raiseExceptionEx((Exception*)T136_, "ValueError", "parseIPv6Address", "net.nim", 449);
goto LA106_;
						}
LA134_: ;
						if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 						{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_195, dollar___pureZnet_u123(result.family)); goto LA106_;
						}
						if (nimMulInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_196)) { raiseOverflow(); goto LA106_;
						};
						if (nimAddInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_196), byteCount_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_197)) { raiseOverflow(); goto LA106_;
						};
						if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_197)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_197), 15); goto LA106_;
						}
						result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_197))- 0] = ((NU8) (currentShort_1));
						currentShort_1 = ((NU32)0);
						if (nimAddInt(byteCount_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_198)) { raiseOverflow(); goto LA106_;
						};
						byteCount_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_198);
						separatorValid_1 = NIM_FALSE;
						leadingZero_1 = NIM_FALSE;
					}
					goto LA110_;
LA128_: ;
					{
						tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T138_;
						T138_ = NIM_NIL;
						T138_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
						(*T138_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
						(*T138_).Sup.Sup.name = "ValueError";
						(*T138_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_199;
						(*T138_).Sup.Sup.parent = ((Exception*) NIM_NIL);
						raiseExceptionEx((Exception*)T138_, "ValueError", "parseIPv6Address", "net.nim", 456);
goto LA106_;
					}
LA110_: ;
					i_4 += ((NI)1);
					{
						if (!!((colontmp_.len == L_2))) goto LA141_;
						failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_200);
						if (NIM_UNLIKELY(*nimErr_)) goto LA106_;
					}
LA141_: ;
				} LA109: ;
			}
			{
				LA106_:;
			}
			{
				if (colontmp_.p && !(colontmp_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmp_.p);
}
			}
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		{
			NIM_BOOL T147_;
			tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T151_;
			T147_ = (NIM_BOOL)0;
			T147_ = !((byteCount_1 == ((NI)3)));
			if (T147_) goto LA148_;
			T147_ = !(separatorValid_1);
LA148_: ;
			if (!T147_) goto LA149_;
			T151_ = NIM_NIL;
			T151_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
			(*T151_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
			(*T151_).Sup.Sup.name = "ValueError";
			(*T151_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_201;
			(*T151_).Sup.Sup.parent = ((Exception*) NIM_NIL);
			raiseExceptionEx((Exception*)T151_, "ValueError", "parseIPv6Address", "net.nim", 460);
goto BeforeRet_;
		}
LA149_: ;
		if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 		{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_202, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
		}
		if (nimMulInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_203)) { raiseOverflow(); goto BeforeRet_;
		};
		if (nimAddInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_203), byteCount_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_204)) { raiseOverflow(); goto BeforeRet_;
		};
		if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_204)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_204), 15); goto BeforeRet_;
		}
		result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_204))- 0] = ((NU8) (currentShort_1));
		if (nimAddInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_205)) { raiseOverflow(); goto BeforeRet_;
		};
		groupCount_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_205);
	}
LA91_: ;
	{
		tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T156_;
		if (!(((NI)8) < groupCount_1)) goto LA154_;
		T156_ = NIM_NIL;
		T156_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
		(*T156_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
		(*T156_).Sup.Sup.name = "ValueError";
		(*T156_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_206;
		(*T156_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T156_, "ValueError", "parseIPv6Address", "net.nim", 466);
goto BeforeRet_;
	}
	goto LA152_;
LA154_: ;
	{
		NI toFill_1;
		NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_209;
		NI toShift_1;
		NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_210;
		if (!(groupCount_1 < ((NI)8))) goto LA158_;
		{
			tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T164_;
			if (!(dualColonGroup_1 == ((NI)-1))) goto LA162_;
			T164_ = NIM_NIL;
			T164_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
			(*T164_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
			(*T164_).Sup.Sup.name = "ValueError";
			(*T164_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_208;
			(*T164_).Sup.Sup.parent = ((Exception*) NIM_NIL);
			raiseExceptionEx((Exception*)T164_, "ValueError", "parseIPv6Address", "net.nim", 470);
goto BeforeRet_;
		}
LA162_: ;
		if (nimSubInt(((NI)8), groupCount_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_209)) { raiseOverflow(); goto BeforeRet_;
		};
		toFill_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_209);
		if (nimSubInt(groupCount_1, dualColonGroup_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_210)) { raiseOverflow(); goto BeforeRet_;
		};
		toShift_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_210);
		{
			NI i_5;
			NI colontmp__2;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_211;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_212;
			NI res_1;
			i_5 = (NI)0;
			colontmp__2 = (NI)0;
			if (nimMulInt(((NI)2), toShift_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_211)) { raiseOverflow(); goto BeforeRet_;
			};
			if (nimSubInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_211), ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_212)) { raiseOverflow(); goto BeforeRet_;
			};
			colontmp__2 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_212);
			res_1 = ((NI)0);
			{
				while (1) {
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_214;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_216;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_217;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_218;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_219;
					if (!(res_1 <= colontmp__2)) goto LA167;
					i_5 = ((NI) (res_1));
					if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 					{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_213, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
					}
					if (nimSubInt(((NI)15), i_5, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_214)) { raiseOverflow(); goto BeforeRet_;
					};
					if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_214)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_214), 15); goto BeforeRet_;
					}
					if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 					{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_215, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
					}
					if (nimMulInt(groupCount_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_216)) { raiseOverflow(); goto BeforeRet_;
					};
					if (nimSubInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_216), i_5, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_217)) { raiseOverflow(); goto BeforeRet_;
					};
					if (nimSubInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_217), ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_218)) { raiseOverflow(); goto BeforeRet_;
					};
					if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_218)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_218), 15); goto BeforeRet_;
					}
					result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_214))- 0] = result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_218))- 0];
					if (nimAddInt(res_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_219)) { raiseOverflow(); goto BeforeRet_;
					};
					res_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_219);
				} LA167: ;
			}
		}
		{
			NI i_6;
			NI colontmp__3;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_220;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_221;
			NI res_2;
			i_6 = (NI)0;
			colontmp__3 = (NI)0;
			if (nimMulInt(((NI)2), toFill_1, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_220)) { raiseOverflow(); goto BeforeRet_;
			};
			if (nimSubInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_220), ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_221)) { raiseOverflow(); goto BeforeRet_;
			};
			colontmp__3 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_221);
			res_2 = ((NI)0);
			{
				while (1) {
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_223;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_224;
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_225;
					if (!(res_2 <= colontmp__3)) goto LA170;
					i_6 = ((NI) (res_2));
					if (!(((1 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 					{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_222, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
					}
					if (nimMulInt(dualColonGroup_1, ((NI)2), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_223)) { raiseOverflow(); goto BeforeRet_;
					};
					if (nimAddInt((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_223), i_6, &TM__XqsrSBxhOTPgLQ9cX4MmV4A_224)) { raiseOverflow(); goto BeforeRet_;
					};
					if ((NU)((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_224)) > (NU)(15)){ raiseIndexError2((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_224), 15); goto BeforeRet_;
					}
					result._family_1.address_v6[((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_224))- 0] = ((NU8)0);
					if (nimAddInt(res_2, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_225)) { raiseOverflow(); goto BeforeRet_;
					};
					res_2 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_225);
				} LA170: ;
			}
		}
	}
	goto LA152_;
LA158_: ;
	{
		tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T174_;
		if (!!((dualColonGroup_1 == ((NI)-1)))) goto LA172_;
		T174_ = NIM_NIL;
		T174_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
		(*T174_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
		(*T174_).Sup.Sup.name = "ValueError";
		(*T174_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_226;
		(*T174_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T174_, "ValueError", "parseIPv6Address", "net.nim", 479);
goto BeforeRet_;
	}
	goto LA152_;
LA172_: ;
LA152_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ, parseIPv4Address__pureZnet_u564)(NimStringV2 addressStr_p0) {
	tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ result;
	NI byteCount_1;
	NU16 currentByte_1;
	NIM_BOOL separatorValid_1;
	NIM_BOOL leadingZero_1;
{	byteCount_1 = ((NI)0);
	currentByte_1 = ((NU16)0);
	separatorValid_1 = NIM_FALSE;
	leadingZero_1 = NIM_FALSE;
	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ));
	result.family = ((tyEnum_IpAddressFamily__rr9aSITM5JOoO0eq3DvCO6Q)1);
	nimZeroMem((void*)result._family_2.address_v4, sizeof(tyArray__ZphrDPKIBlVgF9aQajgV8qQ));
	{
		NI i_1;
		NI colontmp_;
		NI res_1;
		i_1 = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = (addressStr_p0.len-1);
		res_1 = ((NI)0);
		{
			while (1) {
				NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_236;
				if (!(res_1 <= colontmp_)) goto LA3;
				i_1 = ((NI) (res_1));
				{
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_229;
					if (i_1 < 0 || i_1 >= addressStr_p0.len){ raiseIndexError2(i_1,addressStr_p0.len-1); goto BeforeRet_;
					}
					if (!(((NU8)(addressStr_p0.p->data[i_1])) >= ((NU8)(48)) && ((NU8)(addressStr_p0.p->data[i_1])) <= ((NU8)(57)))) goto LA6_;
					{
						tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T12_;
						if (!leadingZero_1) goto LA10_;
						T12_ = NIM_NIL;
						T12_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
						(*T12_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
						(*T12_).Sup.Sup.name = "ValueError";
						(*T12_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_228;
						(*T12_).Sup.Sup.parent = ((Exception*) NIM_NIL);
						raiseExceptionEx((Exception*)T12_, "ValueError", "parseIPv4Address", "net.nim", 327);
goto BeforeRet_;
					}
LA10_: ;
					if (i_1 < 0 || i_1 >= addressStr_p0.len){ raiseIndexError2(i_1,addressStr_p0.len-1); goto BeforeRet_;
					}
					if (nimSubInt(((NU8)(addressStr_p0.p->data[i_1])), ((NI)48), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_229)) { raiseOverflow(); goto BeforeRet_;
					};
					currentByte_1 = (NU16)((NU16)((NU16)((NU16)(currentByte_1) * (NU16)(((NU16)10)))) + (NU16)(((NU16) ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_229)))));
					{
						if (!(currentByte_1 == ((NU16)0))) goto LA15_;
						leadingZero_1 = NIM_TRUE;
					}
					goto LA13_;
LA15_: ;
					{
						tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T20_;
						if (!((NU16)(((NU16)255)) < (NU16)(currentByte_1))) goto LA18_;
						T20_ = NIM_NIL;
						T20_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
						(*T20_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
						(*T20_).Sup.Sup.name = "ValueError";
						(*T20_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_230;
						(*T20_).Sup.Sup.parent = ((Exception*) NIM_NIL);
						raiseExceptionEx((Exception*)T20_, "ValueError", "parseIPv4Address", "net.nim", 334);
goto BeforeRet_;
					}
					goto LA13_;
LA18_: ;
LA13_: ;
					separatorValid_1 = NIM_TRUE;
				}
				goto LA4_;
LA6_: ;
				{
					NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_234;
					if (i_1 < 0 || i_1 >= addressStr_p0.len){ raiseIndexError2(i_1,addressStr_p0.len-1); goto BeforeRet_;
					}
					if (!((NU8)(addressStr_p0.p->data[i_1]) == (NU8)(46))) goto LA22_;
					{
						NIM_BOOL T26_;
						tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T30_;
						T26_ = (NIM_BOOL)0;
						T26_ = !(separatorValid_1);
						if (T26_) goto LA27_;
						T26_ = (((NI)3) <= byteCount_1);
LA27_: ;
						if (!T26_) goto LA28_;
						T30_ = NIM_NIL;
						T30_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
						(*T30_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
						(*T30_).Sup.Sup.name = "ValueError";
						(*T30_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_231;
						(*T30_).Sup.Sup.parent = ((Exception*) NIM_NIL);
						raiseExceptionEx((Exception*)T30_, "ValueError", "parseIPv4Address", "net.nim", 339);
goto BeforeRet_;
					}
LA28_: ;
					if (!(((2 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 					{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_233, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
					}
					if ((NU)(byteCount_1) > (NU)(3)){ raiseIndexError2(byteCount_1, 3); goto BeforeRet_;
					}
					result._family_2.address_v4[(byteCount_1)- 0] = ((NU8) (currentByte_1));
					currentByte_1 = ((NU16)0);
					if (nimAddInt(byteCount_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_234)) { raiseOverflow(); goto BeforeRet_;
					};
					byteCount_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_234);
					separatorValid_1 = NIM_FALSE;
					leadingZero_1 = NIM_FALSE;
				}
				goto LA4_;
LA22_: ;
				{
					tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T32_;
					T32_ = NIM_NIL;
					T32_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
					(*T32_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
					(*T32_).Sup.Sup.name = "ValueError";
					(*T32_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_235;
					(*T32_).Sup.Sup.parent = ((Exception*) NIM_NIL);
					raiseExceptionEx((Exception*)T32_, "ValueError", "parseIPv4Address", "net.nim", 347);
goto BeforeRet_;
				}
LA4_: ;
				if (nimAddInt(res_1, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_236)) { raiseOverflow(); goto BeforeRet_;
				};
				res_1 = (NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_236);
			} LA3: ;
		}
	}
	{
		NIM_BOOL T35_;
		tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T39_;
		T35_ = (NIM_BOOL)0;
		T35_ = !((byteCount_1 == ((NI)3)));
		if (T35_) goto LA36_;
		T35_ = !(separatorValid_1);
LA36_: ;
		if (!T35_) goto LA37_;
		T39_ = NIM_NIL;
		T39_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
		(*T39_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
		(*T39_).Sup.Sup.name = "ValueError";
		(*T39_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_237;
		(*T39_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T39_, "ValueError", "parseIPv4Address", "net.nim", 351);
goto BeforeRet_;
	}
LA37_: ;
	if (!(((2 &((NU8)1<<((NU)((result.family))&7U)))!=0))) 	{ raiseFieldErrorStr(TM__XqsrSBxhOTPgLQ9cX4MmV4A_238, dollar___pureZnet_u123(result.family)); goto BeforeRet_;
	}
	if ((NU)(byteCount_1) > (NU)(3)){ raiseIndexError2(byteCount_1, 3); goto BeforeRet_;
	}
	result._family_2.address_v4[(byteCount_1)- 0] = ((NU8) (currentByte_1));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ, parseIpAddress__pureZnet_u821)(NimStringV2 addressStr_p0) {
	tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ));
	{
		tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw* T5_;
		if (!(addressStr_p0.len == ((NI)0))) goto LA3_;
		T5_ = NIM_NIL;
		T5_ = (tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw*) nimNewObj(sizeof(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw), NIM_ALIGNOF(tyObject_ValueError__YUzEEs8pGqG7cYmcRoc5rw));
		(*T5_).Sup.Sup.Sup.m_type = (&NTIv2__YUzEEs8pGqG7cYmcRoc5rw_);
		(*T5_).Sup.Sup.name = "ValueError";
		(*T5_).Sup.Sup.message = TM__XqsrSBxhOTPgLQ9cX4MmV4A_140;
		(*T5_).Sup.Sup.parent = ((Exception*) NIM_NIL);
		raiseExceptionEx((Exception*)T5_, "ValueError", "parseIpAddress", "net.nim", 491);
goto BeforeRet_;
	}
LA3_: ;
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = contains__stdZprivateZospaths2_u380(((addressStr_p0).p) ? (addressStr_p0.p->data) : NIM_NIL, addressStr_p0.len, 58);
		if (!T8_) goto LA9_;
		result = parseIPv6Address__pureZnet_u663(addressStr_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		goto BeforeRet_;
	}
	goto LA6_;
LA9_: ;
	{
		result = parseIPv4Address__pureZnet_u564(addressStr_p0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		goto BeforeRet_;
	}
LA6_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, isObjDisplayCheck)(TNimTypeV2* source_p0, NI16 targetDepth_p1, NU32 token_p2) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	T1_ = (NIM_BOOL)0;
	T1_ = (targetDepth_p1 <= (*source_p0).depth);
	if (!(T1_)) goto LA2_;
	T1_ = ((*source_p0).display[targetDepth_p1] == token_p2);
LA2_: ;
	result = T1_;
	return result;
}
static N_INLINE(Exception*, nimBorrowCurrentException)(void) {
	Exception* result;
	result = currException__system_u3686;
	return result;
}
static N_INLINE(void, popCurrentException)(void) {
	eqcopy___system_u3719(&currException__system_u3686, (*currException__system_u3686).up, NIM_FALSE);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isIpAddress__pureZnet_u829)(NimStringV2 addressStr_p0) {
	NIM_BOOL result;
	tyObject_IpAddress__0qNDFv466WMurEtOepEqFQ T2_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	T2_ = parseIpAddress__pureZnet_u821(addressStr_p0);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	(void)(T2_);
	if (NIM_UNLIKELY(*nimErr_)) {
		LA1_:;
		if (isObjDisplayCheck(nimBorrowCurrentException()->Sup.m_type, 3, 1287918080)) {
			*nimErr_ = NIM_FALSE;
			result = NIM_FALSE;
			popCurrentException();
			goto BeforeRet_;
			popCurrentException();
			LA4_:;
		}
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	result = NIM_TRUE;
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, checkCertName__pureZnet_u1784)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NimStringV2 hostname_p1) {
	tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* certificate_1;
	tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg* T6_;
	int match_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		if (!!((*socket_p0).isSsl)) goto LA3_;
		failedAssertImpl__stdZassertions_u95(TM__XqsrSBxhOTPgLQ9cX4MmV4A_240);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	T6_ = (tyObject_SslStruct__nrXQY5VF6Ld9c2BdIxvNUmg*)0;
	T6_ = SSL_get_peer_certificate__wrappersZopenssl_u814((*socket_p0).sslHandle);
	if (NIM_UNLIKELY(*nimErr_)) goto LA5_;
	certificate_1 = T6_;
	{
		if (!(certificate_1 == 0)) goto LA9_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_242);
		if (NIM_UNLIKELY(*nimErr_)) goto LA5_;
	}
LA9_: ;
	if ((hostname_p1.len) < ((int)(-2147483647 -1)) || (hostname_p1.len) > ((int)2147483647)){ raiseRangeErrorI(hostname_p1.len, ((int)(-2147483647 -1)), ((int)2147483647)); goto LA5_;
	}
	match_1 = X509_check_host(certificate_1, nimToCStringConv(hostname_p1), ((int) (hostname_p1.len)), ((unsigned int)1), ((NCSTRING) NIM_NIL));
	X509_free(certificate_1);
	{
		if (!!((match_1 == ((NI32)1)))) goto LA13_;
		raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_244);
		if (NIM_UNLIKELY(*nimErr_)) goto LA5_;
	}
LA13_: ;
	if (NIM_UNLIKELY(*nimErr_)) {
		LA5_:;
		if (isObjDisplayCheck(nimBorrowCurrentException()->Sup.m_type, 4, 3595066368)) {
			*nimErr_ = NIM_FALSE;
			raiseSSLError__pureZnet_u857(TM__XqsrSBxhOTPgLQ9cX4MmV4A_246);
			if (NIM_UNLIKELY(*nimErr_)) goto LA16_;
			popCurrentException();
			LA16_:;
		}
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, wrapConnectedSocket__pureZnet_u1798)(tyObject_SslContextcolonObjectType___AhFePg9cWdCpCeTypFfYs7A* ctx_p0, tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p1, tyEnum_SslHandshakeType__RgoNg67zPremT9a0QqPHgWQ handshake_p2, NimStringV2 hostname_p3) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	wrapSocket__pureZnet_u1772(ctx_p0, socket_p1);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	switch (handshake_p2) {
	case ((tyEnum_SslHandshakeType__RgoNg67zPremT9a0QqPHgWQ)0):
	{
		int ret_1;
		tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w T10_;
		{
			NIM_BOOL T4_;
			NIM_BOOL T6_;
			NI T9_;
			T4_ = (NIM_BOOL)0;
			T4_ = (((NI)0) < hostname_p3.len);
			if (!(T4_)) goto LA5_;
			T6_ = (NIM_BOOL)0;
			T6_ = isIpAddress__pureZnet_u829(hostname_p3);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			T4_ = !(T6_);
LA5_: ;
			if (!T4_) goto LA7_;
			T9_ = (NI)0;
			T9_ = SSL_set_tlsext_host_name__wrappersZopenssl_u427((*socket_p1).sslHandle, nimToCStringConv(hostname_p3));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			(void)(T9_);
		}
LA7_: ;
		ERR_clear_error();
		ret_1 = SSL_connect((*socket_p1).sslHandle);
		T10_ = 0;
		socketError__pureZnet_u175(socket_p1, ((NI) (ret_1)), NIM_FALSE, ((NI32)-1), T10_);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		{
			NIM_BOOL T13_;
			NIM_BOOL T15_;
			T13_ = (NIM_BOOL)0;
			T13_ = (((NI)0) < hostname_p3.len);
			if (!(T13_)) goto LA14_;
			T15_ = (NIM_BOOL)0;
			T15_ = isIpAddress__pureZnet_u829(hostname_p3);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			T13_ = !(T15_);
LA14_: ;
			if (!T13_) goto LA16_;
			checkCertName__pureZnet_u1784(socket_p1, hostname_p3);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
LA16_: ;
	}
	break;
	case ((tyEnum_SslHandshakeType__RgoNg67zPremT9a0QqPHgWQ)1):
	{
		int ret_2;
		tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w T19_;
		ERR_clear_error();
		ret_2 = SSL_accept((*socket_p1).sslHandle);
		T19_ = 0;
		socketError__pureZnet_u175(socket_p1, ((NI) (ret_2)), NIM_FALSE, ((NI32)-1), T19_);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	default: __builtin_unreachable();
	}
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI, peekChar__pureZnet_u2218)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NIM_CHAR* c_p1) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (!(*socket_p0).isBuffered) goto LA3_;
		result = ((NI)1);
		{
			NIM_BOOL T7_;
			NI TM__XqsrSBxhOTPgLQ9cX4MmV4A_251;
			NI res_1;
			T7_ = (NIM_BOOL)0;
			T7_ = ((*socket_p0).bufLen == ((NI)0));
			if (T7_) goto LA8_;
			if (nimSubInt((*socket_p0).bufLen, ((NI)1), &TM__XqsrSBxhOTPgLQ9cX4MmV4A_251)) { raiseOverflow(); goto BeforeRet_;
			};
			T7_ = ((NI)(TM__XqsrSBxhOTPgLQ9cX4MmV4A_251) < (*socket_p0).currPos);
LA8_: ;
			if (!T7_) goto LA9_;
			res_1 = readIntoBuf__pureZnet_u2027(socket_p0, ((NI32)0));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				if (!(res_1 <= ((NI)0))) goto LA13_;
				result = res_1;
			}
LA13_: ;
		}
LA9_: ;
		if ((NU)((*socket_p0).currPos) > (NU)(4000)){ raiseIndexError2((*socket_p0).currPos, 4000); goto BeforeRet_;
		}
		(*c_p1) = (*socket_p0).buffer[((*socket_p0).currPos)- 0];
	}
	goto LA1_;
LA3_: ;
	{
		{
			if (!(*socket_p0).isSsl) goto LA18_;
			{
				tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* T24_;
				if (!!((*socket_p0).sslHasPeekChar)) goto LA22_;
				T24_ = NIM_NIL;
				T24_ = socket_p0;
				result = uniRecv__pureZnet_u2016(T24_, ((void*) ((&(*socket_p0).sslPeekChar))), ((int)1), ((NI32)0));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				(*socket_p0).sslHasPeekChar = NIM_TRUE;
			}
LA22_: ;
			(*c_p1) = (*socket_p0).sslPeekChar;
			goto BeforeRet_;
		}
LA18_: ;
		result = recv((*socket_p0).fd, ((void*) (c_p1)), ((NI)1), MSG_PEEK);
	}
LA1_: ;
	}BeforeRet_: ;
	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(void, readLine__pureZnet_u2223)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NimStringV2* line_p1, NI timeout_p2, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p3, NI maxLength_p4) {
	tyObject_Duration__IhPGomXjacpk8ChnxqMuoA waited_1;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&waited_1), sizeof(tyObject_Duration__IhPGomXjacpk8ChnxqMuoA));
	setLengthStrV2((&(*line_p1)), ((NI)0));
	{
		while (1) {
			NIM_CHAR c_1;
			NI T3_;
			NI n_1;
			c_1 = (NIM_CHAR)0;
			T3_ = (NI)0;
			T3_ = waitFor__pureZnet_u2102(socket_p0, (&waited_1), timeout_p2, ((NI)1), TM__XqsrSBxhOTPgLQ9cX4MmV4A_249);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			(void)(T3_);
			n_1 = recv__pureZnet_u2076(socket_p0, ((void*) ((&c_1))), ((NI)1));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				NI32 lastError_1;
				if (!(n_1 < ((NI)0))) goto LA6_;
				lastError_1 = getSocketError__pureZnet_u1878(socket_p0);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T10_;
					T10_ = (NIM_BOOL)0;
					T10_ = isDisconnectionError__pureZnet_u181(flags_p3, lastError_1);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (!T10_) goto LA11_;
					setLengthStrV2((&(*line_p1)), ((NI)0));
				}
LA11_: ;
				socketError__pureZnet_u175(socket_p0, n_1, NIM_FALSE, lastError_1, flags_p3);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				goto BeforeRet_;
			}
			goto LA4_;
LA6_: ;
			{
				if (!(n_1 == ((NI)0))) goto LA14_;
				setLengthStrV2((&(*line_p1)), ((NI)0));
				goto BeforeRet_;
			}
			goto LA4_;
LA14_: ;
LA4_: ;
			{
				NI T20_;
				if (!((NU8)(c_1) == (NU8)(13))) goto LA18_;
				T20_ = (NI)0;
				T20_ = waitFor__pureZnet_u2102(socket_p0, (&waited_1), timeout_p2, ((NI)1), TM__XqsrSBxhOTPgLQ9cX4MmV4A_250);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				(void)(T20_);
				n_1 = peekChar__pureZnet_u2218(socket_p0, (&c_1));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T23_;
					NI T27_;
					T23_ = (NIM_BOOL)0;
					T23_ = (((NI)0) < n_1);
					if (!(T23_)) goto LA24_;
					T23_ = ((NU8)(c_1) == (NU8)(10));
LA24_: ;
					if (!T23_) goto LA25_;
					T27_ = (NI)0;
					T27_ = recv__pureZnet_u2076(socket_p0, ((void*) ((&c_1))), ((NI)1));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					(void)(T27_);
				}
				goto LA21_;
LA25_: ;
				{
					NI32 lastError_2;
					if (!(n_1 <= ((NI)0))) goto LA29_;
					lastError_2 = getSocketError__pureZnet_u1878(socket_p0);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					{
						NIM_BOOL T33_;
						T33_ = (NIM_BOOL)0;
						T33_ = isDisconnectionError__pureZnet_u181(flags_p3, lastError_2);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						if (!T33_) goto LA34_;
						setLengthStrV2((&(*line_p1)), ((NI)0));
					}
LA34_: ;
					socketError__pureZnet_u175(socket_p0, n_1, NIM_FALSE, lastError_2, flags_p3);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					goto BeforeRet_;
				}
				goto LA21_;
LA29_: ;
LA21_: ;
				{
					if (!((*line_p1).len == ((NI)0))) goto LA38_;
					prepareAdd((&(*line_p1)), 2);
appendString((&(*line_p1)), TM__XqsrSBxhOTPgLQ9cX4MmV4A_253);
				}
LA38_: ;
				goto BeforeRet_;
			}
			goto LA16_;
LA18_: ;
			{
				if (!((NU8)(c_1) == (NU8)(10))) goto LA41_;
				{
					if (!((*line_p1).len == ((NI)0))) goto LA45_;
					prepareAdd((&(*line_p1)), 2);
appendString((&(*line_p1)), TM__XqsrSBxhOTPgLQ9cX4MmV4A_254);
				}
LA45_: ;
				goto BeforeRet_;
			}
			goto LA16_;
LA41_: ;
LA16_: ;
			nimAddCharV1((&(*line_p1)), c_1);
			{
				if (!(maxLength_p4 < (*line_p1).len)) goto LA49_;
				goto LA1;
			}
LA49_: ;
		}
	} LA1: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, recvLine__pureZnet_u2240)(tyObject_SocketImpl__TmGWJPpyEwcsRMnCyN509ag* socket_p0, NI timeout_p1, tySet_tyEnum_SocketFlag__rHOG5kQY7JytAyg5qMPU8w flags_p2, NI maxLength_p3) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = TM__XqsrSBxhOTPgLQ9cX4MmV4A_247;
	readLine__pureZnet_u2223(socket_p0, (&result), timeout_p1, flags_p2, maxLength_p3);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
