This repository has been archived by the owner on Oct 3, 2021. It is now read-only.
/
soft_float_2_true-unreach-call_true-no-overflow_true-termination.c.cil.c
266 lines (242 loc) · 4.58 KB
/
soft_float_2_true-unreach-call_true-no-overflow_true-termination.c.cil.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern char __VERIFIER_nondet_char(void);
extern unsigned int __VERIFIER_nondet_uint(void);
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR: __VERIFIER_error();
}
return;
}
/* Generated by CIL v. 1.3.7 */
/* print_CIL_Input is true */
unsigned int base2flt(unsigned int m , int e )
{ unsigned int res ;
unsigned int __retres4 ;
{
if (! m) {
__retres4 = 0U;
goto return_label;
} else {
}
if (m < 1U << 24U) {
{
while (1) {
while_0_continue: /* CIL Label */ ;
if (e <= -128) {
__retres4 = 0U;
goto return_label;
} else {
}
e = e - 1;
m = m << 1U;
if (m < 1U << 24U) {
} else {
goto while_0_break;
}
}
while_0_break: /* CIL Label */ ;
}
} else {
{
while (1) {
while_1_continue: /* CIL Label */ ;
if (m >= 1U << 25U) {
} else {
goto while_1_break;
}
if (e >= 127) {
__retres4 = 4294967295U;
goto return_label;
} else {
}
e = e + 1;
m = m >> 1U;
}
while_1_break: /* CIL Label */ ;
}
}
m = m & ~ (1U << 24U);
res = m | (unsigned int )((e + 128) << 24U);
__retres4 = res;
return_label: /* CIL Label */
return (__retres4);
}
}
unsigned int addflt(unsigned int a , unsigned int b )
{ unsigned int res ;
unsigned int ma ;
unsigned int mb ;
unsigned int delta ;
int ea ;
int eb ;
unsigned int tmp ;
unsigned int __retres10 ;
{
if (a < b) {
tmp = a;
a = b;
b = tmp;
} else {
}
if (! b) {
__retres10 = a;
goto return_label;
} else {
}
{
ma = a & ((1U << 24U) - 1U);
ea = (int )(a >> 24U) - 128;
ma = ma | (1U << 24U);
mb = b & ((1U << 24U) - 1U);
eb = (int )(b >> 24U) - 128;
mb = mb | (1U << 24U);
__VERIFIER_assert(ea >= eb);
delta = ea - eb;
mb = mb >> delta;
}
if (! mb) {
__retres10 = a;
goto return_label;
} else {
}
ma = ma + mb;
if (ma & (1U << 25U)) {
if (ea == 127) {
__retres10 = 4294967295U;
goto return_label;
} else {
}
ea = ea + 1;
ma = ma >> 1U;
} else {
}
{
__VERIFIER_assert(ma < 1U << 25U);
ma = ma & ((1U << 24U) - 1U);
res = ma | (unsigned int )((ea + 128) << 24U);
}
__retres10 = res;
return_label: /* CIL Label */
return (__retres10);
}
}
unsigned int mulflt(unsigned int a , unsigned int b )
{ unsigned int res ;
unsigned int ma ;
unsigned int mb ;
unsigned long long accu ;
int ea ;
int eb ;
unsigned int tmp ;
unsigned int __retres10 ;
{
if (a < b) {
tmp = a;
a = b;
b = tmp;
} else {
}
if (! b) {
__retres10 = 0U;
goto return_label;
} else {
}
ma = a & ((1U << 24U) - 1U);
ea = (int )(a >> 24U) - 128;
ma = ma | (1U << 24U);
mb = b & ((1U << 24U) - 1U);
eb = (int )(b >> 24U) - 128;
mb = mb | (1U << 24U);
ea = ea + eb;
ea = ea + 24;
if (ea > 127) {
__retres10 = 4294967295U;
goto return_label;
} else {
}
if (ea < -128) {
__retres10 = 0U;
goto return_label;
} else {
}
accu = ma;
accu = accu * (unsigned long long )mb;
accu = accu >> 24U;
if (accu >= (unsigned long long )(1U << 25U)) {
if (ea == 127) {
__retres10 = 4294967295U;
goto return_label;
} else {
}
ea = ea + 1;
accu = accu >> 1U;
if (accu >= (unsigned long long )(1U << 25U)) {
__retres10 = 4294967295U;
goto return_label;
} else {
}
} else {
}
ma = accu;
ma = ma & ~ (1U << 24U);
res = ma | (unsigned int )((ea + 128) << 24U);
__retres10 = res;
return_label: /* CIL Label */
return (__retres10);
}
}
int main(void)
{ unsigned int a ;
unsigned int ma = __VERIFIER_nondet_uint();
signed char ea = __VERIFIER_nondet_char();
unsigned int b ;
unsigned int mb = __VERIFIER_nondet_uint();
signed char eb = __VERIFIER_nondet_char();
unsigned int r_mul ;
unsigned int zero ;
unsigned int one ;
int sa ;
int tmp ;
int tmp___0 ;
int tmp___1 ;
int __retres16 ;
{
{
zero = base2flt(0, 0);
one = base2flt(1, 0);
a = base2flt(ma, ea);
b = base2flt(mb, eb);
}
if (a < zero) {
sa = -1;
} else {
if (a > zero) {
tmp = 1;
} else {
tmp = 0;
}
sa = tmp;
}
{
r_mul = mulflt(a, b);
}
if (sa == 0) {
if (r_mul < zero) {
tmp___1 = -1;
} else {
if (r_mul > zero) {
tmp___0 = 1;
} else {
tmp___0 = 0;
}
tmp___1 = tmp___0;
}
{
__VERIFIER_assert(tmp___1 == 0);
}
} else {
}
__retres16 = 0;
return (__retres16);
}
}