/* 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"
#include <math.h>
#undef linux

N_NIMCALL(NF, log2_ofkAe2ROmA188x6KIGzcDA)(NF x0) {
	NF result0;
	NF LOC1;
	NF LOC2;
{	result0 = (NF)0;
	LOC1 = (NF)0;
	LOC1 = log(x0);
	LOC2 = (NF)0;
	LOC2 = log(2.0000000000000000e+00);
	result0 = ((NF)(LOC1) / (NF)(LOC2));
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_NIMCALL(NF, round_FL9bhksfuQsfLDCxRHuknsg)(NF x0, NI places0) {
	NF result0;
	result0 = (NF)0;
	{
		if (!(places0 == ((NI) 0))) goto LA3;
		result0 = round(x0);
	}
	goto LA1;
	LA3: ;
	{
		NF mult0;
		NF LOC6;
		mult0 = pow(1.0000000000000000e+01, ((NF) (places0)));
		LOC6 = (NF)0;
		LOC6 = round(((NF)(x0) * (NF)(mult0)));
		result0 = ((NF)(LOC6) / (NF)(mult0));
	}
	LA1: ;
	return result0;
}

N_NIMCALL(NIM_BOOL, ispoweroftwo_M0Db9b9cHxuUgw2ZF0P8utPg)(NI x0) {
	NIM_BOOL result0;
	NIM_BOOL LOC1;
{	result0 = (NIM_BOOL)0;
	LOC1 = (NIM_BOOL)0;
	LOC1 = (((NI) 0) < x0);
	if (!(LOC1)) goto LA2;
	LOC1 = ((NI)(x0 & (NI)(x0 - ((NI) 1))) == ((NI) 0));
	LA2: ;
	result0 = LOC1;
	goto BeforeRet;
	}BeforeRet: ;
	return result0;
}

N_NIMCALL(NI, nextpoweroftwo_gcitR3TEXHJ3GR9bmwIvtRA)(NI x0) {
	NI result0;
	result0 = (NI)0;
	result0 = (NI)(x0 - ((NI) 1));
	result0 = (NI)(result0 | (NI)((NU32)(result0) >> (NU32)(((NI) 16))));
	result0 = (NI)(result0 | (NI)((NU32)(result0) >> (NU32)(((NI) 8))));
	result0 = (NI)(result0 | (NI)((NU32)(result0) >> (NU32)(((NI) 4))));
	result0 = (NI)(result0 | (NI)((NU32)(result0) >> (NU32)(((NI) 2))));
	result0 = (NI)(result0 | (NI)((NU32)(result0) >> (NU32)(((NI) 1))));
	result0 += ((NI) ((NI)(((NI) 1) + ((NI) ((x0 <= ((NI) 0)))))));
	return result0;
}
NIM_EXTERNC N_NOINLINE(void, stdlib_mathInit000)(void) {
}

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

