1 /* Generated by Nim Compiler v1.6.2 */
2 #define NIM_INTBITS 64
3 #define NIM_EmulateOverflowChecks
4 
5 #include "nimbase.h"
6 #include <math.h>
7 #undef LANGUAGE_C
8 #undef MIPSEB
9 #undef MIPSEL
10 #undef PPC
11 #undef R3000
12 #undef R4000
13 #undef i386
14 #undef linux
15 #undef mips
16 #undef near
17 #undef far
18 #undef powerpc
19 #undef unix
20 #define nimfr_(x, y)
21 #define nimln_(x, y)
22 static N_INLINE(NI64, pluspercent___system_712)(NI64 x, NI64 y);
23 static N_INLINE(NI64, starpercent___system_752)(NI64 x, NI64 y);
24 static N_INLINE(NF, toBiggestFloat__system_1705)(NI64 i);
25 static N_INLINE(NF, abs__system_3474)(NF x);
26 static N_INLINE(NI64, minuspercent___system_732)(NI64 x, NI64 y);
N_INLINE(NI64,pluspercent___system_712)27 static N_INLINE(NI64, pluspercent___system_712)(NI64 x, NI64 y) {
28 	NI64 result;
29 	result = (NI64)0;
30 	result = ((NI64) ((NU64)((NU64)(((NU64) (x))) + (NU64)(((NU64) (y))))));
31 	return result;
32 }
N_NIMCALL(NI64,barplusbar___saturate_1)33 N_LIB_PRIVATE N_NIMCALL(NI64, barplusbar___saturate_1)(NI64 a, NI64 b) {
34 	NI64 result;
35 {	result = (NI64)0;
36 	result = pluspercent___system_712(a, b);
37 	{
38 		NIM_BOOL T3_;
39 		T3_ = (NIM_BOOL)0;
40 		T3_ = (IL64(0) <= (NI64)(result ^ a));
41 		if (T3_) goto LA4_;
42 		T3_ = (IL64(0) <= (NI64)(result ^ b));
43 		LA4_: ;
44 		if (!T3_) goto LA5_;
45 		goto BeforeRet_;
46 	}
47 	LA5_: ;
48 	{
49 		NIM_BOOL T9_;
50 		T9_ = (NIM_BOOL)0;
51 		T9_ = (a < IL64(0));
52 		if (T9_) goto LA10_;
53 		T9_ = (b < IL64(0));
54 		LA10_: ;
55 		if (!T9_) goto LA11_;
56 		result = (IL64(-9223372036854775807) - IL64(1));
57 	}
58 	goto LA7_;
59 	LA11_: ;
60 	{
61 		result = IL64(9223372036854775807);
62 	}
63 	LA7_: ;
64 	}BeforeRet_: ;
65 	return result;
66 }
N_INLINE(NI64,starpercent___system_752)67 static N_INLINE(NI64, starpercent___system_752)(NI64 x, NI64 y) {
68 	NI64 result;
69 	result = (NI64)0;
70 	result = ((NI64) ((NU64)((NU64)(((NU64) (x))) * (NU64)(((NU64) (y))))));
71 	return result;
72 }
N_INLINE(NF,toBiggestFloat__system_1705)73 static N_INLINE(NF, toBiggestFloat__system_1705)(NI64 i) {
74 	NF result;
75 	result = (NF)0;
76 	result = ((NF) (i));
77 	return result;
78 }
N_INLINE(NF,abs__system_3474)79 static N_INLINE(NF, abs__system_3474)(NF x) {
80 	NF result;
81 	result = (NF)0;
82 	result = fabs(x);
83 	return result;
84 }
N_NIMCALL(NI64,barstarbar___saturate_52)85 N_LIB_PRIVATE N_NIMCALL(NI64, barstarbar___saturate_52)(NI64 a, NI64 b) {
86 	NI64 result;
87 	NF resAsFloat;
88 	NF floatProd;
89 	NF T1_;
90 {	result = (NI64)0;
91 	resAsFloat = (NF)0;
92 	floatProd = (NF)0;
93 	result = starpercent___system_752(a, b);
94 	floatProd = toBiggestFloat__system_1705(a);
95 	T1_ = (NF)0;
96 	T1_ = toBiggestFloat__system_1705(b);
97 	floatProd = ((NF)(floatProd) * (NF)(T1_));
98 	resAsFloat = toBiggestFloat__system_1705(result);
99 	{
100 		if (!(resAsFloat == floatProd)) goto LA4_;
101 		goto BeforeRet_;
102 	}
103 	LA4_: ;
104 	{
105 		NF T8_;
106 		NF T9_;
107 		T8_ = (NF)0;
108 		T8_ = abs__system_3474(((NF)(resAsFloat) - (NF)(floatProd)));
109 		T9_ = (NF)0;
110 		T9_ = abs__system_3474(floatProd);
111 		if (!(((NF)(32.0) * (NF)(T8_)) <= T9_)) goto LA10_;
112 		goto BeforeRet_;
113 	}
114 	LA10_: ;
115 	{
116 		if (!(0.0 <= floatProd)) goto LA14_;
117 		result = IL64(9223372036854775807);
118 	}
119 	goto LA12_;
120 	LA14_: ;
121 	{
122 		result = (IL64(-9223372036854775807) - IL64(1));
123 	}
124 	LA12_: ;
125 	}BeforeRet_: ;
126 	return result;
127 }
N_INLINE(NI64,minuspercent___system_732)128 static N_INLINE(NI64, minuspercent___system_732)(NI64 x, NI64 y) {
129 	NI64 result;
130 	result = (NI64)0;
131 	result = ((NI64) ((NU64)((NU64)(((NU64) (x))) - (NU64)(((NU64) (y))))));
132 	return result;
133 }
N_NIMCALL(NI64,barminusbar___saturate_13)134 N_LIB_PRIVATE N_NIMCALL(NI64, barminusbar___saturate_13)(NI64 a, NI64 b) {
135 	NI64 result;
136 {	result = (NI64)0;
137 	result = minuspercent___system_732(a, b);
138 	{
139 		NIM_BOOL T3_;
140 		T3_ = (NIM_BOOL)0;
141 		T3_ = (IL64(0) <= (NI64)(result ^ a));
142 		if (T3_) goto LA4_;
143 		T3_ = (IL64(0) <= (NI64)(result ^ (NI64)((NU64) ~(b))));
144 		LA4_: ;
145 		if (!T3_) goto LA5_;
146 		goto BeforeRet_;
147 	}
148 	LA5_: ;
149 	{
150 		if (!(IL64(0) < b)) goto LA9_;
151 		result = (IL64(-9223372036854775807) - IL64(1));
152 	}
153 	goto LA7_;
154 	LA9_: ;
155 	{
156 		result = IL64(9223372036854775807);
157 	}
158 	LA7_: ;
159 	}BeforeRet_: ;
160 	return result;
161 }
162