/* Generated by Nim Compiler v1.3.5 */
/*   (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64

/* section: NIM_merge_HEADERS */

#include "nimbase.h"
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix

/* section: NIM_merge_FRAME_DEFINES */
#define nimfr_(x, y)
#define nimln_(x, y)

/* section: NIM_merge_FORWARD_TYPES */
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w;
typedef struct tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw;
typedef struct tyObject_HashSet__bGAilYs5sUICRbD13gZaFg tyObject_HashSet__bGAilYs5sUICRbD13gZaFg;
typedef struct tySequence__8Np6tlClE5az1CyqZdN19bQ tySequence__8Np6tlClE5az1CyqZdN19bQ;
typedef struct tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct RootObj RootObj;
typedef struct tyTuple__UV3llMMYFckfui8YMBuUZA tyTuple__UV3llMMYFckfui8YMBuUZA;
typedef struct tyTuple__JfHvHzMrhKkWAUvQKe0i1A tyTuple__JfHvHzMrhKkWAUvQKe0i1A;
typedef struct tyObject_Env_netdotnim___diB2NTuAIWY0FO9c5IUJRGg tyObject_Env_netdotnim___diB2NTuAIWY0FO9c5IUJRGg;
typedef struct tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ;
typedef struct tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA;
typedef struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA;
typedef struct Exception Exception;
typedef struct tySequence__uB9b75OUPRENsBAu4AnoePA tySequence__uB9b75OUPRENsBAu4AnoePA;
typedef struct tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ;
typedef struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw;
typedef struct tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA;
typedef struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw;
typedef struct tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA;
typedef struct tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw;
typedef struct tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og;
typedef struct tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w;
typedef struct tySequence__9apztJSmgERYU8fZOjI4pOg tySequence__9apztJSmgERYU8fZOjI4pOg;
typedef struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ;
typedef struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA;

/* section: NIM_merge_TYPES */
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef N_CDECL_PTR(void, tyProc__ln4kdL5W9bbX4a1xl8nnVXQ) (void);
struct tyObject_HashSet__bGAilYs5sUICRbD13gZaFg {
tySequence__8Np6tlClE5az1CyqZdN19bQ* data;
NI counter;
};
struct tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w {
tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* context;
tyObject_HashSet__bGAilYs5sUICRbD13gZaFg referencedData;
tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ* extraInternal;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct RootObj {
TNimType* m_type;
};
typedef struct {
N_NIMCALL_PTR(NimStringDesc*, ClP_0) (NimStringDesc* identity, void* ClE_0);
void* ClE_0;
} tyProc__oFHfEKFsiYTMAy9a42cSiKw;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (NimStringDesc* hint, tyTuple__UV3llMMYFckfui8YMBuUZA* Result, void* ClE_0);
void* ClE_0;
} tyProc__lYMtBEH0vEMRzoDaCw5CJg;
struct tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ {
  RootObj Sup;
tyProc__oFHfEKFsiYTMAy9a42cSiKw serverGetPskFunc;
tyProc__lYMtBEH0vEMRzoDaCw5CJg clientGetPskFunc;
};
struct tyTuple__JfHvHzMrhKkWAUvQKe0i1A {
void* Field0;
tyObject_Env_netdotnim___diB2NTuAIWY0FO9c5IUJRGg* Field1;
};
typedef NU8 tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg;
typedef NIM_CHAR tyArray__QQGLPNVVwLhYjkngqAxXQQ[4001];
typedef NU8 tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg;
typedef NU8 tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw;
typedef NU8 tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg;
struct tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ {
int fd;
NIM_BOOL isBuffered;
tyArray__QQGLPNVVwLhYjkngqAxXQQ buffer;
NI currPos;
NI bufLen;
NIM_BOOL isSsl;
tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* sslHandle;
tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* sslContext;
NIM_BOOL sslNoHandshake;
NIM_BOOL sslHasPeekChar;
NIM_CHAR sslPeekChar;
NIM_BOOL sslNoShutdown;
NI32 lastError;
tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg domain;
tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw sockType;
tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg protocol;
};
typedef N_CDECL_PTR(int, tyProc__Vff1ipOwDPDGknaRJAdXjA) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ssl);
typedef N_CDECL_PTR(int, tyProc__kxUw9cdxJbPtv0iPyoSbDBQ) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* s, int ret_code);
typedef NU8 tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg;
struct Exception {
  RootObj Sup;
Exception* parent;
NCSTRING name;
NimStringDesc* message;
tySequence__uB9b75OUPRENsBAu4AnoePA* trace;
Exception* up;
};
struct tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA {
  Exception Sup;
};
struct tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
typedef N_CDECL_PTR(unsigned long, tyProc__wCuLyuC5VitcgJKGCqJQRw) (void);
typedef N_CDECL_PTR(NCSTRING, tyProc__5zMKCPIiPHTYY9cjyzsHlmQ) (unsigned long e, NCSTRING buf);
typedef N_CDECL_PTR(void, tyProc__e47RoMUolEGMiUlfiZt9abQ) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ssl);
struct tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw {
char dummy;
};
typedef int tyArray__7t2L64rS85OOrWyPjk9cdYA[31];
struct tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ {
tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg val;
NIM_BOOL has;
};
struct tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
typedef NU8 tyEnum_SslHandshakeType__9aZhh5f9bRDKgYB8GLASDSqg;
typedef N_CDECL_PTR(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw*, tyProc__Rqjya8uauy9aPcyfGamaSrg) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* context);
typedef NU8 tyEnum_IpAddressFamily__iqqacz9cr9bcNjYY74E10wPA;
typedef NU8 tyArray__qtqsWM5aXmcpMIVmvq3kAA[16];
typedef NU8 tyArray__H8qf9bpC2ziYA2earmO8m7w[4];
struct tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA {
tyEnum_IpAddressFamily__iqqacz9cr9bcNjYY74E10wPA family;
union{
struct {tyArray__qtqsWM5aXmcpMIVmvq3kAA address_v6;
} _family_1;
struct {tyArray__H8qf9bpC2ziYA2earmO8m7w address_v4;
} _family_2;
};
};
struct tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
struct tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA {
NI a;
NI b;
};
typedef N_CDECL_PTR(int, tyProc__sG7rgqmtlgBaumPwwN3BfQ) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ssl, NCSTRING buf, NI num);
struct tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw {
NI64 seconds;
NI nanosecond;
};
struct tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og {
  tyObject_CatchableError__qrLSDoe2oBoAqNtJ9badtnA Sup;
};
struct tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w {
NI64 ticks;
};
typedef N_CDECL_PTR(int, tyProc__09aW01hZ1tSPafLaWVpBcXA) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ssl, void* buf, NI num);
typedef NU8 tyEnum_SslProtVersion__zq9bkhgPAE6ngdz7HLdOTDw;
typedef NU8 tyEnum_SslCVerifyMode__t9a9cuHiKUd7w4o8XPQAbfJg;
typedef N_CDECL_PTR(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw*, tyProc__HXibadfWHwHwyhCwpIRD2A) (void);
typedef N_CDECL_PTR(int, tyProc__2PA7CxitARKs0jpUW1gQ0g) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* s, NCSTRING ciphers);
typedef N_CDECL_PTR(long, tyProc__JfY9aCDiBh9bgOEieo8Vltxg) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, int cmd, long larg, void* parg);
typedef N_CDECL_PTR(NI, tyProc__aF4y9aPKIi8D4VGrVvX011Q) (NI a, void* b);
typedef N_CDECL_PTR(void, tyProc__H5wL7jexPlRA7WCw9cqLm0A) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* s, NI mode, tyProc__aF4y9aPKIi8D4VGrVvX011Q cb);
typedef N_STDCALL_PTR(int, tyProc__tYatIIo0oRSB9bjHLep7yhQ) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, NCSTRING filename);
typedef N_CDECL_PTR(int, tyProc__xjxKRHVZXDqdWXw9bunoZ3w) (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, NCSTRING filename, int typ);
struct tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ {
NI Field0;
NI Field1;
};
struct tyTuple__UV3llMMYFckfui8YMBuUZA {
NimStringDesc* Field0;
NimStringDesc* Field1;
};
struct tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA {
NCSTRING procname;
NI line;
NCSTRING filename;
};
typedef NIM_CHAR tyArray__dTlC27m9c9aWd5dvuePYanug[256];

/* section: NIM_merge_SEQ_TYPES */
struct tySequence__9apztJSmgERYU8fZOjI4pOg {
  TGenericSeq Sup;
  int data[SEQ_DECL_SIZE];
};
struct tySequence__8Np6tlClE5az1CyqZdN19bQ {
  TGenericSeq Sup;
  tyTuple__1v9bKyksXWMsm0vNwmZ4EuQ data[SEQ_DECL_SIZE];
};
struct tySequence__uB9b75OUPRENsBAu4AnoePA {
  TGenericSeq Sup;
  tyObject_StackTraceEntry__oLyohQ7O2XOvGnflOss8EA data[SEQ_DECL_SIZE];
};

/* section: NIM_merge_PROC_HEADERS */
N_LIB_PRIVATE N_NIMCALL(void, CRYPTO_malloc_init__G2BDIxFj2W9ajANxAoi8oZA)(void);
N_LIB_PRIVATE N_NIMCALL(int, SSL_library_init__6SfBfS64wp6JZihQGGrnKg)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
N_LIB_PRIVATE N_NIMCALL(void, SSL_load_error_strings__G2BDIxFj2W9ajANxAoi8oZA_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, OpenSSL_add_all_algorithms__G2BDIxFj2W9ajANxAoi8oZA_3)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, Marker_tyRef__t2PQ49cw9cyPD5BKolxzFbTw)(void* p, NI op);
static N_NIMCALL(void, Marker_tyRef__LP7l6kWJNPJLySYXWH5AYA)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(int, SSL_in_init__loUCLHAKQg9cZwis5tAb2ig)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ssl);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
N_LIB_PRIVATE N_NOINLINE(void, raiseOSError__CWyPYlyH9a6rAuZckFyVxPA)(NI32 errorCode, NimStringDesc* additionalInfo);
N_LIB_PRIVATE N_NIMCALL(NI32, osLastError__9bUWNxbcGnToMWA9b79aTXLIw)(void);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDisconnectionError__XxybNfLJKXhPAkMhmPhNzQ)(tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags, NI32 lastError);
N_LIB_PRIVATE N_NIMCALL(void, socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NI err, NIM_BOOL async, NI32 lastError, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags);
N_LIB_PRIVATE N_NIMCALL(void, raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g)(NimStringDesc* s);
static N_NIMCALL(void, Marker_tyRef__VoScTqHOwyXBt9b3u4T1Ksw)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src);
N_LIB_PRIVATE N_NIMCALL(void, raiseExceptionEx)(Exception* e, NCSTRING ename, NCSTRING procname, NCSTRING filename, NI line);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, cstrToNimstr)(NCSTRING str);
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src);
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, resizeString)(NimStringDesc* dest, NI addlen);
N_LIB_PRIVATE N_NIMCALL(NI32, getSocketError__YATB019buW9cFOjCCZLlKipQ)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket);
N_LIB_PRIVATE N_NIMCALL(void, close__8c1w8B7fpSuB4Dgr5LHVJA)(int socket);
N_LIB_PRIVATE N_NIMCALL(tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw, toSockType__6alUTTXG6jHTyH82e9a1JDw)(tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg protocol);
N_LIB_PRIVATE N_NIMCALL(struct addrinfo*, getAddrInfo__ANf7QnbfE8nyIlFuWroDcQ)(NimStringDesc* address, NU16 port, tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg domain, tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw sockType, tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg protocol);
N_LIB_PRIVATE N_NIMCALL(tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ, toKnownDomain__RQ9bFvLg4dpjf7aRPA8ID9bg)(int family);
static N_INLINE(NIM_BOOL, isNone__H87Mp4Y2b9aVoDHbyPXjVtAoptions)(tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ self);
static N_INLINE(tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg*, unsafeGet__CX9cpSVl0CsECjiCYrAMm9bAoptions)(tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ* self);
N_LIB_PRIVATE N_NIMCALL(int, createNativeSocket__F1LPwUDx07eMGH1vFNDzcw)(tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg domain, tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw sockType, tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg protocol, NIM_BOOL inheritable);
N_LIB_PRIVATE N_NIMCALL(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*, newSocket__9b5QTa9b4dQ3h5Ri1wnR4ujw)(int fd, tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg domain, tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw sockType, tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg protocol, NIM_BOOL buffered);
static N_NIMCALL(void, Marker_tyRef__MkGXUPMSENeRDS7EppfLgA)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void, setSockOptInt__EjxaD4yB3b9a9anuNz5h25Og)(int socket, NI level, NI optname, NI optval);
N_LIB_PRIVATE N_NIMCALL(void, wrapSocket__nSrKttw9bOstnCyvh66mpmQ)(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* ctx, tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isIpAddress__lty7O9aUHIZT9cqYHeC2n5zA)(NimStringDesc* addressStr);
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA, parseIpAddress__1ivqWNphfe1wCfgNmXXOCA)(NimStringDesc* addressStr);
static N_INLINE(NIM_BOOL, contains__Pa9a8m0kZYH6LC8N1EcZJdQsystem)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item);
static N_INLINE(NI, find__31wM5Ui9c8jnrQ5QD4oPxOQsystem)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item);
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA, parseIPv6Address__1ivqWNphfe1wCfgNmXXOCA_2)(NimStringDesc* addressStr);
static N_INLINE(NimStringDesc*, X5BX5D___FPvLvuwqfYMFkcbGfPM8QQsystem)(NimStringDesc* s, tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA x);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
static N_INLINE(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b);
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA, parseIPv4Address__1ivqWNphfe1wCfgNmXXOCA_3)(NimStringDesc* addressStr);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isObj)(TNimType* obj, TNimType* subclass);
static N_INLINE(Exception*, nimBorrowCurrentException)(void);
static N_INLINE(void, popCurrentException)(void);
N_LIB_PRIVATE N_NIMCALL(NI, SSL_set_tlsext_host_name__jGR2GiKRQZ9cgDkYFu4P9aNg)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ssl, NCSTRING name);
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s);
N_LIB_PRIVATE N_NIMCALL(NI, send__5L0SyQu9bf9aWLpivLtuRdDg)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* data, NI size);
N_LIB_PRIVATE N_NIMCALL(void, readLine__0WLvm80r9c7KImcDRmm5IDg)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NimStringDesc** line, NI timeout, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags, NI maxLength);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_LIB_PRIVATE N_NIMCALL(NI, waitFor__mpNV4IG56MRYASsne34FNA)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw* waited, NI timeout, NI size, NimStringDesc* funcName);
N_LIB_PRIVATE N_NIMCALL(NI64, inMilliseconds__df0d89cDnRIju9aB6p1W1qVA)(tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw dur);
static N_NIMCALL(void, Marker_tyRef__OhBa09cfBAnY4MdnNlGabWQ)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasDataBuffered__L6V0D3apf5iJeZChqzkovw)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* s);
N_LIB_PRIVATE N_NIMCALL(tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w, getMonoTime__QkEugs2Q2iFK9b83sl2B6wA)(void);
N_LIB_PRIVATE N_NIMCALL(NI, select__9c4QMA6DGRJbXBL6Jy4sbPw)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* readfd, NI timeout);
N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len);
N_LIB_PRIVATE N_NIMCALL(NI, selectRead__hYdMbc9crqOqsDFcxhERoLA)(tySequence__9apztJSmgERYU8fZOjI4pOg** readfds, NI timeout);
N_LIB_PRIVATE N_NIMCALL(void, pluseq___x4VoYzJQBbk9bAft9bFS7fyA)(tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw* d1, tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw d2);
N_LIB_PRIVATE N_NIMCALL(tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw, minus___p9cBm7joedh4BwcboQ3HMVQ)(tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w a, tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w b);
N_LIB_PRIVATE N_NIMCALL(NI, recv__5L0SyQu9bf9aWLpivLtuRdDg_2)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* data, NI size);
N_LIB_PRIVATE N_NIMCALL(NI, readIntoBuf__3VtccBbq17lyKCft9aSHtGA)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NI32 flags);
N_LIB_PRIVATE N_NIMCALL(NI, uniRecv__YQlV9aRgVr9cJoVJlEPDJIqw)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* buffer, int size, int flags);
N_LIB_PRIVATE N_NIMCALL(NI, peekChar__vy4VpuiQuyO2yjz3cp2FxQ)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NIM_CHAR* c);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, addChar)(NimStringDesc* s, NIM_CHAR c);
N_LIB_PRIVATE N_NIMCALL(NI, recv__s9bHVcCkcztbhZorVAO5UpA)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* data, NI size, NI timeout);
N_LIB_PRIVATE N_NIMCALL(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw*, SSLv23_method__LTfNTmKR6aBlZTkY8nHSxg)(void);
N_LIB_PRIVATE N_NIMCALL(unsigned long, getOpenSSLVersion__dJsO04BYfgh1GDCx4NNEgA)(void);
N_LIB_PRIVATE N_NIMCALL(int, SSL_CTX_set_ciphersuites__WApCSzGH2uqCDm9bYkShtQw)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, NCSTRING str);
static N_INLINE(int, SSL_CTX_set_ecdh_auto__7FfmdDMi8b9aPt5ijVCCYfwopenssl)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, int onoff);
N_LIB_PRIVATE N_NIMCALL(NI, SSLCTXSetMode__u4DGuCXu9asDo9aQgd9cu5QNQ)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, NI mode);
N_LIB_PRIVATE N_NIMCALL(void, loadCertificates__geRWUgM7mn0muJSOQgdeJg)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, NimStringDesc* certFile, NimStringDesc* keyFile);
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, nosfileExists)(NimStringDesc* filename);
N_LIB_PRIVATE N_NIMCALL(void, initHashSet__rkx2SGa9c4bJGzaJP7jTaxg)(NI initialSize, tyObject_HashSet__bGAilYs5sUICRbD13gZaFg* Result);
N_LIB_PRIVATE N_NIMCALL(tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ*, new__5koBfXFt4Ec5TaAoLmPrsw)(void);

/* section: NIM_merge_DATA */
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_2, "net.nim(487, 12) `SslLibraryInit() == 1` ", 41);
N_LIB_PRIVATE TNimType NTI__nNdejAl9bbVbX7sP6RJ4h0w_;
extern TNimType NTI__QQ33RYEe889cv60wm9bVkd8A_;
extern TNimType NTI__bGAilYs5sUICRbD13gZaFg_;
extern TNimType NTI__ytyiCJqK439aF9cIibuRVpAg_;
N_LIB_PRIVATE TNimType NTI__22zILeNTc8ClX7DrPZ3XOQ_;
N_LIB_PRIVATE TNimType NTI__oFHfEKFsiYTMAy9a42cSiKw_;
extern TNimType NTI__vr5DoT1jILTGdRlYv1OYpw_;
extern TNimType NTI__HsJiUUcO9cHBdUCi0HwkSTA_;
N_LIB_PRIVATE TNimType NTI__lYMtBEH0vEMRzoDaCw5CJg_;
N_LIB_PRIVATE TNimType NTI__t2PQ49cw9cyPD5BKolxzFbTw_;
N_LIB_PRIVATE TNimType NTI__LP7l6kWJNPJLySYXWH5AYA_;
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_7, "Couldn\'t add SIGPIPE to Sigset", 30);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_8, "Couldn\'t block SIGPIPE", 22);
extern TNimType NTI__qrLSDoe2oBoAqNtJ9badtnA_;
N_LIB_PRIVATE TNimType NTI__GtD0IEVE1EOWxaU5x9amdzA_;
N_LIB_PRIVATE TNimType NTI__VoScTqHOwyXBt9b3u4T1Ksw_;
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_9, "No error reported.", 18);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_10, "Please upgrade your OpenSSL library, it does not support the ne"
"cessary protocols. OpenSSL error is: ", 100);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_11, "TLS/SSL connection failed to initiate, socket closed prematurel"
"y.", 65);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_12, "Not enough data on socket.", 26);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_13, "Function for x509 lookup has been called.", 41);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_14, "IO error has occurred ", 22);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_15, "because an EOF was observed that violates the protocol", 54);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_16, "in the BIO layer", 16);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_17, ": ", 2);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_18, "Unknown Error", 13);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_19, "No valid socket error code available", 36);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_20, "Couldn\'t unblock SIGPIPE", 24);
N_LIB_PRIVATE TNimType NTI__aIhANOOoETolVz9cccNO9cRQ_;
extern TNimType NTI__nlCscttRCss70IBTyuBqnA_;
extern TNimType NTI__VaVACK0bpYmqIQ0mKcHfQQ_;
extern TNimType NTI__nmiMWKVIe46vacnhAFrQvw_;
N_LIB_PRIVATE TNimType NTI__QQGLPNVVwLhYjkngqAxXQQ_;
extern TNimType NTI__rR5Bzr1D5krxoo1NcNyeMA_;
extern TNimType NTI__sVg18TP9cLifHyygRe9cro9aA_;
extern TNimType NTI__Q79bEtFARvq0ekDNtvj3Vqg_;
extern TNimType NTI__NQT1bItGG2X9byGdrWX7ujw_;
extern TNimType NTI__dqJ1OqRGclxIMMdSLRzzXg_;
N_LIB_PRIVATE TNimType NTI__MkGXUPMSENeRDS7EppfLgA_;
extern TNimType NTI__HMIVdYjdZYWskTmTQVo5BQ_;
extern TNimType NTI__iLZrPn9anoh9ad1MmO0RczFw_;
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_22, "Couldn\'t resolve address: ", 26);
extern TNimType NTI__Ie1m0dv1ZHg72IgPRr1cDw_;
extern TNimType NTI__yoNlBGx0D2tRizIdhQuENw_;
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_23, "IP Address string is empty", 26);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_24, "Invalid IP Address", 18);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_25, "Invalid IP Address. Address contains an invalid separator", 57);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_26, "Invalid IP Address. Address contains more than one \"::\" separat"
"or", 65);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_27, "Invalid IP Address. The address consists of too many groups", 59);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_28, "Invalid IP Address. Address may not start with \":\"", 50);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_29, "Invalid IP Address. Address may not end with \":\"", 48);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_30, "Invalid IP Address. Value is out of range", 41);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_31, "Invalid IP Address. Address contains an invalid character", 57);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_32, "Invalid IP Address. The address consists of too few groups", 58);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_33, "Could not send all data.", 24);
N_LIB_PRIVATE TNimType NTI__VuFrIFILhVuaGaO5FCG0Og_;
N_LIB_PRIVATE TNimType NTI__OhBa09cfBAnY4MdnNlGabWQ_;
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_34, "Call to \'", 9);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_35, "\' timed out.", 12);
extern TNimType NTI__9apztJSmgERYU8fZOjI4pOg_;
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_36, "readLine", 8);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_37, "\015\012", 2);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_38, "recv", 4);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_39, "SSLv2 is no longer secure and has been deprecated, use protSSLv"
"23", 65);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_40, "SSLv3 is no longer secure and has been deprecated, use protSSLv"
"23", 65);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_41, "Certificate file could not be found: ", 37);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_42, "Key file could not be found: ", 29);
STRING_LITERAL(TM__XqsrSBxhOTPgLQ9cX4MmV4A_43, "Verification of private key file failed.", 40);

/* section: NIM_merge_VARS */
extern tyProc__ln4kdL5W9bbX4a1xl8nnVXQ Dl_15665614_;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
extern tyProc__ln4kdL5W9bbX4a1xl8nnVXQ Dl_15675632_;
extern tyProc__Vff1ipOwDPDGknaRJAdXjA Dl_15665696_;
extern tyProc__kxUw9cdxJbPtv0iPyoSbDBQ Dl_15665719_;
extern tyProc__wCuLyuC5VitcgJKGCqJQRw Dl_15666026_;
extern tyProc__5zMKCPIiPHTYY9cjyzsHlmQ Dl_15666020_;
extern tyProc__e47RoMUolEGMiUlfiZt9abQ Dl_15665619_;
extern int osInvalidSocket__voz9aUXu8jtRbvGZZJHNE8w;
extern tyProc__Rqjya8uauy9aPcyfGamaSrg Dl_15665616_;
extern tyProc__kxUw9cdxJbPtv0iPyoSbDBQ Dl_15665692_;
extern NIM_THREADVAR Exception* currException__9bVPeDJlYTi9bQApZpfH8wjg;
extern NIM_THREADVAR Exception* currException__9bVPeDJlYTi9bQApZpfH8wjg;
extern NIM_THREADVAR Exception* currException__9bVPeDJlYTi9bQApZpfH8wjg;
extern tyProc__Vff1ipOwDPDGknaRJAdXjA Dl_15665706_;
extern tyProc__Vff1ipOwDPDGknaRJAdXjA Dl_15665723_;
extern tyProc__sG7rgqmtlgBaumPwwN3BfQ Dl_15665714_;
extern tyProc__Vff1ipOwDPDGknaRJAdXjA Dl_15665726_;
extern tyProc__09aW01hZ1tSPafLaWVpBcXA Dl_15665709_;
extern tyProc__Rqjya8uauy9aPcyfGamaSrg Dl_15665632_;
extern tyProc__HXibadfWHwHwyhCwpIRD2A Dl_15651252_;
extern tyProc__2PA7CxitARKs0jpUW1gQ0g Dl_15665655_;
extern tyProc__JfY9aCDiBh9bgOEieo8Vltxg Dl_15675414_;
extern tyProc__H5wL7jexPlRA7WCw9cqLm0A Dl_15665643_;
extern tyProc__tYatIIo0oRSB9bjHLep7yhQ Dl_15665664_;
extern tyProc__xjxKRHVZXDqdWXw9bunoZ3w Dl_15665668_;
extern tyProc__Vff1ipOwDPDGknaRJAdXjA Dl_15665673_;

/* section: NIM_merge_PROCS */
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
static N_NIMCALL(void, Marker_tyRef__t2PQ49cw9cyPD5BKolxzFbTw)(void* p, NI op) {
	tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ* a;
	a = (tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ*)p;
	nimGCvisit((void*)(*a).serverGetPskFunc.ClE_0, op);
	nimGCvisit((void*)(*a).clientGetPskFunc.ClE_0, op);
}
static N_NIMCALL(void, Marker_tyRef__LP7l6kWJNPJLySYXWH5AYA)(void* p, NI op) {
	tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* a;
	a = (tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w*)p;
	nimGCvisit((void*)(*a).referencedData.data, op);
	nimGCvisit((void*)(*a).extraInternal, op);
}
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isDisconnectionError__XxybNfLJKXhPAkMhmPhNzQ)(tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags, NI32 lastError) {
	NIM_BOOL result;
	NIM_BOOL T1_;
	NIM_BOOL T3_;
	NIM_BOOL T4_;
	result = (NIM_BOOL)0;
	T1_ = (NIM_BOOL)0;
	T1_ = ((flags &(1U<<((NU)(((tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg) 1))&7U)))!=0);
	if (!(T1_)) goto LA2_;
	T3_ = (NIM_BOOL)0;
	T4_ = (NIM_BOOL)0;
	T4_ = (lastError == ECONNRESET);
	if (T4_) goto LA5_;
	T4_ = (lastError == EPIPE);
	LA5_: ;
	T3_ = T4_;
	if (T3_) goto LA6_;
	T3_ = (lastError == ENETRESET);
	LA6_: ;
	T1_ = T3_;
	LA2_: ;
	result = T1_;
	return result;
}
static N_NIMCALL(void, Marker_tyRef__VoScTqHOwyXBt9b3u4T1Ksw)(void* p, NI op) {
	tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA* a;
	a = (tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*)p;
	nimGCvisit((void*)(*a).Sup.Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.Sup.message, op);
	nimGCvisit((void*)(*a).Sup.Sup.trace, op);
	nimGCvisit((void*)(*a).Sup.Sup.up, op);
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringDesc* dest, NimStringDesc* src) {
	{
		void* T5_;
		void* T6_;
		if (!!((src == NIM_NIL))) goto LA3_;
		T5_ = (void*)0;
		T5_ = ((void*) ((&(*dest).data[(*dest).Sup.len])));
		T6_ = (void*)0;
		T6_ = ((void*) ((*src).data));
		copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(T5_, T6_, ((NI) ((NI)((*src).Sup.len + ((NI) 1)))));
		(*dest).Sup.len += (*src).Sup.len;
	}
	LA3_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g)(NimStringDesc* s) {
	unsigned long err;
	NimStringDesc* errStr;
	NCSTRING T11_;
	tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA* T15_;
{	{
		tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA* T5_;
		if (!!(((s ? s->Sup.len : 0) == 0))) goto LA3_;
		T5_ = (tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*)0;
		T5_ = (tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*) newObj((&NTI__VoScTqHOwyXBt9b3u4T1Ksw_), sizeof(tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA));
		(*T5_).Sup.Sup.Sup.m_type = (&NTI__GtD0IEVE1EOWxaU5x9amdzA_);
		(*T5_).Sup.Sup.name = "SslError";
		(*T5_).Sup.Sup.message = copyString(s);
		(*T5_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T5_, "SslError", "raiseSSLError", "net.nim", 495);
		goto BeforeRet_;
	}
	LA3_: ;
	err = Dl_15666026_();
	{
		tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA* T10_;
		if (!(err == ((NU) 0))) goto LA8_;
		T10_ = (tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*)0;
		T10_ = (tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*) newObj((&NTI__VoScTqHOwyXBt9b3u4T1Ksw_), sizeof(tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA));
		(*T10_).Sup.Sup.Sup.m_type = (&NTI__GtD0IEVE1EOWxaU5x9amdzA_);
		(*T10_).Sup.Sup.name = "SslError";
		(*T10_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_9));
		(*T10_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T10_, "SslError", "raiseSSLError", "net.nim", 498);
		goto BeforeRet_;
	}
	LA8_: ;
	T11_ = (NCSTRING)0;
	T11_ = Dl_15666020_(err, NIM_NIL);
	errStr = cstrToNimstr(T11_);
	switch (err) {
	case ((NI) 336032814):
	case ((NI) 336032784):
	{
		NimStringDesc* T13_;
		T13_ = (NimStringDesc*)0;
		T13_ = rawNewString((errStr ? errStr->Sup.len : 0) + 100);
appendString(T13_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_10));
appendString(T13_, errStr);
		errStr = T13_;
	}
	break;
	default:
	{
	}
	break;
	}
	T15_ = (tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*)0;
	T15_ = (tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*) newObj((&NTI__VoScTqHOwyXBt9b3u4T1Ksw_), sizeof(tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA));
	(*T15_).Sup.Sup.Sup.m_type = (&NTI__GtD0IEVE1EOWxaU5x9amdzA_);
	(*T15_).Sup.Sup.name = "SslError";
	(*T15_).Sup.Sup.message = copyString(errStr);
	(*T15_).Sup.Sup.parent = NIM_NIL;
	raiseExceptionEx((Exception*)T15_, "SslError", "raiseSSLError", "net.nim", 506);
	goto BeforeRet_;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI32, getSocketError__YATB019buW9cFOjCCZLlKipQ)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket) {
	NI32 result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI32)0;
	result = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!(result == ((NI32) 0))) goto LA3_;
		result = (*socket).lastError;
	}
	LA3_: ;
	{
		if (!(result == ((NI32) 0))) goto LA7_;
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(result, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_19));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA7_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NI err, NIM_BOOL async, NI32 lastError, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		if (!(*socket).isSsl) goto LA3_;
		{
			int ret;
			if (!(err <= ((NI) 0))) goto LA7_;
			ret = Dl_15665719_((*socket).sslHandle, ((int) (err)));
			switch (ret) {
			case ((NI) 6):
			{
				raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_11));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			case ((NI) 7):
			case ((NI) 8):
			{
				{
					if (!async) goto LA13_;
					goto BeforeRet_;
				}
				goto LA11_;
				LA13_: ;
				{
					raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_12));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
				LA11_: ;
			}
			break;
			case ((NI) 3):
			case ((NI) 2):
			{
				{
					if (!async) goto LA19_;
					goto BeforeRet_;
				}
				goto LA17_;
				LA19_: ;
				{
					raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_12));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
				LA17_: ;
			}
			break;
			case ((NI) 4):
			{
				raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_13));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			case ((NI) 5):
			{
				NI32 osErr;
				(*socket).sslNoShutdown = NIM_TRUE;
				osErr = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T26_;
					NimStringDesc* errStr;
					unsigned long sslErr;
					T26_ = (NIM_BOOL)0;
					T26_ = isDisconnectionError__XxybNfLJKXhPAkMhmPhNzQ(flags, osErr);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (!!(T26_)) goto LA27_;
					errStr = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_14));
					sslErr = Dl_15666026_();
					{
						NIM_BOOL T31_;
						T31_ = (NIM_BOOL)0;
						T31_ = (sslErr == ((NU) 0));
						if (!(T31_)) goto LA32_;
						T31_ = (err == ((NI) 0));
						LA32_: ;
						if (!T31_) goto LA33_;
						errStr = resizeString(errStr, 54);
appendString(errStr, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_15));
					}
					goto LA29_;
					LA33_: ;
					{
						NIM_BOOL T36_;
						T36_ = (NIM_BOOL)0;
						T36_ = (sslErr == ((NU) 0));
						if (!(T36_)) goto LA37_;
						T36_ = (err == ((NI) -1));
						LA37_: ;
						if (!T36_) goto LA38_;
						errStr = resizeString(errStr, 16);
appendString(errStr, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_16));
					}
					goto LA29_;
					LA38_: ;
					{
						NimStringDesc* errStr_2;
						NCSTRING T41_;
						NimStringDesc* T42_;
						T41_ = (NCSTRING)0;
						T41_ = Dl_15666020_(sslErr, NIM_NIL);
						errStr_2 = cstrToNimstr(T41_);
						T42_ = (NimStringDesc*)0;
						T42_ = rawNewString((errStr_2 ? errStr_2->Sup.len : 0) + (errStr_2 ? errStr_2->Sup.len : 0) + 2);
appendString(T42_, errStr_2);
appendString(T42_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_17));
appendString(T42_, errStr_2);
						raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(T42_);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
					LA29_: ;
					raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(osErr, errStr);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
				LA27_: ;
			}
			break;
			case ((NI) 1):
			{
				(*socket).sslNoShutdown = NIM_TRUE;
				raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			default:
			{
				raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_18));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			break;
			}
		}
		LA7_: ;
	}
	LA3_: ;
	{
		NIM_BOOL T47_;
		NI32 lastE;
		T47_ = (NIM_BOOL)0;
		T47_ = (err == ((NI) -1));
		if (!(T47_)) goto LA48_;
		T47_ = !((*socket).isSsl);
		LA48_: ;
		if (!T47_) goto LA49_;
		{
			if (!(((NI) (lastError)) == ((NI) -1))) goto LA53_;
			lastE = getSocketError__YATB019buW9cFOjCCZLlKipQ(socket);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		goto LA51_;
		LA53_: ;
		{
			lastE = lastError;
		}
		LA51_: ;
		{
			NIM_BOOL T58_;
			T58_ = (NIM_BOOL)0;
			T58_ = isDisconnectionError__XxybNfLJKXhPAkMhmPhNzQ(flags, lastE);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!!(T58_)) goto LA59_;
			{
				if (!async) goto LA63_;
				{
					NIM_BOOL T67_;
					T67_ = (NIM_BOOL)0;
					T67_ = (lastE == EAGAIN);
					if (T67_) goto LA68_;
					T67_ = (lastE == EWOULDBLOCK);
					LA68_: ;
					if (!T67_) goto LA69_;
					goto BeforeRet_;
				}
				goto LA65_;
				LA69_: ;
				{
					raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(lastE, ((NimStringDesc*) NIM_NIL));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
				LA65_: ;
			}
			goto LA61_;
			LA63_: ;
			{
				raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(lastE, ((NimStringDesc*) NIM_NIL));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			LA61_: ;
		}
		LA59_: ;
	}
	LA49_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, close__dPXIsN1nx9bPvap47WTEMow)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags) {
NIM_BOOL oldNimErrFin40_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		NIM_BOOL T4_;
		T4_ = (NIM_BOOL)0;
		T4_ = (*socket).isSsl;
		if (!(T4_)) goto LA5_;
		T4_ = !(((*socket).sslHandle == NIM_NIL));
		LA5_: ;
		if (!T4_) goto LA6_;
		{
			NIM_BOOL T10_;
			int T12_;
			sigset_t oldSetX60gensym101_;
			sigset_t watchSetX60gensym101_;
			NIM_BOOL alreadyBlockedX60gensym101_;
			int T39_;
			int res;
			T10_ = (NIM_BOOL)0;
			T10_ = !((*socket).sslNoShutdown);
			if (!(T10_)) goto LA11_;
			T12_ = (int)0;
			T12_ = SSL_in_init__loUCLHAKQg9cZwis5tAb2ig((*socket).sslHandle);
			if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			T10_ = (T12_ == ((NI32) 0));
			LA11_: ;
			if (!T10_) goto LA13_;
			nimZeroMem((void*)(&oldSetX60gensym101_), sizeof(sigset_t));
			nimZeroMem((void*)(&watchSetX60gensym101_), sizeof(sigset_t));
			{
				int T17_;
				NI32 T20_;
				T17_ = (int)0;
				T17_ = sigemptyset((&oldSetX60gensym101_));
				if (!(T17_ == ((NI32) -1))) goto LA18_;
				T20_ = (NI32)0;
				T20_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T20_, ((NimStringDesc*) NIM_NIL));
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
			LA18_: ;
			{
				int T23_;
				NI32 T26_;
				T23_ = (int)0;
				T23_ = sigemptyset((&watchSetX60gensym101_));
				if (!(T23_ == ((NI32) -1))) goto LA24_;
				T26_ = (NI32)0;
				T26_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T26_, ((NimStringDesc*) NIM_NIL));
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
			LA24_: ;
			{
				int T29_;
				NI32 T32_;
				T29_ = (int)0;
				T29_ = sigaddset((&watchSetX60gensym101_), SIGPIPE);
				if (!(T29_ == ((NI32) -1))) goto LA30_;
				T32_ = (NI32)0;
				T32_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T32_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_7));
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
			LA30_: ;
			{
				int T35_;
				NI32 T38_;
				T35_ = (int)0;
				T35_ = pthread_sigmask(SIG_BLOCK, (&watchSetX60gensym101_), (&oldSetX60gensym101_));
				if (!(T35_ == ((NI32) -1))) goto LA36_;
				T38_ = (NI32)0;
				T38_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
				raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T38_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_8));
				if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
			}
			LA36_: ;
			T39_ = (int)0;
			T39_ = sigismember((&oldSetX60gensym101_), SIGPIPE);
			alreadyBlockedX60gensym101_ = (T39_ == ((NI32) 1));
			Dl_15675632_();
			res = Dl_15665696_((*socket).sslHandle);
			{
				if (!(res == ((NI32) 0))) goto LA43_;
			}
			goto LA41_;
			LA43_: ;
			{
				NI32 err;
				int sslError;
				if (!!((res == ((NI32) 1)))) goto LA46_;
				err = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
				sslError = Dl_15665719_((*socket).sslHandle, res);
				{
					NIM_BOOL T50_;
					T50_ = (NIM_BOOL)0;
					T50_ = (sslError == ((NI32) 6));
					if (T50_) goto LA51_;
					T50_ = (sslError == ((NI32) 5));
					LA51_: ;
					if (!T50_) goto LA52_;
					{
						NIM_BOOL T56_;
						T56_ = (NIM_BOOL)0;
						T56_ = isDisconnectionError__XxybNfLJKXhPAkMhmPhNzQ(flags, err);
						if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
						if (!!(T56_)) goto LA57_;
						socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, ((NI) (res)), NIM_FALSE, err, flags);
						if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
					}
					LA57_: ;
				}
				goto LA48_;
				LA52_: ;
				{
					socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, ((NI) (res)), NIM_FALSE, err, flags);
					if (NIM_UNLIKELY(*nimErr_)) goto LA40_;
				}
				LA48_: ;
			}
			goto LA41_;
			LA46_: ;
			LA41_: ;
			{
				LA40_:;
			}
			{
				oldNimErrFin40_ = *nimErr_; *nimErr_ = NIM_FALSE;
				{
					if (!!(alreadyBlockedX60gensym101_)) goto LA64_;
					{
						int T68_;
						NI32 T71_;
						T68_ = (int)0;
						T68_ = pthread_sigmask(SIG_UNBLOCK, (&watchSetX60gensym101_), (&oldSetX60gensym101_));
						if (!(T68_ == ((NI32) -1))) goto LA69_;
						T71_ = (NI32)0;
						T71_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
						if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
						raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T71_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_20));
						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).isSsl;
			if (!(T76_)) goto LA77_;
			T76_ = !(((*socket).sslHandle == NIM_NIL));
			LA77_: ;
			if (!T76_) goto LA78_;
			Dl_15665619_((*socket).sslHandle);
			(*socket).sslHandle = NIM_NIL;
		}
		LA78_: ;
		close__8c1w8B7fpSuB4Dgr5LHVJA((*socket).fd);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		(*socket).fd = osInvalidSocket__voz9aUXu8jtRbvGZZJHNE8w;
		*nimErr_ = oldNimErrFin1_;
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
}
static N_INLINE(NIM_BOOL, isNone__H87Mp4Y2b9aVoDHbyPXjVtAoptions)(tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ self) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = !(self.has);
	return result;
}
static N_INLINE(tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg*, unsafeGet__CX9cpSVl0CsECjiCYrAMm9bAoptions)(tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ* self) {
	tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg* result;
	result = (tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg*)0;
	result = (&(*self).val);
	return result;
}
static N_NIMCALL(void, Marker_tyRef__MkGXUPMSENeRDS7EppfLgA)(void* p, NI op) {
	tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* a;
	NI T1_;
	a = (tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*)p;
	T1_ = (NI)0;
	nimGCvisit((void*)(*a).sslContext, op);
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*, newSocket__9b5QTa9b4dQ3h5Ri1wnR4ujw)(int fd, tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg domain, tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw sockType, tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg protocol, NIM_BOOL buffered) {
	tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* result;
	tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*)0;
	T1_ = (tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*)0;
	T1_ = (tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*) newObj((&NTI__MkGXUPMSENeRDS7EppfLgA_), sizeof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ));
	(*T1_).fd = fd;
	(*T1_).isBuffered = buffered;
	(*T1_).domain = domain;
	(*T1_).sockType = sockType;
	(*T1_).protocol = protocol;
	result = T1_;
	{
		if (!buffered) goto LA4_;
		(*result).currPos = ((NI) 0);
	}
	LA4_: ;
	setSockOptInt__EjxaD4yB3b9a9anuNz5h25Og(fd, ((NI) (SOL_SOCKET)), ((NI) (SO_NOSIGPIPE)), ((NI) 1));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*, dial__oD5cdlP49a1aM6tVxzT4h1Q)(NimStringDesc* address, NU16 port, tyEnum_Protocol__dqJ1OqRGclxIMMdSLRzzXg protocol, NIM_BOOL buffered) {
	tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* result;
	tyEnum_SockType__NQT1bItGG2X9byGdrWX7ujw sockType;
	struct addrinfo* aiList;
	tyArray__7t2L64rS85OOrWyPjk9cdYA fdPerDomain;
	NIM_BOOL success;
	NI32 lastError;
	struct addrinfo* it;
	tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg domain;
	int lastFd;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*)0;
	sockType = toSockType__6alUTTXG6jHTyH82e9a1JDw(protocol);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	aiList = getAddrInfo__ANf7QnbfE8nyIlFuWroDcQ(address, port, ((tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg) 0), sockType, protocol);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	nimZeroMem((void*)fdPerDomain, sizeof(tyArray__7t2L64rS85OOrWyPjk9cdYA));
	{
		NI i;
		NI res;
		i = (NI)0;
		res = ((NI) 0);
		{
			while (1) {
				if (!(res <= ((NI) 30))) goto LA3;
				i = ((NI) (res));
				fdPerDomain[(i)- 0] = osInvalidSocket__voz9aUXu8jtRbvGZZJHNE8w;
				res += ((NI) 1);
			} LA3: ;
		}
	}
	success = NIM_FALSE;
	lastError = (NI32)0;
	it = aiList;
	domain = (tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg)0;
	lastFd = (int)0;
	{
		while (1) {
			if (!!((it == NIM_NIL))) goto LA5;
			{
				tyObject_Option__FqSKP9b8yM9aV7mJ0VU4DFWQ domainOpt;
				tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg* T12_;
				domainOpt = toKnownDomain__RQ9bFvLg4dpjf7aRPA8ID9bg((*it).ai_family);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T9_;
					T9_ = (NIM_BOOL)0;
					T9_ = isNone__H87Mp4Y2b9aVoDHbyPXjVtAoptions(domainOpt);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (!T9_) goto LA10_;
					it = (*it).ai_next;
					goto LA6;
				}
				LA10_: ;
				T12_ = (tyEnum_Domain__Q79bEtFARvq0ekDNtvj3Vqg*)0;
				T12_ = unsafeGet__CX9cpSVl0CsECjiCYrAMm9bAoptions((&domainOpt));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				domain = (*T12_);
				lastFd = fdPerDomain[(domain)- 0];
				{
					if (!(lastFd == osInvalidSocket__voz9aUXu8jtRbvGZZJHNE8w)) goto LA15_;
					lastFd = createNativeSocket__F1LPwUDx07eMGH1vFNDzcw(domain, sockType, protocol, NIM_FALSE);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					{
						NI32 err;
						if (!(lastFd == osInvalidSocket__voz9aUXu8jtRbvGZZJHNE8w)) goto LA19_;
						err = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						freeaddrinfo(aiList);
						{
							NI i_2;
							int fd;
							NI i_3;
							i_2 = (NI)0;
							fd = (int)0;
							i_3 = ((NI) 0);
							{
								if (!(((NI) (i_3)) <= ((NI) 30))) goto LA24_;
								{
									while (1) {
										i_2 = i_3;
										fd = fdPerDomain[(i_3)- 0];
										{
											NIM_BOOL T30_;
											T30_ = (NIM_BOOL)0;
											T30_ = !((fd == osInvalidSocket__voz9aUXu8jtRbvGZZJHNE8w));
											if (!(T30_)) goto LA31_;
											T30_ = !((((NI) (i_2)) == ((NI) -1)));
											LA31_: ;
											if (!T30_) goto LA32_;
											close__8c1w8B7fpSuB4Dgr5LHVJA(fd);
											if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
										}
										LA32_: ;
										{
											if (!(((NI) 30) <= ((NI) (i_3)))) goto LA36_;
											goto LA26;
										}
										LA36_: ;
										i_3 += ((NI) 1);
									}
								} LA26: ;
							}
							LA24_: ;
						}
						raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(err, ((NimStringDesc*) NIM_NIL));
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
					LA19_: ;
					fdPerDomain[(domain)- 0] = lastFd;
				}
				LA15_: ;
				{
					int T40_;
					T40_ = (int)0;
					T40_ = connect(lastFd, (*it).ai_addr, (*it).ai_addrlen);
					if (!(T40_ == ((NI32) 0))) goto LA41_;
					success = NIM_TRUE;
					goto LA4;
				}
				LA41_: ;
				lastError = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				it = (*it).ai_next;
			} LA6: ;
		} LA5: ;
	} LA4: ;
	freeaddrinfo(aiList);
	{
		NI i_4;
		int fd_2;
		NI i_5;
		i_4 = (NI)0;
		fd_2 = (int)0;
		i_5 = ((NI) 0);
		{
			if (!(((NI) (i_5)) <= ((NI) 30))) goto LA46_;
			{
				while (1) {
					i_4 = i_5;
					fd_2 = fdPerDomain[(i_5)- 0];
					{
						NIM_BOOL T52_;
						T52_ = (NIM_BOOL)0;
						T52_ = !((fd_2 == osInvalidSocket__voz9aUXu8jtRbvGZZJHNE8w));
						if (!(T52_)) goto LA53_;
						T52_ = !((((NI) (i_4)) == domain));
						LA53_: ;
						if (!T52_) goto LA54_;
						close__8c1w8B7fpSuB4Dgr5LHVJA(fd_2);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					}
					LA54_: ;
					{
						if (!(((NI) 30) <= ((NI) (i_5)))) goto LA58_;
						goto LA48;
					}
					LA58_: ;
					i_5 += ((NI) 1);
				}
			} LA48: ;
		}
		LA46_: ;
	}
	{
		if (!success) goto LA62_;
		result = newSocket__9b5QTa9b4dQ3h5Ri1wnR4ujw(lastFd, domain, sockType, protocol, NIM_TRUE);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA60_;
	LA62_: ;
	{
		if (!!((lastError == ((NI32) 0)))) goto LA65_;
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(lastError, ((NimStringDesc*) NIM_NIL));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA60_;
	LA65_: ;
	{
		tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw* T68_;
		NimStringDesc* T69_;
		T68_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*)0;
		T68_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*) newObj((&NTI__HMIVdYjdZYWskTmTQVo5BQ_), sizeof(tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw));
		(*T68_).Sup.Sup.Sup.m_type = (&NTI__iLZrPn9anoh9ad1MmO0RczFw_);
		(*T68_).Sup.Sup.name = "IOError";
		T69_ = (NimStringDesc*)0;
		T69_ = rawNewString((address ? address->Sup.len : 0) + 26);
appendString(T69_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_22));
appendString(T69_, address);
		(*T68_).Sup.Sup.message = T69_;
		(*T68_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T68_, "IOError", "dial", "net.nim", 1872);
		goto BeforeRet_;
	}
	LA60_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, wrapSocket__nSrKttw9bOstnCyvh66mpmQ)(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* ctx, tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	(*socket).isSsl = NIM_TRUE;
	(*socket).sslContext = ctx;
	(*socket).sslHandle = Dl_15665616_((*(*socket).sslContext).context);
	(*socket).sslNoHandshake = NIM_FALSE;
	(*socket).sslHasPeekChar = NIM_FALSE;
	(*socket).sslNoShutdown = NIM_FALSE;
	{
		if (!((*socket).sslHandle == NIM_NIL)) goto LA3_;
		raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA3_: ;
	{
		int T7_;
		T7_ = (int)0;
		T7_ = Dl_15665692_((*socket).sslHandle, (*socket).fd);
		if (!!((T7_ == ((NI32) 1)))) goto LA8_;
		raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA8_: ;
	}BeforeRet_: ;
}
static N_INLINE(NI, find__31wM5Ui9c8jnrQ5QD4oPxOQsystem)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
	NI result;
{	result = (NI)0;
	result = ((NI) 0);
	{
		NIM_CHAR i;
		NI i_2;
		i = (NIM_CHAR)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				if (!(i_2 < aLen_0)) goto LA3;
				i = a[i_2];
				{
					if (!((NU8)(i) == (NU8)(item))) goto LA6_;
					goto BeforeRet_;
				}
				LA6_: ;
				result += ((NI) 1);
				i_2 += ((NI) 1);
			} LA3: ;
		}
	}
	result = ((NI) -1);
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NIM_BOOL, contains__Pa9a8m0kZYH6LC8N1EcZJdQsystem)(NIM_CHAR* a, NI aLen_0, NIM_CHAR item) {
	NIM_BOOL result;
	NI T1_;
{	result = (NIM_BOOL)0;
	T1_ = (NI)0;
	T1_ = find__31wM5Ui9c8jnrQ5QD4oPxOQsystem(a, aLen_0, item);
	result = (((NI) 0) <= T1_);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NimStringDesc*, X5BX5D___FPvLvuwqfYMFkcbGfPM8QQsystem)(NimStringDesc* s, tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA x) {
	NimStringDesc* result;
	NI a;
	NI L;
	result = (NimStringDesc*)0;
	a = x.a;
	L = (NI)((NI)(x.b - a) + ((NI) 1));
	result = mnewString(((NI) (L)));
	{
		NI i;
		NI i_2;
		i = (NI)0;
		i_2 = ((NI) 0);
		{
			while (1) {
				if (!(i_2 < L)) goto LA3;
				i = i_2;
				result->data[i] = s->data[(NI)(i + a)];
				i_2 += ((NI) 1);
			} LA3: ;
		}
	}
	return result;
}
static N_INLINE(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b) {
	tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA result;
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA));
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA));
	result.a = a;
	result.b = b;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA, parseIPv6Address__1ivqWNphfe1wCfgNmXXOCA_2)(NimStringDesc* addressStr) {
	tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA result;
	NI groupCount;
	NI currentGroupStart;
	NU32 currentShort;
	NIM_BOOL separatorValid;
	NI dualColonGroup;
	NIM_BOOL lastWasColon;
	NI v4StartPos;
	NI byteCount;
{	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA));
	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA));
	result.family = ((tyEnum_IpAddressFamily__iqqacz9cr9bcNjYY74E10wPA) 0);
	{
		tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T5_;
		if (!((addressStr ? addressStr->Sup.len : 0) < ((NI) 2))) goto LA3_;
		T5_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
		T5_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
		(*T5_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
		(*T5_).Sup.Sup.name = "ValueError";
		(*T5_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_24));
		(*T5_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T5_, "ValueError", "parseIPv6Address", "net.nim", 306);
		goto BeforeRet_;
	}
	LA3_: ;
	groupCount = ((NI) 0);
	currentGroupStart = ((NI) 0);
	currentShort = ((NU32) 0);
	separatorValid = NIM_TRUE;
	dualColonGroup = ((NI) -1);
	lastWasColon = NIM_FALSE;
	v4StartPos = ((NI) -1);
	byteCount = ((NI) 0);
	{
		NI i;
		NIM_CHAR c;
		NI i_2;
		NI L;
		i = (NI)0;
		c = (NIM_CHAR)0;
		i_2 = ((NI) 0);
		L = (addressStr ? addressStr->Sup.len : 0);
		{
			while (1) {
				if (!(i_2 < L)) goto LA8;
				i = i_2;
				c = addressStr->data[i_2];
				{
					if (!((NU8)(c) == (NU8)(58))) goto LA11_;
					{
						tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T17_;
						if (!!(separatorValid)) goto LA15_;
						T17_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
						T17_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
						(*T17_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
						(*T17_).Sup.Sup.name = "ValueError";
						(*T17_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_25));
						(*T17_).Sup.Sup.parent = NIM_NIL;
						raiseExceptionEx((Exception*)T17_, "ValueError", "parseIPv6Address", "net.nim", 321);
						goto BeforeRet_;
					}
					LA15_: ;
					{
						if (!lastWasColon) goto LA20_;
						{
							tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T26_;
							if (!!((dualColonGroup == ((NI) -1)))) goto LA24_;
							T26_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
							T26_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
							(*T26_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
							(*T26_).Sup.Sup.name = "ValueError";
							(*T26_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_26));
							(*T26_).Sup.Sup.parent = NIM_NIL;
							raiseExceptionEx((Exception*)T26_, "ValueError", "parseIPv6Address", "net.nim", 325);
							goto BeforeRet_;
						}
						LA24_: ;
						dualColonGroup = groupCount;
						separatorValid = NIM_FALSE;
					}
					goto LA18_;
					LA20_: ;
					{
						NIM_BOOL T28_;
						T28_ = (NIM_BOOL)0;
						T28_ = !((i == ((NI) 0)));
						if (!(T28_)) goto LA29_;
						T28_ = !((i == ((addressStr ? addressStr->Sup.len : 0)-1)));
						LA29_: ;
						if (!T28_) goto LA30_;
						{
							tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T36_;
							if (!(((NI) 8) <= groupCount)) goto LA34_;
							T36_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
							T36_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
							(*T36_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
							(*T36_).Sup.Sup.name = "ValueError";
							(*T36_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_27));
							(*T36_).Sup.Sup.parent = NIM_NIL;
							raiseExceptionEx((Exception*)T36_, "ValueError", "parseIPv6Address", "net.nim", 331);
							goto BeforeRet_;
						}
						LA34_: ;
						result._family_1.address_v6[((NI)(groupCount * ((NI) 2)))- 0] = ((NU8) ((NU32)((NU32)(currentShort) >> (NU64)(((NI) 8)))));
						result._family_1.address_v6[((NI)((NI)(groupCount * ((NI) 2)) + ((NI) 1)))- 0] = ((NU8) ((NU32)(currentShort & ((NU32) 255))));
						currentShort = ((NU32) 0);
						groupCount += ((NI) 1);
						{
							if (!!((dualColonGroup == ((NI) -1)))) goto LA39_;
							separatorValid = NIM_FALSE;
						}
						LA39_: ;
					}
					goto LA18_;
					LA30_: ;
					{
						if (!(i == ((NI) 0))) goto LA42_;
						{
							tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T48_;
							if (!!(((NU8)(addressStr->data[((NI) 1)]) == (NU8)(58)))) goto LA46_;
							T48_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
							T48_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
							(*T48_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
							(*T48_).Sup.Sup.name = "ValueError";
							(*T48_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_28));
							(*T48_).Sup.Sup.parent = NIM_NIL;
							raiseExceptionEx((Exception*)T48_, "ValueError", "parseIPv6Address", "net.nim", 340);
							goto BeforeRet_;
						}
						LA46_: ;
					}
					goto LA18_;
					LA42_: ;
					{
						{
							tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T54_;
							if (!!(((NU8)(addressStr->data[(NI)(((addressStr ? addressStr->Sup.len : 0)-1) - ((NI) 1))]) == (NU8)(58)))) goto LA52_;
							T54_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
							T54_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
							(*T54_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
							(*T54_).Sup.Sup.name = "ValueError";
							(*T54_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_29));
							(*T54_).Sup.Sup.parent = NIM_NIL;
							raiseExceptionEx((Exception*)T54_, "ValueError", "parseIPv6Address", "net.nim", 344);
							goto BeforeRet_;
						}
						LA52_: ;
					}
					LA18_: ;
					lastWasColon = NIM_TRUE;
					currentGroupStart = (NI)(i + ((NI) 1));
				}
				goto LA9_;
				LA11_: ;
				{
					if (!((NU8)(c) == (NU8)(46))) goto LA56_;
					{
						NIM_BOOL T60_;
						NIM_BOOL T61_;
						tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T66_;
						T60_ = (NIM_BOOL)0;
						T61_ = (NIM_BOOL)0;
						T61_ = (i < ((NI) 3));
						if (T61_) goto LA62_;
						T61_ = !(separatorValid);
						LA62_: ;
						T60_ = T61_;
						if (T60_) goto LA63_;
						T60_ = (((NI) 7) <= groupCount);
						LA63_: ;
						if (!T60_) goto LA64_;
						T66_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
						T66_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
						(*T66_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
						(*T66_).Sup.Sup.name = "ValueError";
						(*T66_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_24));
						(*T66_).Sup.Sup.parent = NIM_NIL;
						raiseExceptionEx((Exception*)T66_, "ValueError", "parseIPv6Address", "net.nim", 350);
						goto BeforeRet_;
					}
					LA64_: ;
					v4StartPos = currentGroupStart;
					currentShort = ((NU32) 0);
					separatorValid = NIM_FALSE;
					goto LA6;
				}
				goto LA9_;
				LA56_: ;
				{
					if (!(((NU8)(c)) >= ((NU8)(48)) && ((NU8)(c)) <= ((NU8)(57)) || ((NU8)(c)) >= ((NU8)(65)) && ((NU8)(c)) <= ((NU8)(70)) || ((NU8)(c)) >= ((NU8)(97)) && ((NU8)(c)) <= ((NU8)(102)))) goto LA68_;
					{
						if (!(((NU8)(c)) >= ((NU8)(48)) && ((NU8)(c)) <= ((NU8)(57)))) goto LA72_;
						currentShort = (NU32)((NU32)((NU32)((NU64)(currentShort) << (NU64)(((NI) 4)))) + (NU32)(((NU32) ((NI)(((NU8)(c)) - ((NI) 48))))));
					}
					goto LA70_;
					LA72_: ;
					{
						NIM_BOOL T75_;
						T75_ = (NIM_BOOL)0;
						T75_ = ((NU8)(97) <= (NU8)(c));
						if (!(T75_)) goto LA76_;
						T75_ = ((NU8)(c) <= (NU8)(102));
						LA76_: ;
						if (!T75_) goto LA77_;
						currentShort = (NU32)((NU32)((NU32)((NU32)((NU32)((NU64)(currentShort) << (NU64)(((NI) 4)))) + (NU32)(((NU32) ((NI)(((NU8)(c)) - ((NI) 97))))))) + (NU32)(((NU32) 10)));
					}
					goto LA70_;
					LA77_: ;
					{
						currentShort = (NU32)((NU32)((NU32)((NU32)((NU32)((NU64)(currentShort) << (NU64)(((NI) 4)))) + (NU32)(((NU32) ((NI)(((NU8)(c)) - ((NI) 65))))))) + (NU32)(((NU32) 10)));
					}
					LA70_: ;
					{
						tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T84_;
						if (!((NU32)(((NU32) 65535)) < (NU32)(currentShort))) goto LA82_;
						T84_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
						T84_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
						(*T84_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
						(*T84_).Sup.Sup.name = "ValueError";
						(*T84_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_30));
						(*T84_).Sup.Sup.parent = NIM_NIL;
						raiseExceptionEx((Exception*)T84_, "ValueError", "parseIPv6Address", "net.nim", 363);
						goto BeforeRet_;
					}
					LA82_: ;
					lastWasColon = NIM_FALSE;
					separatorValid = NIM_TRUE;
				}
				goto LA9_;
				LA68_: ;
				{
					tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T86_;
					T86_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
					T86_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
					(*T86_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
					(*T86_).Sup.Sup.name = "ValueError";
					(*T86_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_31));
					(*T86_).Sup.Sup.parent = NIM_NIL;
					raiseExceptionEx((Exception*)T86_, "ValueError", "parseIPv6Address", "net.nim", 368);
					goto BeforeRet_;
				}
				LA9_: ;
				i_2 += ((NI) 1);
			} LA8: ;
		}
	} LA6: ;
	{
		if (!(v4StartPos == ((NI) -1))) goto LA89_;
		{
			if (!separatorValid) goto LA93_;
			{
				tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T99_;
				if (!(((NI) 8) <= groupCount)) goto LA97_;
				T99_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
				T99_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
				(*T99_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
				(*T99_).Sup.Sup.name = "ValueError";
				(*T99_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_27));
				(*T99_).Sup.Sup.parent = NIM_NIL;
				raiseExceptionEx((Exception*)T99_, "ValueError", "parseIPv6Address", "net.nim", 375);
				goto BeforeRet_;
			}
			LA97_: ;
			result._family_1.address_v6[((NI)(groupCount * ((NI) 2)))- 0] = ((NU8) ((NU32)((NU32)(currentShort) >> (NU64)(((NI) 8)))));
			result._family_1.address_v6[((NI)((NI)(groupCount * ((NI) 2)) + ((NI) 1)))- 0] = ((NU8) ((NU32)(currentShort & ((NU32) 255))));
			groupCount += ((NI) 1);
		}
		LA93_: ;
	}
	goto LA87_;
	LA89_: ;
	{
		{
			NI i_3;
			NIM_CHAR c_2;
			NimStringDesc* colontmp_;
			NimStringDesc* T102_;
			tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA T103_;
			NI i_4;
			NI L_2;
			i_3 = (NI)0;
			c_2 = (NIM_CHAR)0;
			colontmp_ = (NimStringDesc*)0;
			T102_ = (NimStringDesc*)0;
			T102_ = addressStr;
			T103_ = dotdot___BokNSDrKN1xmV1nA01G9brAsystem(v4StartPos, ((addressStr ? addressStr->Sup.len : 0)-1));
			colontmp_ = X5BX5D___FPvLvuwqfYMFkcbGfPM8QQsystem(T102_, T103_);
			i_4 = ((NI) 0);
			L_2 = (colontmp_ ? colontmp_->Sup.len : 0);
			{
				while (1) {
					if (!(i_4 < L_2)) goto LA105;
					i_3 = i_4;
					c_2 = colontmp_->data[i_4];
					{
						if (!(((NU8)(c_2)) >= ((NU8)(48)) && ((NU8)(c_2)) <= ((NU8)(57)))) goto LA108_;
						currentShort = (NU32)((NU32)((NU32)((NU32)(currentShort) * (NU32)(((NU32) 10)))) + (NU32)(((NU32) ((NI)(((NU8)(c_2)) - ((NI) 48))))));
						{
							tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T114_;
							if (!((NU32)(((NU32) 255)) < (NU32)(currentShort))) goto LA112_;
							T114_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
							T114_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
							(*T114_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
							(*T114_).Sup.Sup.name = "ValueError";
							(*T114_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_30));
							(*T114_).Sup.Sup.parent = NIM_NIL;
							raiseExceptionEx((Exception*)T114_, "ValueError", "parseIPv6Address", "net.nim", 385);
							goto BeforeRet_;
						}
						LA112_: ;
						separatorValid = NIM_TRUE;
					}
					goto LA106_;
					LA108_: ;
					{
						if (!((NU8)(c_2) == (NU8)(46))) goto LA116_;
						{
							NIM_BOOL T120_;
							tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T124_;
							T120_ = (NIM_BOOL)0;
							T120_ = !(separatorValid);
							if (T120_) goto LA121_;
							T120_ = (((NI) 3) <= byteCount);
							LA121_: ;
							if (!T120_) goto LA122_;
							T124_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
							T124_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
							(*T124_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
							(*T124_).Sup.Sup.name = "ValueError";
							(*T124_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_24));
							(*T124_).Sup.Sup.parent = NIM_NIL;
							raiseExceptionEx((Exception*)T124_, "ValueError", "parseIPv6Address", "net.nim", 390);
							goto BeforeRet_;
						}
						LA122_: ;
						result._family_1.address_v6[((NI)((NI)(groupCount * ((NI) 2)) + byteCount))- 0] = ((NU8) (currentShort));
						currentShort = ((NU32) 0);
						byteCount += ((NI) 1);
						separatorValid = NIM_FALSE;
					}
					goto LA106_;
					LA116_: ;
					{
						tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T126_;
						T126_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
						T126_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
						(*T126_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
						(*T126_).Sup.Sup.name = "ValueError";
						(*T126_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_31));
						(*T126_).Sup.Sup.parent = NIM_NIL;
						raiseExceptionEx((Exception*)T126_, "ValueError", "parseIPv6Address", "net.nim", 396);
						goto BeforeRet_;
					}
					LA106_: ;
					i_4 += ((NI) 1);
				} LA105: ;
			}
		}
		{
			NIM_BOOL T129_;
			tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T133_;
			T129_ = (NIM_BOOL)0;
			T129_ = !((byteCount == ((NI) 3)));
			if (T129_) goto LA130_;
			T129_ = !(separatorValid);
			LA130_: ;
			if (!T129_) goto LA131_;
			T133_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
			T133_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
			(*T133_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
			(*T133_).Sup.Sup.name = "ValueError";
			(*T133_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_24));
			(*T133_).Sup.Sup.parent = NIM_NIL;
			raiseExceptionEx((Exception*)T133_, "ValueError", "parseIPv6Address", "net.nim", 400);
			goto BeforeRet_;
		}
		LA131_: ;
		result._family_1.address_v6[((NI)((NI)(groupCount * ((NI) 2)) + byteCount))- 0] = ((NU8) (currentShort));
		groupCount += ((NI) 2);
	}
	LA87_: ;
	{
		tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T138_;
		if (!(((NI) 8) < groupCount)) goto LA136_;
		T138_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
		T138_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
		(*T138_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
		(*T138_).Sup.Sup.name = "ValueError";
		(*T138_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_27));
		(*T138_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T138_, "ValueError", "parseIPv6Address", "net.nim", 406);
		goto BeforeRet_;
	}
	goto LA134_;
	LA136_: ;
	{
		NI toFill;
		NI toShift;
		if (!(groupCount < ((NI) 8))) goto LA140_;
		{
			tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T146_;
			if (!(dualColonGroup == ((NI) -1))) goto LA144_;
			T146_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
			T146_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
			(*T146_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
			(*T146_).Sup.Sup.name = "ValueError";
			(*T146_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_32));
			(*T146_).Sup.Sup.parent = NIM_NIL;
			raiseExceptionEx((Exception*)T146_, "ValueError", "parseIPv6Address", "net.nim", 410);
			goto BeforeRet_;
		}
		LA144_: ;
		toFill = (NI)(((NI) 8) - groupCount);
		toShift = (NI)(groupCount - dualColonGroup);
		{
			NI i_5;
			NI colontmp__2;
			NI res;
			i_5 = (NI)0;
			colontmp__2 = (NI)0;
			colontmp__2 = (NI)((NI)(((NI) 2) * toShift) - ((NI) 1));
			res = ((NI) 0);
			{
				while (1) {
					if (!(res <= colontmp__2)) goto LA149;
					i_5 = res;
					result._family_1.address_v6[((NI)(((NI) 15) - i_5))- 0] = result._family_1.address_v6[((NI)((NI)((NI)(groupCount * ((NI) 2)) - i_5) - ((NI) 1)))- 0];
					res += ((NI) 1);
				} LA149: ;
			}
		}
		{
			NI i_6;
			NI colontmp__3;
			NI res_2;
			i_6 = (NI)0;
			colontmp__3 = (NI)0;
			colontmp__3 = (NI)((NI)(((NI) 2) * toFill) - ((NI) 1));
			res_2 = ((NI) 0);
			{
				while (1) {
					if (!(res_2 <= colontmp__3)) goto LA152;
					i_6 = res_2;
					result._family_1.address_v6[((NI)((NI)(dualColonGroup * ((NI) 2)) + i_6))- 0] = ((NU8) 0);
					res_2 += ((NI) 1);
				} LA152: ;
			}
		}
	}
	goto LA134_;
	LA140_: ;
	{
		tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T156_;
		if (!!((dualColonGroup == ((NI) -1)))) goto LA154_;
		T156_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
		T156_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
		(*T156_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
		(*T156_).Sup.Sup.name = "ValueError";
		(*T156_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_27));
		(*T156_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T156_, "ValueError", "parseIPv6Address", "net.nim", 419);
		goto BeforeRet_;
	}
	goto LA134_;
	LA154_: ;
	LA134_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA, parseIPv4Address__1ivqWNphfe1wCfgNmXXOCA_3)(NimStringDesc* addressStr) {
	tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA result;
	NI byteCount;
	NU16 currentByte;
	NIM_BOOL separatorValid;
{	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA));
	byteCount = ((NI) 0);
	currentByte = ((NU16) 0);
	separatorValid = NIM_FALSE;
	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA));
	result.family = ((tyEnum_IpAddressFamily__iqqacz9cr9bcNjYY74E10wPA) 1);
	{
		NI i;
		NI colontmp_;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		colontmp_ = ((addressStr ? addressStr->Sup.len : 0)-1);
		res = ((NI) 0);
		{
			while (1) {
				if (!(res <= colontmp_)) goto LA3;
				i = res;
				{
					if (!(((NU8)(addressStr->data[i])) >= ((NU8)(48)) && ((NU8)(addressStr->data[i])) <= ((NU8)(57)))) goto LA6_;
					currentByte = (NU16)((NU16)((NU16)((NU16)(currentByte) * (NU16)(((NU16) 10)))) + (NU16)(((NU16) ((NI)(((NU8)(addressStr->data[i])) - ((NI) 48))))));
					{
						tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T12_;
						if (!((NU16)(((NU16) 255)) < (NU16)(currentByte))) goto LA10_;
						T12_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
						T12_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
						(*T12_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
						(*T12_).Sup.Sup.name = "ValueError";
						(*T12_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_30));
						(*T12_).Sup.Sup.parent = NIM_NIL;
						raiseExceptionEx((Exception*)T12_, "ValueError", "parseIPv4Address", "net.nim", 282);
						goto BeforeRet_;
					}
					LA10_: ;
					separatorValid = NIM_TRUE;
				}
				goto LA4_;
				LA6_: ;
				{
					if (!((NU8)(addressStr->data[i]) == (NU8)(46))) goto LA14_;
					{
						NIM_BOOL T18_;
						tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T22_;
						T18_ = (NIM_BOOL)0;
						T18_ = !(separatorValid);
						if (T18_) goto LA19_;
						T18_ = (((NI) 3) <= byteCount);
						LA19_: ;
						if (!T18_) goto LA20_;
						T22_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
						T22_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
						(*T22_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
						(*T22_).Sup.Sup.name = "ValueError";
						(*T22_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_27));
						(*T22_).Sup.Sup.parent = NIM_NIL;
						raiseExceptionEx((Exception*)T22_, "ValueError", "parseIPv4Address", "net.nim", 287);
						goto BeforeRet_;
					}
					LA20_: ;
					result._family_2.address_v4[(byteCount)- 0] = ((NU8) (currentByte));
					currentByte = ((NU16) 0);
					byteCount += ((NI) 1);
					separatorValid = NIM_FALSE;
				}
				goto LA4_;
				LA14_: ;
				{
					tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T24_;
					T24_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
					T24_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
					(*T24_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
					(*T24_).Sup.Sup.name = "ValueError";
					(*T24_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_31));
					(*T24_).Sup.Sup.parent = NIM_NIL;
					raiseExceptionEx((Exception*)T24_, "ValueError", "parseIPv4Address", "net.nim", 294);
					goto BeforeRet_;
				}
				LA4_: ;
				res += ((NI) 1);
			} LA3: ;
		}
	}
	{
		NIM_BOOL T27_;
		tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T31_;
		T27_ = (NIM_BOOL)0;
		T27_ = !((byteCount == ((NI) 3)));
		if (T27_) goto LA28_;
		T27_ = !(separatorValid);
		LA28_: ;
		if (!T27_) goto LA29_;
		T31_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
		T31_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
		(*T31_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
		(*T31_).Sup.Sup.name = "ValueError";
		(*T31_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_24));
		(*T31_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T31_, "ValueError", "parseIPv4Address", "net.nim", 298);
		goto BeforeRet_;
	}
	LA29_: ;
	result._family_2.address_v4[(byteCount)- 0] = ((NU8) (currentByte));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA, parseIpAddress__1ivqWNphfe1wCfgNmXXOCA)(NimStringDesc* addressStr) {
	tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&result), sizeof(tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA));
	{
		tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw* T5_;
		if (!((addressStr ? addressStr->Sup.len : 0) == ((NI) 0))) goto LA3_;
		T5_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*)0;
		T5_ = (tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw*) newObj((&NTI__Ie1m0dv1ZHg72IgPRr1cDw_), sizeof(tyObject_ValueError__yoNlBGx0D2tRizIdhQuENw));
		(*T5_).Sup.Sup.Sup.m_type = (&NTI__yoNlBGx0D2tRizIdhQuENw_);
		(*T5_).Sup.Sup.name = "ValueError";
		(*T5_).Sup.Sup.message = copyString(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_23));
		(*T5_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T5_, "ValueError", "parseIpAddress", "net.nim", 426);
		goto BeforeRet_;
	}
	LA3_: ;
	{
		NIM_BOOL T8_;
		T8_ = (NIM_BOOL)0;
		T8_ = contains__Pa9a8m0kZYH6LC8N1EcZJdQsystem(addressStr->data, (addressStr ? addressStr->Sup.len : 0), 58);
		if (!T8_) goto LA9_;
		result = parseIPv6Address__1ivqWNphfe1wCfgNmXXOCA_2(addressStr);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		goto BeforeRet_;
	}
	goto LA6_;
	LA9_: ;
	{
		result = parseIPv4Address__1ivqWNphfe1wCfgNmXXOCA_3(addressStr);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		goto BeforeRet_;
	}
	LA6_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(Exception*, nimBorrowCurrentException)(void) {
	Exception* result;
	result = (Exception*)0;
	result = currException__9bVPeDJlYTi9bQApZpfH8wjg;
	return result;
}
static N_INLINE(void, popCurrentException)(void) {
	currException__9bVPeDJlYTi9bQApZpfH8wjg = (*currException__9bVPeDJlYTi9bQApZpfH8wjg).up;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, isIpAddress__lty7O9aUHIZT9cqYHeC2n5zA)(NimStringDesc* addressStr) {
	NIM_BOOL result;
	tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA T2_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NIM_BOOL)0;
	T2_ = parseIpAddress__1ivqWNphfe1wCfgNmXXOCA(addressStr);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	(void)(T2_);
	if (NIM_UNLIKELY(*nimErr_)) {
		LA1_:;
		if (isObj(nimBorrowCurrentException()->Sup.m_type, (&NTI__yoNlBGx0D2tRizIdhQuENw_))) {
			*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;
}
static N_INLINE(NCSTRING, nimToCStringConv)(NimStringDesc* s) {
	NCSTRING result;
	result = (NCSTRING)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (s == NIM_NIL);
		if (T3_) goto LA4_;
		T3_ = ((*s).Sup.len == ((NI) 0));
		LA4_: ;
		if (!T3_) goto LA5_;
		result = "";
	}
	goto LA1_;
	LA5_: ;
	{
		result = ((NCSTRING) ((*s).data));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, wrapConnectedSocket__zB421aJ04hXbpUeGq3doVQ)(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* ctx, tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, tyEnum_SslHandshakeType__9aZhh5f9bRDKgYB8GLASDSqg handshake, NimStringDesc* hostname) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	wrapSocket__nSrKttw9bOstnCyvh66mpmQ(ctx, socket);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	switch (handshake) {
	case ((tyEnum_SslHandshakeType__9aZhh5f9bRDKgYB8GLASDSqg) 0):
	{
		int ret;
		{
			NIM_BOOL T4_;
			NIM_BOOL T6_;
			NI T9_;
			T4_ = (NIM_BOOL)0;
			T4_ = (((NI) 0) < (hostname ? hostname->Sup.len : 0));
			if (!(T4_)) goto LA5_;
			T6_ = (NIM_BOOL)0;
			T6_ = isIpAddress__lty7O9aUHIZT9cqYHeC2n5zA(hostname);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			T4_ = !(T6_);
			LA5_: ;
			if (!T4_) goto LA7_;
			T9_ = (NI)0;
			T9_ = SSL_set_tlsext_host_name__jGR2GiKRQZ9cgDkYFu4P9aNg((*socket).sslHandle, nimToCStringConv(hostname));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			(void)(T9_);
		}
		LA7_: ;
		Dl_15675632_();
		ret = Dl_15665706_((*socket).sslHandle);
		socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, ((NI) (ret)), NIM_FALSE, ((NI32) -1), 0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	case ((tyEnum_SslHandshakeType__9aZhh5f9bRDKgYB8GLASDSqg) 1):
	{
		int ret_2;
		Dl_15675632_();
		ret_2 = Dl_15665723_((*socket).sslHandle);
		socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, ((NI) (ret_2)), NIM_FALSE, ((NI32) -1), 0);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	}
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI, send__5L0SyQu9bf9aWLpivLtuRdDg)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* data, NI size) {
	NI result;
{	result = (NI)0;
	{
		int T5_;
		if (!(*socket).isSsl) goto LA3_;
		Dl_15675632_();
		T5_ = (int)0;
		T5_ = Dl_15665714_((*socket).sslHandle, ((NCSTRING) (data)), size);
		result = ((NI) (T5_));
		goto BeforeRet_;
	}
	LA3_: ;
	result = send((*socket).fd, data, ((NI) (((int) (size)))), ((NI32) 0));
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, send__sP9af4zGpnwmZkRofZDfbQQ)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NimStringDesc* data, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags) {
	NI sent;
	void* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	T1_ = (void*)0;
	T1_ = ((void*) (nimToCStringConv(data)));
	sent = send__5L0SyQu9bf9aWLpivLtuRdDg(socket, T1_, (data ? data->Sup.len : 0));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NI32 lastError;
		if (!(sent < ((NI) 0))) goto LA4_;
		lastError = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, ((NI) -1), NIM_FALSE, lastError, flags);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA4_: ;
	{
		NI32 T10_;
		if (!!((sent == (data ? data->Sup.len : 0)))) goto LA8_;
		T10_ = (NI32)0;
		T10_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T10_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_33));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA8_: ;
	}BeforeRet_: ;
}
static N_NIMCALL(void, Marker_tyRef__OhBa09cfBAnY4MdnNlGabWQ)(void* p, NI op) {
	tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og* a;
	a = (tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og*)p;
	nimGCvisit((void*)(*a).Sup.Sup.parent, op);
	nimGCvisit((void*)(*a).Sup.Sup.message, op);
	nimGCvisit((void*)(*a).Sup.Sup.trace, op);
	nimGCvisit((void*)(*a).Sup.Sup.up, op);
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, hasDataBuffered__L6V0D3apf5iJeZChqzkovw)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* s) {
	NIM_BOOL result;
	result = (NIM_BOOL)0;
	result = NIM_FALSE;
	{
		NIM_BOOL T5_;
		if (!(*s).isBuffered) goto LA3_;
		T5_ = (NIM_BOOL)0;
		T5_ = (((NI) 0) < (*s).bufLen);
		if (!(T5_)) goto LA6_;
		T5_ = !(((*s).currPos == (*s).bufLen));
		LA6_: ;
		result = T5_;
	}
	LA3_: ;
	{
		NIM_BOOL T9_;
		T9_ = (NIM_BOOL)0;
		T9_ = (*s).isSsl;
		if (!(T9_)) goto LA10_;
		T9_ = !(result);
		LA10_: ;
		if (!T9_) goto LA11_;
		result = (*s).sslHasPeekChar;
	}
	LA11_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, select__9c4QMA6DGRJbXBL6Jy4sbPw)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* readfd, NI timeout) {
	NI result;
	tySequence__9apztJSmgERYU8fZOjI4pOg* fds;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = hasDataBuffered__L6V0D3apf5iJeZChqzkovw(readfd);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!T3_) goto LA4_;
		result = ((NI) 1);
		goto BeforeRet_;
	}
	LA4_: ;
	fds = (tySequence__9apztJSmgERYU8fZOjI4pOg*) newSeq((&NTI__9apztJSmgERYU8fZOjI4pOg_), 1);
	fds->data[0] = (*readfd).fd;
	result = selectRead__hYdMbc9crqOqsDFcxhERoLA((&fds), timeout);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, waitFor__mpNV4IG56MRYASsne34FNA)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw* waited, NI timeout, NI size, NimStringDesc* funcName) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	result = ((NI) 1);
	{
		if (!(size <= ((NI) 0))) goto LA3_;
	}
	LA3_: ;
	{
		if (!(timeout == ((NI) -1))) goto LA7_;
		result = size;
		goto BeforeRet_;
	}
	LA7_: ;
	{
		NIM_BOOL T11_;
		NIM_BOOL T12_;
		T11_ = (NIM_BOOL)0;
		T12_ = (NIM_BOOL)0;
		T12_ = (*socket).isBuffered;
		if (!(T12_)) goto LA13_;
		T12_ = !(((*socket).bufLen == ((NI) 0)));
		LA13_: ;
		T11_ = T12_;
		if (!(T11_)) goto LA14_;
		T11_ = !(((*socket).bufLen == (*socket).currPos));
		LA14_: ;
		if (!T11_) goto LA15_;
		result = (NI)((*socket).bufLen - (*socket).currPos);
		result = ((result <= size) ? result : size);
	}
	goto LA9_;
	LA15_: ;
	{
		tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w startTime;
		NI selRet;
		NI64 T38_;
		tyObject_MonoTime__FEvFMlkqJiSSGVO6HgTv8w T50_;
		tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw T51_;
		{
			NI64 T20_;
			tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og* T23_;
			NimStringDesc* T24_;
			T20_ = (NI64)0;
			T20_ = inMilliseconds__df0d89cDnRIju9aB6p1W1qVA((*waited));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!((NI64)(((NI64) (timeout)) - T20_) < IL64(1))) goto LA21_;
			T23_ = (tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og*)0;
			T23_ = (tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og*) newObj((&NTI__OhBa09cfBAnY4MdnNlGabWQ_), sizeof(tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og));
			(*T23_).Sup.Sup.Sup.m_type = (&NTI__VuFrIFILhVuaGaO5FCG0Og_);
			(*T23_).Sup.Sup.name = "TimeoutError";
			T24_ = (NimStringDesc*)0;
			T24_ = rawNewString((funcName ? funcName->Sup.len : 0) + 21);
appendString(T24_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_34));
appendString(T24_, funcName);
appendString(T24_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_35));
			(*T23_).Sup.Sup.message = T24_;
			(*T23_).Sup.Sup.parent = NIM_NIL;
			raiseExceptionEx((Exception*)T23_, "TimeoutError", "waitFor", "net.nim", 1359);
			goto BeforeRet_;
		}
		LA21_: ;
		{
			int sslPending;
			if (!(*socket).isSsl) goto LA27_;
			{
				NIM_BOOL T31_;
				T31_ = (NIM_BOOL)0;
				T31_ = hasDataBuffered__L6V0D3apf5iJeZChqzkovw(socket);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				if (!T31_) goto LA32_;
				result = ((NI) 1);
				goto BeforeRet_;
			}
			LA32_: ;
			sslPending = Dl_15665726_((*socket).sslHandle);
			{
				if (!!((sslPending == ((NI32) 0)))) goto LA36_;
				result = ((((NI) (sslPending)) <= size) ? ((NI) (sslPending)) : size);
				goto BeforeRet_;
			}
			LA36_: ;
		}
		LA27_: ;
		startTime = getMonoTime__QkEugs2Q2iFK9b83sl2B6wA();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T38_ = (NI64)0;
		T38_ = inMilliseconds__df0d89cDnRIju9aB6p1W1qVA((*waited));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		selRet = select__9c4QMA6DGRJbXBL6Jy4sbPw(socket, ((NI) ((NI64)(((NI64) (timeout)) - T38_))));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		{
			NI32 T43_;
			if (!(selRet < ((NI) 0))) goto LA41_;
			T43_ = (NI32)0;
			T43_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			raiseOSError__CWyPYlyH9a6rAuZckFyVxPA(T43_, ((NimStringDesc*) NIM_NIL));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA41_: ;
		{
			tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og* T48_;
			NimStringDesc* T49_;
			if (!!((selRet == ((NI) 1)))) goto LA46_;
			T48_ = (tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og*)0;
			T48_ = (tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og*) newObj((&NTI__OhBa09cfBAnY4MdnNlGabWQ_), sizeof(tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og));
			(*T48_).Sup.Sup.Sup.m_type = (&NTI__VuFrIFILhVuaGaO5FCG0Og_);
			(*T48_).Sup.Sup.name = "TimeoutError";
			T49_ = (NimStringDesc*)0;
			T49_ = rawNewString((funcName ? funcName->Sup.len : 0) + 21);
appendString(T49_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_34));
appendString(T49_, funcName);
appendString(T49_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_35));
			(*T48_).Sup.Sup.message = T49_;
			(*T48_).Sup.Sup.parent = NIM_NIL;
			raiseExceptionEx((Exception*)T48_, "TimeoutError", "waitFor", "net.nim", 1374);
			goto BeforeRet_;
		}
		LA46_: ;
		T50_ = getMonoTime__QkEugs2Q2iFK9b83sl2B6wA();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T51_ = minus___p9cBm7joedh4BwcboQ3HMVQ(T50_, startTime);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		pluseq___x4VoYzJQBbk9bAft9bFS7fyA(waited, T51_);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA9_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, uniRecv__YQlV9aRgVr9cJoVJlEPDJIqw)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* buffer, int size, int flags) {
	NI result;
{	result = (NI)0;
	result = ((NI) 0);
	{
		int T5_;
		if (!(*socket).isSsl) goto LA3_;
		Dl_15675632_();
		T5_ = (int)0;
		T5_ = Dl_15665709_((*socket).sslHandle, buffer, ((NI) (size)));
		result = ((NI) (T5_));
		goto BeforeRet_;
	}
	LA3_: ;
	result = recv((*socket).fd, buffer, ((NI) (size)), flags);
	goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, readIntoBuf__3VtccBbq17lyKCft9aSHtGA)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NI32 flags) {
	NI result;
	tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	result = ((NI) 0);
	T1_ = (tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*)0;
	T1_ = socket;
	result = uniRecv__YQlV9aRgVr9cJoVJlEPDJIqw(T1_, ((void*) ((*socket).buffer)), ((int) 4000), flags);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NI32 T6_;
		if (!(result < ((NI) 0))) goto LA4_;
		T6_ = (NI32)0;
		T6_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		(*socket).lastError = T6_;
	}
	LA4_: ;
	{
		if (!(result <= ((NI) 0))) goto LA9_;
		(*socket).bufLen = ((NI) 0);
		(*socket).currPos = ((NI) 0);
		goto BeforeRet_;
	}
	LA9_: ;
	(*socket).bufLen = result;
	(*socket).currPos = ((NI) 0);
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, recv__5L0SyQu9bf9aWLpivLtuRdDg_2)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* data, NI size) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (!(size == ((NI) 0))) goto LA3_;
		goto BeforeRet_;
	}
	LA3_: ;
	{
		NI read;
		if (!(*socket).isBuffered) goto LA7_;
		{
			NI res;
			if (!((*socket).bufLen == ((NI) 0))) goto LA11_;
			res = readIntoBuf__3VtccBbq17lyKCft9aSHtGA(socket, ((NI32) 0));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				if (!(res <= ((NI) 0))) goto LA15_;
				{
					if (!NIM_FALSE) goto LA19_;
					result = ((NI) 0);
					goto BeforeRet_;
				}
				goto LA17_;
				LA19_: ;
				{
					result = res;
					goto BeforeRet_;
				}
				LA17_: ;
			}
			LA15_: ;
		}
		LA11_: ;
		read = ((NI) 0);
		{
			while (1) {
				NI chunk;
				NCSTRING d;
				if (!(read < size)) goto LA23;
				{
					NI res_2;
					if (!((*socket).bufLen <= (*socket).currPos)) goto LA26_;
					res_2 = readIntoBuf__3VtccBbq17lyKCft9aSHtGA(socket, ((NI32) 0));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					{
						if (!(res_2 <= ((NI) 0))) goto LA30_;
						{
							if (!(((NI) 0) < read)) goto LA34_;
							result = read;
							goto BeforeRet_;
						}
						goto LA32_;
						LA34_: ;
						{
							result = res_2;
							goto BeforeRet_;
						}
						LA32_: ;
					}
					LA30_: ;
				}
				LA26_: ;
				chunk = (((NI)((*socket).bufLen - (*socket).currPos) <= (NI)(size - read)) ? (NI)((*socket).bufLen - (*socket).currPos) : (NI)(size - read));
				d = ((NCSTRING) (data));
				copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&d[read]))), ((void*) ((&(*socket).buffer[((*socket).currPos)- 0]))), ((NI) (chunk)));
				read += chunk;
				(*socket).currPos += chunk;
			} LA23: ;
		}
		result = read;
	}
	goto LA5_;
	LA7_: ;
	{
		{
			if (!(*socket).isSsl) goto LA40_;
			{
				if (!(*socket).sslHasPeekChar) goto LA44_;
				copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(data, ((void*) ((&(*socket).sslPeekChar))), ((NI) 1));
				(*socket).sslHasPeekChar = NIM_FALSE;
				{
					NCSTRING d_2;
					NI T50_;
					if (!(((NI) 0) < (NI)(size - ((NI) 1)))) goto LA48_;
					d_2 = ((NCSTRING) (data));
					T50_ = (NI)0;
					T50_ = uniRecv__YQlV9aRgVr9cJoVJlEPDJIqw(socket, ((void*) ((&d_2[((NI) 1)]))), ((int) ((NI)(size - ((NI) 1)))), ((NI32) 0));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					result = (NI)(T50_ + ((NI) 1));
				}
				goto LA46_;
				LA48_: ;
				{
					result = ((NI) 1);
				}
				LA46_: ;
			}
			goto LA42_;
			LA44_: ;
			{
				result = uniRecv__YQlV9aRgVr9cJoVJlEPDJIqw(socket, data, ((int) (size)), ((NI32) 0));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			LA42_: ;
		}
		goto LA38_;
		LA40_: ;
		{
			result = recv((*socket).fd, data, ((NI) (((int) (size)))), ((NI32) 0));
		}
		LA38_: ;
		{
			NI32 T58_;
			if (!(result < ((NI) 0))) goto LA56_;
			T58_ = (NI32)0;
			T58_ = osLastError__9bUWNxbcGnToMWA9b79aTXLIw();
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			(*socket).lastError = T58_;
		}
		LA56_: ;
	}
	LA5_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, peekChar__vy4VpuiQuyO2yjz3cp2FxQ)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NIM_CHAR* c) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	{
		if (!(*socket).isBuffered) goto LA3_;
		result = ((NI) 1);
		{
			NIM_BOOL T7_;
			NI res;
			T7_ = (NIM_BOOL)0;
			T7_ = ((*socket).bufLen == ((NI) 0));
			if (T7_) goto LA8_;
			T7_ = ((NI)((*socket).bufLen - ((NI) 1)) < (*socket).currPos);
			LA8_: ;
			if (!T7_) goto LA9_;
			res = readIntoBuf__3VtccBbq17lyKCft9aSHtGA(socket, ((NI32) 0));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				if (!(res <= ((NI) 0))) goto LA13_;
				result = res;
			}
			LA13_: ;
		}
		LA9_: ;
		(*c) = (*socket).buffer[((*socket).currPos)- 0];
	}
	goto LA1_;
	LA3_: ;
	{
		{
			if (!(*socket).isSsl) goto LA18_;
			{
				tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* T24_;
				if (!!((*socket).sslHasPeekChar)) goto LA22_;
				T24_ = (tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*)0;
				T24_ = socket;
				result = uniRecv__YQlV9aRgVr9cJoVJlEPDJIqw(T24_, ((void*) ((&(*socket).sslPeekChar))), ((int) 1), ((NI32) 0));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				(*socket).sslHasPeekChar = NIM_TRUE;
			}
			LA22_: ;
			(*c) = (*socket).sslPeekChar;
			goto BeforeRet_;
		}
		LA18_: ;
		result = recv((*socket).fd, ((void*) (c)), ((NI) 1), MSG_PEEK);
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, readLine__0WLvm80r9c7KImcDRmm5IDg)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NimStringDesc** line, NI timeout, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags, NI maxLength) {
	tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw waited;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	nimZeroMem((void*)(&waited), sizeof(tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw));
	(*line) = setLengthStr((*line), ((NI) 0));
	{
		while (1) {
			NIM_CHAR c;
			NI T3_;
			NI n;
			c = (NIM_CHAR)0;
			T3_ = (NI)0;
			T3_ = waitFor__mpNV4IG56MRYASsne34FNA(socket, (&waited), timeout, ((NI) 1), ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_36));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			(void)(T3_);
			n = recv__5L0SyQu9bf9aWLpivLtuRdDg_2(socket, ((void*) ((&c))), ((NI) 1));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				NI32 lastError;
				if (!(n < ((NI) 0))) goto LA6_;
				lastError = getSocketError__YATB019buW9cFOjCCZLlKipQ(socket);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T10_;
					T10_ = (NIM_BOOL)0;
					T10_ = isDisconnectionError__XxybNfLJKXhPAkMhmPhNzQ(flags, lastError);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					if (!T10_) goto LA11_;
					(*line) = setLengthStr((*line), ((NI) 0));
				}
				LA11_: ;
				socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, n, NIM_FALSE, lastError, flags);
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			}
			goto LA4_;
			LA6_: ;
			{
				if (!(n == ((NI) 0))) goto LA14_;
				(*line) = setLengthStr((*line), ((NI) 0));
				goto BeforeRet_;
			}
			goto LA4_;
			LA14_: ;
			LA4_: ;
			{
				NI T20_;
				if (!((NU8)(c) == (NU8)(13))) goto LA18_;
				T20_ = (NI)0;
				T20_ = waitFor__mpNV4IG56MRYASsne34FNA(socket, (&waited), timeout, ((NI) 1), ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_36));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				(void)(T20_);
				n = peekChar__vy4VpuiQuyO2yjz3cp2FxQ(socket, (&c));
				if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				{
					NIM_BOOL T23_;
					NI T27_;
					T23_ = (NIM_BOOL)0;
					T23_ = (((NI) 0) < n);
					if (!(T23_)) goto LA24_;
					T23_ = ((NU8)(c) == (NU8)(10));
					LA24_: ;
					if (!T23_) goto LA25_;
					T27_ = (NI)0;
					T27_ = recv__5L0SyQu9bf9aWLpivLtuRdDg_2(socket, ((void*) ((&c))), ((NI) 1));
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					(void)(T27_);
				}
				goto LA21_;
				LA25_: ;
				{
					NI32 lastError_2;
					if (!(n <= ((NI) 0))) goto LA29_;
					lastError_2 = getSocketError__YATB019buW9cFOjCCZLlKipQ(socket);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
					{
						NIM_BOOL T33_;
						T33_ = (NIM_BOOL)0;
						T33_ = isDisconnectionError__XxybNfLJKXhPAkMhmPhNzQ(flags, lastError_2);
						if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
						if (!T33_) goto LA34_;
						(*line) = setLengthStr((*line), ((NI) 0));
					}
					LA34_: ;
					socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, n, NIM_FALSE, lastError_2, flags);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
				goto LA21_;
				LA29_: ;
				LA21_: ;
				{
					if (!(((*line) ? (*line)->Sup.len : 0) == ((NI) 0))) goto LA38_;
					(*line) = resizeString((*line), 2);
appendString((*line), ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_37));
				}
				LA38_: ;
				goto BeforeRet_;
			}
			goto LA16_;
			LA18_: ;
			{
				if (!((NU8)(c) == (NU8)(10))) goto LA41_;
				{
					if (!(((*line) ? (*line)->Sup.len : 0) == ((NI) 0))) goto LA45_;
					(*line) = resizeString((*line), 2);
appendString((*line), ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_37));
				}
				LA45_: ;
				goto BeforeRet_;
			}
			goto LA16_;
			LA41_: ;
			LA16_: ;
			(*line) = addChar((*line), c);
			{
				if (!(maxLength < ((*line) ? (*line)->Sup.len : 0))) goto LA49_;
				goto LA1;
			}
			LA49_: ;
		}
	} LA1: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, recvLine__xQiPYgNz7DM0cyQl7evHRQ)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NI timeout, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags, NI maxLength) {
	NimStringDesc* result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NimStringDesc*)0;
	result = ((NimStringDesc*) NIM_NIL);
	readLine__0WLvm80r9c7KImcDRmm5IDg(socket, (&result), timeout, flags, maxLength);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, recv__s9bHVcCkcztbhZorVAO5UpA)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, void* data, NI size, NI timeout) {
	NI result;
	tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw waited;
	NI read;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	nimZeroMem((void*)(&waited), sizeof(tyObject_Duration__lj9ar6Co3fgk6NgGnVaNpJw));
	read = ((NI) 0);
	{
		while (1) {
			NI avail;
			NCSTRING d;
			if (!(read < size)) goto LA2;
			avail = waitFor__mpNV4IG56MRYASsne34FNA(socket, (&waited), timeout, (NI)(size - read), ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_38));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			d = ((NCSTRING) (data));
			result = recv__5L0SyQu9bf9aWLpivLtuRdDg_2(socket, ((void*) ((&d[read]))), avail);
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			{
				if (!(result == ((NI) 0))) goto LA5_;
				goto LA1;
			}
			LA5_: ;
			{
				if (!(result < ((NI) 0))) goto LA9_;
				goto BeforeRet_;
			}
			LA9_: ;
			read += result;
		} LA2: ;
	} LA1: ;
	result = read;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, recv__WAuvR33LNsmM2rTnugz1Lw)(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ* socket, NimStringDesc** data, NI size, NI timeout, tySet_tyEnum_SocketFlag__4xio0cAXR7XG4pF9bVcpxEg flags) {
	NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (NI)0;
	(*data) = setLengthStr((*data), ((NI) (size)));
	{
		if (!(timeout == ((NI) -1))) goto LA3_;
		result = recv__5L0SyQu9bf9aWLpivLtuRdDg_2(socket, ((void*) (nimToCStringConv((*data)))), size);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA1_;
	LA3_: ;
	{
		result = recv__s9bHVcCkcztbhZorVAO5UpA(socket, ((void*) (nimToCStringConv((*data)))), size, timeout);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA1_: ;
	{
		NI32 lastError;
		if (!(result < ((NI) 0))) goto LA8_;
		(*data) = setLengthStr((*data), ((NI) 0));
		lastError = getSocketError__YATB019buW9cFOjCCZLlKipQ(socket);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		socketError__OvHxk9cQ7Y9cpNf9bNuX4awrg(socket, result, NIM_FALSE, lastError, flags);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	goto LA6_;
	LA8_: ;
	{
		(*data) = setLengthStr((*data), ((NI) (result)));
	}
	LA6_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(int, SSL_CTX_set_ecdh_auto__7FfmdDMi8b9aPt5ijVCCYfwopenssl)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, int onoff) {
	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__dJsO04BYfgh1GDCx4NNEgA();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T3_ = ((NU64)(T4_) < (NU64)(((NU) 269484032)));
		if (T3_) goto LA5_;
		T6_ = (unsigned long)0;
		T6_ = getOpenSSLVersion__dJsO04BYfgh1GDCx4NNEgA();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T3_ = (T6_ == ((NU) 536870912));
		LA5_: ;
		if (!T3_) goto LA7_;
		T9_ = (long)0;
		T9_ = Dl_15675414_(ctx, ((int) 94), ((long) (onoff)), NIM_NIL);
		result = ((int) (T9_));
	}
	goto LA1_;
	LA7_: ;
	{
		result = ((int) 1);
	}
	LA1_: ;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, loadCertificates__geRWUgM7mn0muJSOQgdeJg)(tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* ctx, NimStringDesc* certFile, NimStringDesc* keyFile) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	{
		NIM_BOOL T3_;
		NIM_BOOL T5_;
		tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw* T8_;
		NimStringDesc* T9_;
		T3_ = (NIM_BOOL)0;
		T3_ = !(((certFile ? certFile->Sup.len : 0) == 0));
		if (!(T3_)) goto LA4_;
		T5_ = (NIM_BOOL)0;
		T5_ = nosfileExists(certFile);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T3_ = !(T5_);
		LA4_: ;
		if (!T3_) goto LA6_;
		T8_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*)0;
		T8_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*) newObj((&NTI__HMIVdYjdZYWskTmTQVo5BQ_), sizeof(tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw));
		(*T8_).Sup.Sup.Sup.m_type = (&NTI__iLZrPn9anoh9ad1MmO0RczFw_);
		(*T8_).Sup.Sup.name = "IOError";
		T9_ = (NimStringDesc*)0;
		T9_ = rawNewString((certFile ? certFile->Sup.len : 0) + 37);
appendString(T9_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_41));
appendString(T9_, certFile);
		(*T8_).Sup.Sup.message = T9_;
		(*T8_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T8_, "IOError", "loadCertificates", "net.nim", 533);
		goto BeforeRet_;
	}
	LA6_: ;
	{
		NIM_BOOL T12_;
		NIM_BOOL T14_;
		tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw* T17_;
		NimStringDesc* T18_;
		T12_ = (NIM_BOOL)0;
		T12_ = !(((keyFile ? keyFile->Sup.len : 0) == 0));
		if (!(T12_)) goto LA13_;
		T14_ = (NIM_BOOL)0;
		T14_ = nosfileExists(keyFile);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		T12_ = !(T14_);
		LA13_: ;
		if (!T12_) goto LA15_;
		T17_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*)0;
		T17_ = (tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw*) newObj((&NTI__HMIVdYjdZYWskTmTQVo5BQ_), sizeof(tyObject_IOError__iLZrPn9anoh9ad1MmO0RczFw));
		(*T17_).Sup.Sup.Sup.m_type = (&NTI__iLZrPn9anoh9ad1MmO0RczFw_);
		(*T17_).Sup.Sup.name = "IOError";
		T18_ = (NimStringDesc*)0;
		T18_ = rawNewString((keyFile ? keyFile->Sup.len : 0) + 29);
appendString(T18_, ((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_42));
appendString(T18_, keyFile);
		(*T17_).Sup.Sup.message = T18_;
		(*T17_).Sup.Sup.parent = NIM_NIL;
		raiseExceptionEx((Exception*)T17_, "IOError", "loadCertificates", "net.nim", 536);
		goto BeforeRet_;
	}
	LA15_: ;
	{
		int ret;
		if (!!(((certFile ? certFile->Sup.len : 0) == 0))) goto LA21_;
		ret = Dl_15665664_(ctx, nimToCStringConv(certFile));
		{
			if (!!((ret == ((NI32) 1)))) goto LA25_;
			raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA25_: ;
	}
	LA21_: ;
	{
		if (!!(((keyFile ? keyFile->Sup.len : 0) == 0))) goto LA29_;
		{
			int T33_;
			T33_ = (int)0;
			T33_ = Dl_15665668_(ctx, nimToCStringConv(keyFile), ((int) 1));
			if (!!((T33_ == ((NI32) 1)))) goto LA34_;
			raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA34_: ;
		{
			int T38_;
			T38_ = (int)0;
			T38_ = Dl_15665673_(ctx);
			if (!!((T38_ == ((NI32) 1)))) goto LA39_;
			raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_43));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA39_: ;
	}
	LA29_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w*, newContext__p45vOS9b3iK2JJ1Y7aIJ9bUA)(tyEnum_SslProtVersion__zq9bkhgPAE6ngdz7HLdOTDw protVersion, tyEnum_SslCVerifyMode__t9a9cuHiKUd7w4o8XPQAbfJg verifyMode, NimStringDesc* certFile, NimStringDesc* keyFile, NimStringDesc* cipherList, NimStringDesc* caDir, NimStringDesc* caFile) {
	tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* result;
	tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* newCTX;
	unsigned long sslVersion;
	NI T32_;
	tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w* T33_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
	result = (tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w*)0;
	newCTX = (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw*)0;
	switch (protVersion) {
	case ((tyEnum_SslProtVersion__zq9bkhgPAE6ngdz7HLdOTDw) 3):
	{
		tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* T2_;
		T2_ = (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw*)0;
		T2_ = SSLv23_method__LTfNTmKR6aBlZTkY8nHSxg();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		newCTX = Dl_15665632_(T2_);
	}
	break;
	case ((tyEnum_SslProtVersion__zq9bkhgPAE6ngdz7HLdOTDw) 0):
	{
		raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_39));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	case ((tyEnum_SslProtVersion__zq9bkhgPAE6ngdz7HLdOTDw) 1):
	{
		raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_40));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	break;
	case ((tyEnum_SslProtVersion__zq9bkhgPAE6ngdz7HLdOTDw) 2):
	{
		tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw* T6_;
		T6_ = (tyObject_SslStruct__hZKic6WnTBMq6Usbg49bnhw*)0;
		T6_ = Dl_15651252_();
		newCTX = Dl_15665632_(T6_);
	}
	break;
	}
	{
		int T9_;
		T9_ = (int)0;
		T9_ = Dl_15665655_(newCTX, nimToCStringConv(cipherList));
		if (!!((T9_ == ((NI32) 1)))) goto LA10_;
		raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA10_: ;
	sslVersion = getOpenSSLVersion__dJsO04BYfgh1GDCx4NNEgA();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		NIM_BOOL T14_;
		T14_ = (NIM_BOOL)0;
		T14_ = ((NU64)(((NU) 269488128)) <= (NU64)(sslVersion));
		if (!(T14_)) goto LA15_;
		T14_ = ((NU)((NU64) ~(sslVersion)) == ((NU) 536870912));
		LA15_: ;
		if (!T14_) goto LA16_;
		{
			int T20_;
			T20_ = (int)0;
			T20_ = SSL_CTX_set_ciphersuites__WApCSzGH2uqCDm9bYkShtQw(newCTX, nimToCStringConv(cipherList));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
			if (!!((T20_ == ((NI32) 1)))) goto LA21_;
			raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
			if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		}
		LA21_: ;
	}
	LA16_: ;
	{
		int T25_;
		T25_ = (int)0;
		T25_ = SSL_CTX_set_ecdh_auto__7FfmdDMi8b9aPt5ijVCCYfwopenssl(newCTX, ((int) 1));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!((T25_ == ((NI32) 1)))) goto LA26_;
		raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA26_: ;
	Dl_15665643_(newCTX, ((NI) 0), NIM_NIL);
	{
		if (!(newCTX == NIM_NIL)) goto LA30_;
		raiseSSLError__4bk00w9al9cfmeFR9a9cMW860g(((NimStringDesc*) NIM_NIL));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA30_: ;
	T32_ = (NI)0;
	T32_ = SSLCTXSetMode__u4DGuCXu9asDo9aQgd9cu5QNQ(newCTX, ((NI) 4));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(void)(T32_);
	loadCertificates__geRWUgM7mn0muJSOQgdeJg(newCTX, certFile, keyFile);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	T33_ = (tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w*)0;
	T33_ = (tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w*) newObj((&NTI__LP7l6kWJNPJLySYXWH5AYA_), sizeof(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w));
	(*T33_).context = newCTX;
	initHashSet__rkx2SGa9c4bJGzaJP7jTaxg(((NI) 64), (&(*T33_).referencedData));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	(*T33_).extraInternal = new__5koBfXFt4Ec5TaAoLmPrsw();
	result = T33_;
	}BeforeRet_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, stdlib_netInit000)(void) {
{
NIM_BOOL* nimErr_;
nimErr_ = nimErrorFlag();
	CRYPTO_malloc_init__G2BDIxFj2W9ajANxAoi8oZA();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		int T3_;
		T3_ = (int)0;
		T3_ = SSL_library_init__6SfBfS64wp6JZihQGGrnKg();
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
		if (!!((T3_ == ((NI32) 1)))) goto LA4_;
		failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__XqsrSBxhOTPgLQ9cX4MmV4A_2));
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA4_: ;
	SSL_load_error_strings__G2BDIxFj2W9ajANxAoi8oZA_2();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	Dl_15665614_();
	OpenSSL_add_all_algorithms__G2BDIxFj2W9ajANxAoi8oZA_3();
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	BeforeRet_: ;
}
}

N_LIB_PRIVATE N_NIMCALL(void, stdlib_netDatInit000)(void) {

/* section: NIM_merge_TYPE_INIT1 */
static TNimNode* TM__XqsrSBxhOTPgLQ9cX4MmV4A_3_3[3];
static TNimNode* TM__XqsrSBxhOTPgLQ9cX4MmV4A_4_2[2];
static TNimNode* TM__XqsrSBxhOTPgLQ9cX4MmV4A_5_2[2];
static TNimNode* TM__XqsrSBxhOTPgLQ9cX4MmV4A_6_2[2];
static TNimNode* TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[16];
static TNimNode TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[32];

/* section: NIM_merge_TYPE_INIT3 */
NTI__nNdejAl9bbVbX7sP6RJ4h0w_.size = sizeof(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w);
NTI__nNdejAl9bbVbX7sP6RJ4h0w_.align = NIM_ALIGNOF(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w);
NTI__nNdejAl9bbVbX7sP6RJ4h0w_.kind = 18;
NTI__nNdejAl9bbVbX7sP6RJ4h0w_.base = 0;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_3_3[0] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[1];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[1].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[1].offset = offsetof(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w, context);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[1].typ = (&NTI__QQ33RYEe889cv60wm9bVkd8A_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[1].name = "context";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_3_3[1] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[2];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[2].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[2].offset = offsetof(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w, referencedData);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[2].typ = (&NTI__bGAilYs5sUICRbD13gZaFg_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[2].name = "referencedData";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_3_3[2] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[3];
NTI__22zILeNTc8ClX7DrPZ3XOQ_.size = sizeof(tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ);
NTI__22zILeNTc8ClX7DrPZ3XOQ_.align = NIM_ALIGNOF(tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ);
NTI__22zILeNTc8ClX7DrPZ3XOQ_.kind = 17;
NTI__22zILeNTc8ClX7DrPZ3XOQ_.base = (&NTI__ytyiCJqK439aF9cIibuRVpAg_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_4_2[0] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[5];
NTI__oFHfEKFsiYTMAy9a42cSiKw_.size = sizeof(tyTuple__JfHvHzMrhKkWAUvQKe0i1A);
NTI__oFHfEKFsiYTMAy9a42cSiKw_.align = NIM_ALIGNOF(tyTuple__JfHvHzMrhKkWAUvQKe0i1A);
NTI__oFHfEKFsiYTMAy9a42cSiKw_.kind = 18;
NTI__oFHfEKFsiYTMAy9a42cSiKw_.base = 0;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_5_2[0] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[7];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[7].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[7].offset = offsetof(tyTuple__JfHvHzMrhKkWAUvQKe0i1A, Field0);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[7].typ = (&NTI__vr5DoT1jILTGdRlYv1OYpw_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[7].name = "Field0";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_5_2[1] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[8];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[8].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[8].offset = offsetof(tyTuple__JfHvHzMrhKkWAUvQKe0i1A, Field1);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[8].typ = (&NTI__HsJiUUcO9cHBdUCi0HwkSTA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[8].name = "Field1";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[6].len = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[6].kind = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[6].sons = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_5_2[0];
NTI__oFHfEKFsiYTMAy9a42cSiKw_.node = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[6];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[5].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[5].offset = offsetof(tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ, serverGetPskFunc);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[5].typ = (&NTI__oFHfEKFsiYTMAy9a42cSiKw_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[5].name = "serverGetPskFunc";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_4_2[1] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[9];
NTI__lYMtBEH0vEMRzoDaCw5CJg_.size = sizeof(tyTuple__JfHvHzMrhKkWAUvQKe0i1A);
NTI__lYMtBEH0vEMRzoDaCw5CJg_.align = NIM_ALIGNOF(tyTuple__JfHvHzMrhKkWAUvQKe0i1A);
NTI__lYMtBEH0vEMRzoDaCw5CJg_.kind = 18;
NTI__lYMtBEH0vEMRzoDaCw5CJg_.base = 0;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_6_2[0] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[11];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[11].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[11].offset = offsetof(tyTuple__JfHvHzMrhKkWAUvQKe0i1A, Field0);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[11].typ = (&NTI__vr5DoT1jILTGdRlYv1OYpw_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[11].name = "Field0";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_6_2[1] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[12];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[12].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[12].offset = offsetof(tyTuple__JfHvHzMrhKkWAUvQKe0i1A, Field1);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[12].typ = (&NTI__HsJiUUcO9cHBdUCi0HwkSTA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[12].name = "Field1";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[10].len = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[10].kind = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[10].sons = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_6_2[0];
NTI__lYMtBEH0vEMRzoDaCw5CJg_.node = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[10];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[9].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[9].offset = offsetof(tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ, clientGetPskFunc);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[9].typ = (&NTI__lYMtBEH0vEMRzoDaCw5CJg_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[9].name = "clientGetPskFunc";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[4].len = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[4].kind = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[4].sons = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_4_2[0];
NTI__22zILeNTc8ClX7DrPZ3XOQ_.node = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[4];
NTI__t2PQ49cw9cyPD5BKolxzFbTw_.size = sizeof(tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ*);
NTI__t2PQ49cw9cyPD5BKolxzFbTw_.align = NIM_ALIGNOF(tyObject_SslContextExtraInternalcolonObjectType___22zILeNTc8ClX7DrPZ3XOQ*);
NTI__t2PQ49cw9cyPD5BKolxzFbTw_.kind = 22;
NTI__t2PQ49cw9cyPD5BKolxzFbTw_.base = (&NTI__22zILeNTc8ClX7DrPZ3XOQ_);
NTI__t2PQ49cw9cyPD5BKolxzFbTw_.marker = Marker_tyRef__t2PQ49cw9cyPD5BKolxzFbTw;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[3].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[3].offset = offsetof(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w, extraInternal);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[3].typ = (&NTI__t2PQ49cw9cyPD5BKolxzFbTw_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[3].name = "extraInternal";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[0].len = 3; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[0].kind = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[0].sons = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_3_3[0];
NTI__nNdejAl9bbVbX7sP6RJ4h0w_.node = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[0];
NTI__LP7l6kWJNPJLySYXWH5AYA_.size = sizeof(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w*);
NTI__LP7l6kWJNPJLySYXWH5AYA_.align = NIM_ALIGNOF(tyObject_SslContextcolonObjectType___nNdejAl9bbVbX7sP6RJ4h0w*);
NTI__LP7l6kWJNPJLySYXWH5AYA_.kind = 22;
NTI__LP7l6kWJNPJLySYXWH5AYA_.base = (&NTI__nNdejAl9bbVbX7sP6RJ4h0w_);
NTI__LP7l6kWJNPJLySYXWH5AYA_.marker = Marker_tyRef__LP7l6kWJNPJLySYXWH5AYA;
NTI__GtD0IEVE1EOWxaU5x9amdzA_.size = sizeof(tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA);
NTI__GtD0IEVE1EOWxaU5x9amdzA_.align = NIM_ALIGNOF(tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA);
NTI__GtD0IEVE1EOWxaU5x9amdzA_.kind = 17;
NTI__GtD0IEVE1EOWxaU5x9amdzA_.base = (&NTI__qrLSDoe2oBoAqNtJ9badtnA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[13].len = 0; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[13].kind = 2;
NTI__GtD0IEVE1EOWxaU5x9amdzA_.node = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[13];
NTI__VoScTqHOwyXBt9b3u4T1Ksw_.size = sizeof(tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*);
NTI__VoScTqHOwyXBt9b3u4T1Ksw_.align = NIM_ALIGNOF(tyObject_SslError__GtD0IEVE1EOWxaU5x9amdzA*);
NTI__VoScTqHOwyXBt9b3u4T1Ksw_.kind = 22;
NTI__VoScTqHOwyXBt9b3u4T1Ksw_.base = (&NTI__GtD0IEVE1EOWxaU5x9amdzA_);
NTI__VoScTqHOwyXBt9b3u4T1Ksw_.marker = Marker_tyRef__VoScTqHOwyXBt9b3u4T1Ksw;
NTI__aIhANOOoETolVz9cccNO9cRQ_.size = sizeof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ);
NTI__aIhANOOoETolVz9cccNO9cRQ_.align = NIM_ALIGNOF(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ);
NTI__aIhANOOoETolVz9cccNO9cRQ_.kind = 18;
NTI__aIhANOOoETolVz9cccNO9cRQ_.base = 0;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[0] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[15];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[15].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[15].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, fd);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[15].typ = (&NTI__nlCscttRCss70IBTyuBqnA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[15].name = "fd";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[1] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[16];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[16].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[16].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, isBuffered);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[16].typ = (&NTI__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[16].name = "isBuffered";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[2] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[17];
NTI__QQGLPNVVwLhYjkngqAxXQQ_.size = sizeof(tyArray__QQGLPNVVwLhYjkngqAxXQQ);
NTI__QQGLPNVVwLhYjkngqAxXQQ_.align = NIM_ALIGNOF(tyArray__QQGLPNVVwLhYjkngqAxXQQ);
NTI__QQGLPNVVwLhYjkngqAxXQQ_.kind = 16;
NTI__QQGLPNVVwLhYjkngqAxXQQ_.base = (&NTI__nmiMWKVIe46vacnhAFrQvw_);
NTI__QQGLPNVVwLhYjkngqAxXQQ_.flags = 3;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[17].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[17].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, buffer);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[17].typ = (&NTI__QQGLPNVVwLhYjkngqAxXQQ_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[17].name = "buffer";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[3] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[18];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[18].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[18].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, currPos);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[18].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[18].name = "currPos";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[4] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[19];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[19].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[19].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, bufLen);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[19].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[19].name = "bufLen";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[5] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[20];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[20].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[20].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, isSsl);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[20].typ = (&NTI__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[20].name = "isSsl";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[6] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[21];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[21].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[21].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, sslHandle);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[21].typ = (&NTI__QQ33RYEe889cv60wm9bVkd8A_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[21].name = "sslHandle";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[7] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[22];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[22].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[22].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, sslContext);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[22].typ = (&NTI__LP7l6kWJNPJLySYXWH5AYA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[22].name = "sslContext";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[8] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[23];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[23].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[23].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, sslNoHandshake);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[23].typ = (&NTI__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[23].name = "sslNoHandshake";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[9] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[24];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[24].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[24].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, sslHasPeekChar);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[24].typ = (&NTI__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[24].name = "sslHasPeekChar";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[10] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[25];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[25].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[25].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, sslPeekChar);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[25].typ = (&NTI__nmiMWKVIe46vacnhAFrQvw_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[25].name = "sslPeekChar";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[11] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[26];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[26].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[26].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, sslNoShutdown);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[26].typ = (&NTI__VaVACK0bpYmqIQ0mKcHfQQ_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[26].name = "sslNoShutdown";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[12] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[27];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[27].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[27].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, lastError);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[27].typ = (&NTI__sVg18TP9cLifHyygRe9cro9aA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[27].name = "lastError";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[13] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[28];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[28].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[28].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, domain);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[28].typ = (&NTI__Q79bEtFARvq0ekDNtvj3Vqg_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[28].name = "domain";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[14] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[29];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[29].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[29].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, sockType);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[29].typ = (&NTI__NQT1bItGG2X9byGdrWX7ujw_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[29].name = "sockType";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[15] = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[30];
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[30].kind = 1;
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[30].offset = offsetof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ, protocol);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[30].typ = (&NTI__dqJ1OqRGclxIMMdSLRzzXg_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[30].name = "protocol";
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[14].len = 16; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[14].kind = 2; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[14].sons = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_21_16[0];
NTI__aIhANOOoETolVz9cccNO9cRQ_.node = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[14];
NTI__MkGXUPMSENeRDS7EppfLgA_.size = sizeof(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*);
NTI__MkGXUPMSENeRDS7EppfLgA_.align = NIM_ALIGNOF(tyObject_SocketImpl__aIhANOOoETolVz9cccNO9cRQ*);
NTI__MkGXUPMSENeRDS7EppfLgA_.kind = 22;
NTI__MkGXUPMSENeRDS7EppfLgA_.base = (&NTI__aIhANOOoETolVz9cccNO9cRQ_);
NTI__MkGXUPMSENeRDS7EppfLgA_.marker = Marker_tyRef__MkGXUPMSENeRDS7EppfLgA;
NTI__VuFrIFILhVuaGaO5FCG0Og_.size = sizeof(tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og);
NTI__VuFrIFILhVuaGaO5FCG0Og_.align = NIM_ALIGNOF(tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og);
NTI__VuFrIFILhVuaGaO5FCG0Og_.kind = 17;
NTI__VuFrIFILhVuaGaO5FCG0Og_.base = (&NTI__qrLSDoe2oBoAqNtJ9badtnA_);
TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[31].len = 0; TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[31].kind = 2;
NTI__VuFrIFILhVuaGaO5FCG0Og_.node = &TM__XqsrSBxhOTPgLQ9cX4MmV4A_0[31];
NTI__OhBa09cfBAnY4MdnNlGabWQ_.size = sizeof(tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og*);
NTI__OhBa09cfBAnY4MdnNlGabWQ_.align = NIM_ALIGNOF(tyObject_TimeoutError__VuFrIFILhVuaGaO5FCG0Og*);
NTI__OhBa09cfBAnY4MdnNlGabWQ_.kind = 22;
NTI__OhBa09cfBAnY4MdnNlGabWQ_.base = (&NTI__VuFrIFILhVuaGaO5FCG0Og_);
NTI__OhBa09cfBAnY4MdnNlGabWQ_.marker = Marker_tyRef__OhBa09cfBAnY4MdnNlGabWQ;
}

