/* Generated by Nim Compiler v0.16.0 */
/*   (c) 2017 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 32

#include "nimbase.h"
#undef linux
typedef struct Tsym_AXG7xcvKqaxY6koRX1xkCw Tsym_AXG7xcvKqaxY6koRX1xkCw;
typedef struct TY_sksVpmPRIkNR9axiwtD1Guw TY_sksVpmPRIkNR9axiwtD1Guw;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct NimStringDesc NimStringDesc;
typedef struct TY_sM4lkSb7zS6F7OVMvW9cffQ TY_sM4lkSb7zS6F7OVMvW9cffQ;
typedef struct Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg;
typedef struct TY_5PunAJrNQYcB8dF0jau3pQ TY_5PunAJrNQYcB8dF0jau3pQ;
typedef struct Tidobj_raN9cHVgzmvaXisezY9aGg9cg Tidobj_raN9cHVgzmvaXisezY9aGg9cg;
typedef struct TNimObject TNimObject;
typedef struct TY_zuqP4Riz26Oi5fWgPYVEgA TY_zuqP4Riz26Oi5fWgPYVEgA;
typedef struct TY_DXS6mEo7PVUFJkirsQ9bNQA TY_DXS6mEo7PVUFJkirsQ9bNQA;
typedef struct Tstrtable_f07aOS3dr28kGa5wcE29aFA Tstrtable_f07aOS3dr28kGa5wcE29aFA;
typedef struct Ttype_LTUWCZolpovw9cWE3JBWSUw Ttype_LTUWCZolpovw9cWE3JBWSUw;
typedef struct Tident_4umxGerWTHGPwUms7Yqu3g Tident_4umxGerWTHGPwUms7Yqu3g;
typedef struct Tlineinfo_T9c3PM9bs7WZ4LIQfEici9cZw Tlineinfo_T9c3PM9bs7WZ4LIQfEici9cZw;
typedef struct Tnode_bROa11lyF5vxEN9aYNbHmhw Tnode_bROa11lyF5vxEN9aYNbHmhw;
typedef struct Tloc_EtHNvCB0bgfu9bFjzx9cb6aA Tloc_EtHNvCB0bgfu9bFjzx9cb6aA;
typedef struct Ropeobj_HF4qJnb6xiOddgPmsxodtQ Ropeobj_HF4qJnb6xiOddgPmsxodtQ;
typedef struct Tlib_4f9aBgmqEuj7uWJdBBGcRgA Tlib_4f9aBgmqEuj7uWJdBBGcRgA;
typedef struct Tinstantiation_5LqgVn6Tq9ainQRK7TQAQxA Tinstantiation_5LqgVn6Tq9ainQRK7TQAQxA;
typedef struct TY_iGkpo9aKQdr3NWelKC4cnJA TY_iGkpo9aKQdr3NWelKC4cnJA;
typedef struct TY_ehmV9bTklH2Gt9cXHV9c0HLeQ TY_ehmV9bTklH2Gt9cXHV9c0HLeQ;
typedef struct Tlistentry_U4JkVlrJQaACKZ9a9cwCla3Q Tlistentry_U4JkVlrJQaACKZ9a9cwCla3Q;
typedef struct TY_a09bGTAl9ceOKTAytYdkbyKg TY_a09bGTAl9ceOKTAytYdkbyKg;
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (Tsym_AXG7xcvKqaxY6koRX1xkCw* x_HajRHuG3hBLu9aRClDrclVA, Tsym_AXG7xcvKqaxY6koRX1xkCw* y_KmGmpKMOJbSpotUkWVINGw, void* ClEnv);
void* ClEnv;
} TY_ebCc9bLaaaoeQAaNbPKMIRA;
typedef NU8 Sortorder_8iBc6wlNqBa9cju9cUAhUAxA;
struct  TGenericSeq  {
NI len;
NI reserved;
};
typedef NU8 Tnimkind_jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 Tnimtypeflag_v8QUszD1sWlSIWZz7mC4bQ_Set;
typedef N_NIMCALL_PTR(void, TY_ojoeKfW4VYIm36I9cpDTQIg) (void* p0, NI op0);
typedef N_NIMCALL_PTR(void*, TY_WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p0);
struct  TNimType  {
NI size;
Tnimkind_jIBKr1ejBgsfM33Kxw4j7A kind;
Tnimtypeflag_v8QUszD1sWlSIWZz7mC4bQ_Set flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY_ojoeKfW4VYIm36I9cpDTQIg marker;
TY_WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 Tnimnodekind_unfNsxrcATrufDZmpBq4HQ;
struct  TNimNode  {
Tnimnodekind_unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_CLOSURE_PTR(NI, T_JdC9c6SaUkvO1XjYuWP1JWQ_2) (Tsym_AXG7xcvKqaxY6koRX1xkCw* x_5tDhwLTY9aFTEbPoggfaIpg, Tsym_AXG7xcvKqaxY6koRX1xkCw* y_kEQozk1VUu5URNYGxZWBFw);
typedef N_CLOSURE_PTR(NI, T_JdC9c6SaUkvO1XjYuWP1JWQ_3) (Tsym_AXG7xcvKqaxY6koRX1xkCw* x_5tDhwLTY9aFTEbPoggfaIpg, Tsym_AXG7xcvKqaxY6koRX1xkCw* y_kEQozk1VUu5URNYGxZWBFw);
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (NimStringDesc* x_HajRHuG3hBLu9aRClDrclVA, NimStringDesc* y_KmGmpKMOJbSpotUkWVINGw, void* ClEnv);
void* ClEnv;
} TY_kTj9c3SX9agxDQPZYwemi6ug;
typedef N_CLOSURE_PTR(NI, T_JdC9c6SaUkvO1XjYuWP1JWQ_4) (NimStringDesc* x_5tDhwLTY9aFTEbPoggfaIpg_2, NimStringDesc* y_kEQozk1VUu5URNYGxZWBFw_2);
typedef N_CLOSURE_PTR(NI, T_JdC9c6SaUkvO1XjYuWP1JWQ_5) (NimStringDesc* x_5tDhwLTY9aFTEbPoggfaIpg_2, NimStringDesc* y_kEQozk1VUu5URNYGxZWBFw_2);
typedef struct {
N_NIMCALL_PTR(NI, ClPrc) (Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg x_HajRHuG3hBLu9aRClDrclVA_3, Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg y_KmGmpKMOJbSpotUkWVINGw_3, void* ClEnv);
void* ClEnv;
} TY_zzrK9cTwi9admDvOCMDMSIXQ;
struct  Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg  {
NimStringDesc* keyword;
NimStringDesc* link;
NimStringDesc* linktitle;
NimStringDesc* linkdesc;
};
typedef N_CLOSURE_PTR(NI, T_JdC9c6SaUkvO1XjYuWP1JWQ_6) (Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg x_5tDhwLTY9aFTEbPoggfaIpg_3, Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg y_kEQozk1VUu5URNYGxZWBFw_3);
typedef N_CLOSURE_PTR(NI, T_JdC9c6SaUkvO1XjYuWP1JWQ_7) (Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg x_5tDhwLTY9aFTEbPoggfaIpg_3, Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg y_kEQozk1VUu5URNYGxZWBFw_3);
struct  TNimObject  {
TNimType* m_type;
};
struct  Tidobj_raN9cHVgzmvaXisezY9aGg9cg  {
  TNimObject Sup;
NI id;
};
typedef NU8 Tsymkind_cNCW9acsSznmEccl1fgQwkw;
struct  Tstrtable_f07aOS3dr28kGa5wcE29aFA  {
NI counter;
TY_sksVpmPRIkNR9axiwtD1Guw* data;
};
typedef NU16 Tmagic_shZhZOdbVC5nnFvcXQAImg;
struct  Tlineinfo_T9c3PM9bs7WZ4LIQfEici9cZw  {
NI16 line;
NI16 col;
NI32 fileindex;
};
typedef NU32 Tsymflag_K9ay6LWMat9bUiT9bIbMxpDHw_Set;
typedef NU32 Toption_WspMeQySXNP2XoTWR5MTgg_Set;
typedef NU8 Tlockind_O7PRFZKuiBBWbku09cayVBg;
typedef NU8 Tstorageloc_JK9cKMX3XnqHaUky9b6gkGEw;
typedef NU16 Tlocflag_o2bqJgR4ceIupnUSpxiudA_Set;
struct  Tloc_EtHNvCB0bgfu9bFjzx9cb6aA  {
Tlockind_O7PRFZKuiBBWbku09cayVBg k;
Tstorageloc_JK9cKMX3XnqHaUky9b6gkGEw s;
Tlocflag_o2bqJgR4ceIupnUSpxiudA_Set flags;
Ttype_LTUWCZolpovw9cWE3JBWSUw* t;
Ropeobj_HF4qJnb6xiOddgPmsxodtQ* r;
};
struct  Tsym_AXG7xcvKqaxY6koRX1xkCw  {
  Tidobj_raN9cHVgzmvaXisezY9aGg9cg Sup;
Tsymkind_cNCW9acsSznmEccl1fgQwkw kind;
union{
struct {TY_zuqP4Riz26Oi5fWgPYVEgA* typeinstcache;
} S1;
struct {TY_DXS6mEo7PVUFJkirsQ9bNQA* procinstcache;
Tsym_AXG7xcvKqaxY6koRX1xkCw* gcunsafetyreason;
} S2;
struct {TY_DXS6mEo7PVUFJkirsQ9bNQA* usedgenerics;
Tstrtable_f07aOS3dr28kGa5wcE29aFA tab;
} S3;
struct {Tsym_AXG7xcvKqaxY6koRX1xkCw* guard;
NI bitsize;
} S4;
} kindU;
Tmagic_shZhZOdbVC5nnFvcXQAImg magic;
Ttype_LTUWCZolpovw9cWE3JBWSUw* typ;
Tident_4umxGerWTHGPwUms7Yqu3g* name;
Tlineinfo_T9c3PM9bs7WZ4LIQfEici9cZw info;
Tsym_AXG7xcvKqaxY6koRX1xkCw* owner;
Tsymflag_K9ay6LWMat9bUiT9bIbMxpDHw_Set flags;
Tnode_bROa11lyF5vxEN9aYNbHmhw* ast;
Toption_WspMeQySXNP2XoTWR5MTgg_Set options;
NI position;
NI offset;
Tloc_EtHNvCB0bgfu9bFjzx9cb6aA loc;
Tlib_4f9aBgmqEuj7uWJdBBGcRgA* annex;
Tnode_bROa11lyF5vxEN9aYNbHmhw* constraint;
};
typedef NU8 Ttypekind_9a3YiReNVD0IJHWFKgXRe9ag;
typedef NU8 Tcallingconvention_yjAJ8w0h1PBaSwSGJ3P7IA;
typedef NU32 Ttypeflag_x2m5g1NpbmDig4wLT3Ylhw_Set;
struct  Ttype_LTUWCZolpovw9cWE3JBWSUw  {
  Tidobj_raN9cHVgzmvaXisezY9aGg9cg Sup;
Ttypekind_9a3YiReNVD0IJHWFKgXRe9ag kind;
Tcallingconvention_yjAJ8w0h1PBaSwSGJ3P7IA callconv;
Ttypeflag_x2m5g1NpbmDig4wLT3Ylhw_Set flags;
TY_zuqP4Riz26Oi5fWgPYVEgA* sons;
Tnode_bROa11lyF5vxEN9aYNbHmhw* n;
Tsym_AXG7xcvKqaxY6koRX1xkCw* owner;
Tsym_AXG7xcvKqaxY6koRX1xkCw* sym;
Tsym_AXG7xcvKqaxY6koRX1xkCw* destructor;
Tsym_AXG7xcvKqaxY6koRX1xkCw* deepcopy;
Tsym_AXG7xcvKqaxY6koRX1xkCw* assignment;
TY_iGkpo9aKQdr3NWelKC4cnJA* methods;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc_EtHNvCB0bgfu9bFjzx9cb6aA loc;
Ttype_LTUWCZolpovw9cWE3JBWSUw* typeinst;
};
struct  Tident_4umxGerWTHGPwUms7Yqu3g  {
  Tidobj_raN9cHVgzmvaXisezY9aGg9cg Sup;
NimStringDesc* s;
Tident_4umxGerWTHGPwUms7Yqu3g* next;
NI h;
};
typedef NU16 Tnodeflag_jyh9acXHkhZANSSvPIY7ZLg_Set;
typedef NU8 Tnodekind_G4E4Gxe7oI2Cm03rkiOzQw;
struct  Tnode_bROa11lyF5vxEN9aYNbHmhw  {
Ttype_LTUWCZolpovw9cWE3JBWSUw* typ;
Tlineinfo_T9c3PM9bs7WZ4LIQfEici9cZw info;
Tnodeflag_jyh9acXHkhZANSSvPIY7ZLg_Set flags;
Tnodekind_G4E4Gxe7oI2Cm03rkiOzQw kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym_AXG7xcvKqaxY6koRX1xkCw* sym;
} S4;
struct {Tident_4umxGerWTHGPwUms7Yqu3g* ident;
} S5;
struct {TY_ehmV9bTklH2Gt9cXHV9c0HLeQ* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
struct  Ropeobj_HF4qJnb6xiOddgPmsxodtQ  {
  TNimObject Sup;
Ropeobj_HF4qJnb6xiOddgPmsxodtQ* left;
Ropeobj_HF4qJnb6xiOddgPmsxodtQ* right;
NI length;
NimStringDesc* data;
};
struct  Tlistentry_U4JkVlrJQaACKZ9a9cwCla3Q  {
  TNimObject Sup;
Tlistentry_U4JkVlrJQaACKZ9a9cwCla3Q* prev;
Tlistentry_U4JkVlrJQaACKZ9a9cwCla3Q* next;
};
typedef NU8 Tlibkind_9b8v60kso59bBaw9cp8B9a9apKQ;
struct  Tlib_4f9aBgmqEuj7uWJdBBGcRgA  {
  Tlistentry_U4JkVlrJQaACKZ9a9cwCla3Q Sup;
Tlibkind_9b8v60kso59bBaw9cp8B9a9apKQ kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj_HF4qJnb6xiOddgPmsxodtQ* name;
Tnode_bROa11lyF5vxEN9aYNbHmhw* path;
};
struct  Tinstantiation_5LqgVn6Tq9ainQRK7TQAQxA  {
Tsym_AXG7xcvKqaxY6koRX1xkCw* sym;
TY_zuqP4Riz26Oi5fWgPYVEgA* concretetypes;
NI compilesid;
};
struct TY_a09bGTAl9ceOKTAytYdkbyKg {
NI Field0;
Tsym_AXG7xcvKqaxY6koRX1xkCw* Field1;
};
struct TY_sksVpmPRIkNR9axiwtD1Guw {
  TGenericSeq Sup;
  Tsym_AXG7xcvKqaxY6koRX1xkCw* data[SEQ_DECL_SIZE];
};
struct TY_sM4lkSb7zS6F7OVMvW9cffQ {
  TGenericSeq Sup;
  NimStringDesc* data[SEQ_DECL_SIZE];
};
struct TY_5PunAJrNQYcB8dF0jau3pQ {
  TGenericSeq Sup;
  Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg data[SEQ_DECL_SIZE];
};
struct TY_zuqP4Riz26Oi5fWgPYVEgA {
  TGenericSeq Sup;
  Ttype_LTUWCZolpovw9cWE3JBWSUw* data[SEQ_DECL_SIZE];
};
struct TY_DXS6mEo7PVUFJkirsQ9bNQA {
  TGenericSeq Sup;
  Tinstantiation_5LqgVn6Tq9ainQRK7TQAQxA* data[SEQ_DECL_SIZE];
};
struct TY_iGkpo9aKQdr3NWelKC4cnJA {
  TGenericSeq Sup;
  TY_a09bGTAl9ceOKTAytYdkbyKg data[SEQ_DECL_SIZE];
};
struct TY_ehmV9bTklH2Gt9cXHV9c0HLeQ {
  TGenericSeq Sup;
  Tnode_bROa11lyF5vxEN9aYNbHmhw* data[SEQ_DECL_SIZE];
};
N_NIMCALL(void*, newSeq)(TNimType* typ0, NI len0);
N_NIMCALL(void, merge_ZWrZkYaIWXmmcBpYbVzXSQ)(Tsym_AXG7xcvKqaxY6koRX1xkCw** a0, NI a0Len0, Tsym_AXG7xcvKqaxY6koRX1xkCw** b0, NI b0Len0, NI lo0, NI m0, NI hi0, TY_ebCc9bLaaaoeQAaNbPKMIRA cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0);
static N_INLINE(NI, HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm)(NI x0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0);
N_NIMCALL(void, unsureAsgnRef)(void** dest0, void* src0);
N_NIMCALL(void, merge_KHePwML9ba2tSMRLHxcf3EQ)(NimStringDesc** a0, NI a0Len0, NimStringDesc** b0, NI b0Len0, NI lo0, NI m0, NI hi0, TY_kTj9c3SX9agxDQPZYwemi6ug cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0);
N_NIMCALL(void, merge_eK1oOcG1wrLw7IUmkc5hMQ)(Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg* a0, NI a0Len0, Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg* b0, NI b0Len0, NI lo0, NI m0, NI hi0, TY_zzrK9cTwi9admDvOCMDMSIXQ cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0);
N_NIMCALL(void, HEX3CHEX2D_ywiMlRt07odOULUubTsiKA)(Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg* a0, Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg b0);
extern TNimType NTI_sksVpmPRIkNR9axiwtD1Guw;
extern TNimType NTI_sM4lkSb7zS6F7OVMvW9cffQ;
extern TNimType NTI_5PunAJrNQYcB8dF0jau3pQ;

static N_INLINE(NI, HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm)(NI x0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0) {
	NI result0;
	NI y0;
	result0 = (NI)0;
	y0 = (NI)(((NI) (order0)) - ((NI) 1));
	result0 = (NI)((NI)(x0 ^ ((NI) (y0))) - ((NI) (y0)));
	return result0;
}

N_NIMCALL(void, merge_ZWrZkYaIWXmmcBpYbVzXSQ)(Tsym_AXG7xcvKqaxY6koRX1xkCw** a0, NI a0Len0, Tsym_AXG7xcvKqaxY6koRX1xkCw** b0, NI b0Len0, NI lo0, NI m0, NI hi0, TY_ebCc9bLaaaoeQAaNbPKMIRA cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0) {
	NI j0;
	NI bb0;
	NI i0;
	NI k0;
{	{
		NI LOC3;
		NI LOC4;
		LOC3 = (NI)0;
		LOC3 = cmp0.ClEnv? cmp0.ClPrc(a0[m0], a0[(NI)(m0 + ((NI) 1))], cmp0.ClEnv):((T_JdC9c6SaUkvO1XjYuWP1JWQ_2)(cmp0.ClPrc))(a0[m0], a0[(NI)(m0 + ((NI) 1))]);
		LOC4 = (NI)0;
		LOC4 = HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm(LOC3, order0);
		if (!(LOC4 <= ((NI) 0))) goto LA5;
		goto BeforeRet;
	}
	LA5: ;
	j0 = lo0;
	bb0 = ((NI) 0);
	{
		while (1) {
			if (!(j0 <= m0)) goto LA8;
			unsureAsgnRef((void**) (&b0[bb0]), a0[j0]);
			bb0 += ((NI) 1);
			j0 += ((NI) 1);
		} LA8: ;
	}
	i0 = ((NI) 0);
	k0 = lo0;
	{
		while (1) {
			NIM_BOOL LOC11;
			LOC11 = (NIM_BOOL)0;
			LOC11 = (k0 < j0);
			if (!(LOC11)) goto LA12;
			LOC11 = (j0 <= hi0);
			LA12: ;
			if (!LOC11) goto LA10;
			{
				NI LOC15;
				NI LOC16;
				LOC15 = (NI)0;
				LOC15 = cmp0.ClEnv? cmp0.ClPrc(b0[i0], a0[j0], cmp0.ClEnv):((T_JdC9c6SaUkvO1XjYuWP1JWQ_3)(cmp0.ClPrc))(b0[i0], a0[j0]);
				LOC16 = (NI)0;
				LOC16 = HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm(LOC15, order0);
				if (!(LOC16 <= ((NI) 0))) goto LA17;
				unsureAsgnRef((void**) (&a0[k0]), b0[i0]);
				i0 += ((NI) 1);
			}
			goto LA13;
			LA17: ;
			{
				unsureAsgnRef((void**) (&a0[k0]), a0[j0]);
				j0 += ((NI) 1);
			}
			LA13: ;
			k0 += ((NI) 1);
		} LA10: ;
	}
	{
		while (1) {
			if (!(k0 < j0)) goto LA21;
			unsureAsgnRef((void**) (&a0[k0]), b0[i0]);
			k0 += ((NI) 1);
			i0 += ((NI) 1);
		} LA21: ;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, sort_pFXw7jjw1D1y9ahnr6FqyYQ)(Tsym_AXG7xcvKqaxY6koRX1xkCw** a0, NI a0Len0, TY_ebCc9bLaaaoeQAaNbPKMIRA cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0) {
	NI n0;
	TY_sksVpmPRIkNR9axiwtD1Guw* b0;
	NI s0;
	n0 = a0Len0;
	b0 = (TY_sksVpmPRIkNR9axiwtD1Guw*)0;
	b0 = (TY_sksVpmPRIkNR9axiwtD1Guw*) newSeq((&NTI_sksVpmPRIkNR9axiwtD1Guw), ((NI) ((NI)(n0 / ((NI) 2)))));
	s0 = ((NI) 1);
	{
		while (1) {
			NI m0;
			if (!(s0 < n0)) goto LA2;
			m0 = (NI)((NI)(n0 - ((NI) 1)) - s0);
			{
				while (1) {
					if (!(((NI) 0) <= m0)) goto LA4;
					merge_ZWrZkYaIWXmmcBpYbVzXSQ(a0, a0Len0, b0->data, b0->Sup.len, (((NI)((NI)(m0 - s0) + ((NI) 1)) >= ((NI) 0)) ? (NI)((NI)(m0 - s0) + ((NI) 1)) : ((NI) 0)), m0, (NI)(m0 + s0), cmp0, order0);
					m0 -= (NI)(s0 * ((NI) 2));
				} LA4: ;
			}
			s0 = (NI)(s0 * ((NI) 2));
		} LA2: ;
	}
}

N_NIMCALL(void, merge_KHePwML9ba2tSMRLHxcf3EQ)(NimStringDesc** a0, NI a0Len0, NimStringDesc** b0, NI b0Len0, NI lo0, NI m0, NI hi0, TY_kTj9c3SX9agxDQPZYwemi6ug cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0) {
	NI j0;
	NI bb0;
	NI i0;
	NI k0;
{	{
		NI LOC3;
		NI LOC4;
		LOC3 = (NI)0;
		LOC3 = cmp0.ClEnv? cmp0.ClPrc(a0[m0], a0[(NI)(m0 + ((NI) 1))], cmp0.ClEnv):((T_JdC9c6SaUkvO1XjYuWP1JWQ_4)(cmp0.ClPrc))(a0[m0], a0[(NI)(m0 + ((NI) 1))]);
		LOC4 = (NI)0;
		LOC4 = HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm(LOC3, order0);
		if (!(LOC4 <= ((NI) 0))) goto LA5;
		goto BeforeRet;
	}
	LA5: ;
	j0 = lo0;
	bb0 = ((NI) 0);
	{
		while (1) {
			if (!(j0 <= m0)) goto LA8;
			unsureAsgnRef((void**) (&b0[bb0]), a0[j0]);
			bb0 += ((NI) 1);
			j0 += ((NI) 1);
		} LA8: ;
	}
	i0 = ((NI) 0);
	k0 = lo0;
	{
		while (1) {
			NIM_BOOL LOC11;
			LOC11 = (NIM_BOOL)0;
			LOC11 = (k0 < j0);
			if (!(LOC11)) goto LA12;
			LOC11 = (j0 <= hi0);
			LA12: ;
			if (!LOC11) goto LA10;
			{
				NI LOC15;
				NI LOC16;
				LOC15 = (NI)0;
				LOC15 = cmp0.ClEnv? cmp0.ClPrc(b0[i0], a0[j0], cmp0.ClEnv):((T_JdC9c6SaUkvO1XjYuWP1JWQ_5)(cmp0.ClPrc))(b0[i0], a0[j0]);
				LOC16 = (NI)0;
				LOC16 = HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm(LOC15, order0);
				if (!(LOC16 <= ((NI) 0))) goto LA17;
				unsureAsgnRef((void**) (&a0[k0]), b0[i0]);
				i0 += ((NI) 1);
			}
			goto LA13;
			LA17: ;
			{
				unsureAsgnRef((void**) (&a0[k0]), a0[j0]);
				j0 += ((NI) 1);
			}
			LA13: ;
			k0 += ((NI) 1);
		} LA10: ;
	}
	{
		while (1) {
			if (!(k0 < j0)) goto LA21;
			unsureAsgnRef((void**) (&a0[k0]), b0[i0]);
			k0 += ((NI) 1);
			i0 += ((NI) 1);
		} LA21: ;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, sort_9a7klSx0Yu33UIahhT1Of7Q)(NimStringDesc** a0, NI a0Len0, TY_kTj9c3SX9agxDQPZYwemi6ug cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0) {
	NI n0;
	TY_sM4lkSb7zS6F7OVMvW9cffQ* b0;
	NI s0;
	n0 = a0Len0;
	b0 = (TY_sM4lkSb7zS6F7OVMvW9cffQ*)0;
	b0 = (TY_sM4lkSb7zS6F7OVMvW9cffQ*) newSeq((&NTI_sM4lkSb7zS6F7OVMvW9cffQ), ((NI) ((NI)(n0 / ((NI) 2)))));
	s0 = ((NI) 1);
	{
		while (1) {
			NI m0;
			if (!(s0 < n0)) goto LA2;
			m0 = (NI)((NI)(n0 - ((NI) 1)) - s0);
			{
				while (1) {
					if (!(((NI) 0) <= m0)) goto LA4;
					merge_KHePwML9ba2tSMRLHxcf3EQ(a0, a0Len0, b0->data, b0->Sup.len, (((NI)((NI)(m0 - s0) + ((NI) 1)) >= ((NI) 0)) ? (NI)((NI)(m0 - s0) + ((NI) 1)) : ((NI) 0)), m0, (NI)(m0 + s0), cmp0, order0);
					m0 -= (NI)(s0 * ((NI) 2));
				} LA4: ;
			}
			s0 = (NI)(s0 * ((NI) 2));
		} LA2: ;
	}
}

N_NIMCALL(void, merge_eK1oOcG1wrLw7IUmkc5hMQ)(Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg* a0, NI a0Len0, Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg* b0, NI b0Len0, NI lo0, NI m0, NI hi0, TY_zzrK9cTwi9admDvOCMDMSIXQ cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0) {
	NI j0;
	NI bb0;
	NI i0;
	NI k0;
{	{
		NI LOC3;
		NI LOC4;
		LOC3 = (NI)0;
		LOC3 = cmp0.ClEnv? cmp0.ClPrc(a0[m0], a0[(NI)(m0 + ((NI) 1))], cmp0.ClEnv):((T_JdC9c6SaUkvO1XjYuWP1JWQ_6)(cmp0.ClPrc))(a0[m0], a0[(NI)(m0 + ((NI) 1))]);
		LOC4 = (NI)0;
		LOC4 = HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm(LOC3, order0);
		if (!(LOC4 <= ((NI) 0))) goto LA5;
		goto BeforeRet;
	}
	LA5: ;
	j0 = lo0;
	bb0 = ((NI) 0);
	{
		while (1) {
			if (!(j0 <= m0)) goto LA8;
			HEX3CHEX2D_ywiMlRt07odOULUubTsiKA((&b0[bb0]), a0[j0]);
			bb0 += ((NI) 1);
			j0 += ((NI) 1);
		} LA8: ;
	}
	i0 = ((NI) 0);
	k0 = lo0;
	{
		while (1) {
			NIM_BOOL LOC11;
			LOC11 = (NIM_BOOL)0;
			LOC11 = (k0 < j0);
			if (!(LOC11)) goto LA12;
			LOC11 = (j0 <= hi0);
			LA12: ;
			if (!LOC11) goto LA10;
			{
				NI LOC15;
				NI LOC16;
				LOC15 = (NI)0;
				LOC15 = cmp0.ClEnv? cmp0.ClPrc(b0[i0], a0[j0], cmp0.ClEnv):((T_JdC9c6SaUkvO1XjYuWP1JWQ_7)(cmp0.ClPrc))(b0[i0], a0[j0]);
				LOC16 = (NI)0;
				LOC16 = HEX2A_mciSqxUij8SrsZknIQqvwwalgorithm(LOC15, order0);
				if (!(LOC16 <= ((NI) 0))) goto LA17;
				HEX3CHEX2D_ywiMlRt07odOULUubTsiKA((&a0[k0]), b0[i0]);
				i0 += ((NI) 1);
			}
			goto LA13;
			LA17: ;
			{
				HEX3CHEX2D_ywiMlRt07odOULUubTsiKA((&a0[k0]), a0[j0]);
				j0 += ((NI) 1);
			}
			LA13: ;
			k0 += ((NI) 1);
		} LA10: ;
	}
	{
		while (1) {
			if (!(k0 < j0)) goto LA21;
			HEX3CHEX2D_ywiMlRt07odOULUubTsiKA((&a0[k0]), b0[i0]);
			k0 += ((NI) 1);
			i0 += ((NI) 1);
		} LA21: ;
	}
	}BeforeRet: ;
}

N_NIMCALL(void, sort_LBrAL7WLeSCnpfzkOqm4Fg)(Indexentry_G9ccBDFWfr9aYnLgXTNGDHDg* a0, NI a0Len0, TY_zzrK9cTwi9admDvOCMDMSIXQ cmp0, Sortorder_8iBc6wlNqBa9cju9cUAhUAxA order0) {
	NI n0;
	TY_5PunAJrNQYcB8dF0jau3pQ* b0;
	NI s0;
	n0 = a0Len0;
	b0 = (TY_5PunAJrNQYcB8dF0jau3pQ*)0;
	b0 = (TY_5PunAJrNQYcB8dF0jau3pQ*) newSeq((&NTI_5PunAJrNQYcB8dF0jau3pQ), ((NI) ((NI)(n0 / ((NI) 2)))));
	s0 = ((NI) 1);
	{
		while (1) {
			NI m0;
			if (!(s0 < n0)) goto LA2;
			m0 = (NI)((NI)(n0 - ((NI) 1)) - s0);
			{
				while (1) {
					if (!(((NI) 0) <= m0)) goto LA4;
					merge_eK1oOcG1wrLw7IUmkc5hMQ(a0, a0Len0, b0->data, b0->Sup.len, (((NI)((NI)(m0 - s0) + ((NI) 1)) >= ((NI) 0)) ? (NI)((NI)(m0 - s0) + ((NI) 1)) : ((NI) 0)), m0, (NI)(m0 + s0), cmp0, order0);
					m0 -= (NI)(s0 * ((NI) 2));
				} LA4: ;
			}
			s0 = (NI)(s0 * ((NI) 2));
		} LA2: ;
	}
}
NIM_EXTERNC N_NOINLINE(void, stdlib_algorithmInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, stdlib_algorithmDatInit000)(void) {
}

