/* Generated by Nim Compiler v2.2.10 */
#define NIM_INTBITS 32

#include "nimbase.h"
#include <math.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
static N_INLINE(NI64, pluspercent___system_u801)(NI64 x_p0, NI64 y_p1);
static N_INLINE(NI64, starpercent___system_u841)(NI64 x_p0, NI64 y_p1);
static N_INLINE(NF, toBiggestFloat__system_u1698)(NI64 i_p0);
static N_INLINE(NF, abs__pureZmath_u219)(NF x_p0);
static N_INLINE(NI64, minuspercent___system_u821)(NI64 x_p0, NI64 y_p1);
static N_INLINE(NI64, pluspercent___system_u801)(NI64 x_p0, NI64 y_p1) {
	NI64 result;
	result = ((NI64) ((NU64)((NU64)(((NU64) (x_p0))) + (NU64)(((NU64) (y_p1))))));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI64, barplusbar___saturate_u1)(NI64 a_p0, NI64 b_p1) {
	NI64 result;
{	result = pluspercent___system_u801(a_p0, b_p1);
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (IL64(0) <= (NI64)(result ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (IL64(0) <= (NI64)(result ^ b_p1));
LA4_: ;
		if (!T3_) goto LA5_;
		goto BeforeRet_;
	}
LA5_: ;
	{
		NIM_BOOL T9_;
		T9_ = (NIM_BOOL)0;
		T9_ = (a_p0 < IL64(0));
		if (T9_) goto LA10_;
		T9_ = (b_p1 < IL64(0));
LA10_: ;
		if (!T9_) goto LA11_;
		result = (IL64(-9223372036854775807) - IL64(1));
	}
	goto LA7_;
LA11_: ;
	{
		result = IL64(9223372036854775807);
	}
LA7_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI64, starpercent___system_u841)(NI64 x_p0, NI64 y_p1) {
	NI64 result;
	result = ((NI64) ((NU64)((NU64)(((NU64) (x_p0))) * (NU64)(((NU64) (y_p1))))));
	return result;
}
static N_INLINE(NF, toBiggestFloat__system_u1698)(NI64 i_p0) {
	NF result;
	result = ((NF) (i_p0));
	return result;
}
static N_INLINE(NF, abs__pureZmath_u219)(NF x_p0) {
	NF result;
	result = (NF)0;
	result = fabs(x_p0);
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI64, barstarbar___saturate_u52)(NI64 a_p0, NI64 b_p1) {
	NI64 result;
	NF resAsFloat_1;
	NF floatProd_1;
	NF T1_;
{	resAsFloat_1 = (NF)0;
	floatProd_1 = (NF)0;
	result = starpercent___system_u841(a_p0, b_p1);
	floatProd_1 = toBiggestFloat__system_u1698(a_p0);
	T1_ = (NF)0;
	T1_ = toBiggestFloat__system_u1698(b_p1);
	floatProd_1 = ((NF)(floatProd_1) * (NF)(T1_));
	resAsFloat_1 = toBiggestFloat__system_u1698(result);
	{
		if (!(resAsFloat_1 == floatProd_1)) goto LA4_;
		goto BeforeRet_;
	}
LA4_: ;
	{
		NF T8_;
		NF T9_;
		T8_ = (NF)0;
		T8_ = abs__pureZmath_u219(((NF)(resAsFloat_1) - (NF)(floatProd_1)));
		T9_ = (NF)0;
		T9_ = abs__pureZmath_u219(floatProd_1);
		if (!(((NF)(32.0) * (NF)(T8_)) <= T9_)) goto LA10_;
		goto BeforeRet_;
	}
LA10_: ;
	{
		if (!(0.0 <= floatProd_1)) goto LA14_;
		result = IL64(9223372036854775807);
	}
	goto LA12_;
LA14_: ;
	{
		result = (IL64(-9223372036854775807) - IL64(1));
	}
LA12_: ;
	}BeforeRet_: ;
	return result;
}
static N_INLINE(NI64, minuspercent___system_u821)(NI64 x_p0, NI64 y_p1) {
	NI64 result;
	result = ((NI64) ((NU64)((NU64)(((NU64) (x_p0))) - (NU64)(((NU64) (y_p1))))));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI64, barminusbar___saturate_u13)(NI64 a_p0, NI64 b_p1) {
	NI64 result;
{	result = minuspercent___system_u821(a_p0, b_p1);
	{
		NIM_BOOL T3_;
		T3_ = (NIM_BOOL)0;
		T3_ = (IL64(0) <= (NI64)(result ^ a_p0));
		if (T3_) goto LA4_;
		T3_ = (IL64(0) <= (NI64)(result ^ (NI64)((NU64) ~(b_p1))));
LA4_: ;
		if (!T3_) goto LA5_;
		goto BeforeRet_;
	}
LA5_: ;
	{
		if (!(IL64(0) < b_p1)) goto LA9_;
		result = (IL64(-9223372036854775807) - IL64(1));
	}
	goto LA7_;
LA9_: ;
	{
		result = IL64(9223372036854775807);
	}
LA7_: ;
	}BeforeRet_: ;
	return result;
}
