/* Generated by Nimrod Compiler v0.9.5 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, i386, gcc */
/* Command for C compiler:
   gcc -c  -w -O3 -fno-strict-aliasing  -I/build/nimrod/src/nimrod/lib -o compiler/nimcache/stdlib_math.o compiler/nimcache/stdlib_math.c */
#define NIM_INTBITS 32
#include "nimbase.h"

#include <stdlib.h>

N_NIMCALL(NIM_BOOL, ispoweroftwo_133278)(NI x) {
	NIM_BOOL result;
	NIM_BOOL LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = !((x == 0));
	if (!(LOC1)) goto LA2;
	LOC1 = ((NI)(x & (NI32)(x - 1)) == 0);
	LA2: ;
	result = LOC1;
	goto BeforeRet;
	BeforeRet: ;
	return result;
}

N_NIMCALL(NI, random_133979)(NI max) {
	NI result;
	int LOC1;
	result = 0;
	LOC1 = 0;
	LOC1 = rand();
	result = (NI32)(((NI) (LOC1)) % max);
	return result;
}

N_NIMCALL(NI, nextpoweroftwo_133284)(NI x) {
	NI result;
	result = 0;
	result = (NI32)(x - 1);
	result = (NI)(result | (NI)((NU32)(result) >> (NU32)(4)));
	result = (NI)(result | (NI)((NU32)(result) >> (NU32)(2)));
	result = (NI)(result | (NI)((NU32)(result) >> (NU32)(1)));
	result += ((NI) ((NI32)(1 + ((NI) ((x <= 0))))));
	return result;
}
N_NOINLINE(void, stdlibmathInit)(void) {
}

N_NOINLINE(void, stdlibmathDatInit)(void) {
}

