/* Generated by Nim Compiler v1.6.14 */
#define NIM_INTBITS 64

#include "nimbase.h"
#include <string.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
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
N_LIB_PRIVATE N_NIMCALL(void, setLen__strutils50_5)(NimStringDesc** result, NI n, NIM_BOOL isInit);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
static N_INLINE(void, zeroMem__system_1730)(void* p, NI size);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
static N_INLINE(void, copyMem__system_1733)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(void*, dataPointer__strutils50_14)(NimStringDesc* a);
static N_INLINE(void, nimSetMem__systemZmemory_7)(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) {
	nimSetMem__systemZmemory_7(p, ((int) 0), size);
}
static N_INLINE(void, zeroMem__system_1730)(void* p, NI size) {
	nimZeroMem(p, size);
}
N_LIB_PRIVATE N_NIMCALL(void, setLen__strutils50_5)(NimStringDesc** result, NI n, NIM_BOOL isInit) {
	NI n0;
	n0 = ((*result) ? (*result)->Sup.len : 0);
	unsureAsgnRef((void**) (&(*result)), setLengthStr((*result), ((NI) (n))));
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = isInit;
		if (!(T3_)) goto LA4_;
		T3_ = (n0 < n);
		LA4_: ;
		if (!T3_) goto LA5_;
		zeroMem__system_1730(((void*) ((&(*result)->data[n0]))), ((NI) ((NI)(n - n0))));
	}
	LA5_: ;
}
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__system_1733)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
N_LIB_PRIVATE N_NIMCALL(void*, dataPointer__strutils50_14)(NimStringDesc* a) {
	void* result;
	result = (void*)0;
	{
		if (!((a ? a->Sup.len : 0) == ((NI) 0))) goto LA3_;
		result = NIM_NIL;
	}
	goto LA1_;
	LA3_: ;
	{
		result = ((void*) ((&a->data[((NI) 0)])));
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, forceCopy__strutils50_10)(NimStringDesc** result, NimStringDesc* a) {
	NI n;
	void* T1_;
	void* T2_;
	n = (a ? a->Sup.len : 0);
	setLen__strutils50_5(result, n, NIM_FALSE);
	T1_ = (void*)0;
	T1_ = dataPointer__strutils50_14((*result));
	T2_ = (void*)0;
	T2_ = dataPointer__strutils50_14(a);
	copyMem__system_1733(T1_, T2_, ((NI) (n)));
}
