aboutsummaryrefslogtreecommitdiffstats
path: root/debug/vericertTest.ml
blob: 4733c2c183de5f97e86ab5ecadae0de7e9cf727e (plain)
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
open Vericert

open AST
open Abstr
open BinNums
open Coqlib
open Datatypes
open Errors
open GiblePargenproofEquiv
open List0
open Maps
open Optionmonad
open Predicate
open GiblePargen
open Integers
open Op
open Printf

let _ = Clflags.option_timings := true

let schedule_oracle l bb bbt =
  match abstract_sequence_top bb with
  | Some p ->
    let (p0, m_expr) = p in
    let (bb', reg_expr) = p0 in
    (match abstract_sequence_top (concat (concat bbt)) with
     | Some p1 ->
       let (p2, m_expr_t) = p1 in
       let (bbt', reg_expr_t) = p2 in
       printf "F1:\n%a\n" PrintAbstr.print_forest bb';
       printf "F2:\n%a\n" PrintAbstr.print_forest bbt'; flush stdout;
       (&&)
         ((&&) ((&&) (if check_unhashed [] bb' bbt' then true else (Printf.printf "Failed 1\n"; false)) (empty_trees bb bbt))
           (if (check_evaluability1_unhashed bb'.forest_preds bbt'.forest_preds reg_expr reg_expr_t) then true else (Printf.printf "Failed 12\n"; false)))
         (if check_evaluability2_unhashed bb'.forest_preds bbt'.forest_preds m_expr m_expr_t then true else (Printf.printf "Failed 13\n"; false))
     | None -> (printf "FAILED1\n"; false))
  | None -> (printf "FAILED2\n"; false)

let schedule_oracle' l bb bbt =
  match abstract_sequence_top bb with
  | Some p ->
    let (p0, m_expr) = p in
    let (bb', reg_expr) = p0 in
    (match abstract_sequence_top (concat (concat bbt)) with
     | Some p1 ->
       let (p2, m_expr_t) = p1 in
       let (bbt', reg_expr_t) = p2 in
       printf "F1:\n%a\n" PrintAbstr.print_forest bb';
       printf "F2:\n%a\n" PrintAbstr.print_forest bbt'; flush stdout;
       (&&)
         ((&&) ((&&) (if check [] bb' bbt' then true else (Printf.printf "Failed 1\n"; false)) (empty_trees bb bbt))
           (if (check_evaluability1 reg_expr reg_expr_t) then true else (Printf.printf "Failed 12\n"; false)))
         (if check_evaluability2 m_expr m_expr_t then true else (Printf.printf "Failed 13\n"; false))
     | None -> (printf "FAILED1\n"; false))
  | None -> (printf "FAILED2\n"; false)

(** val check_scheduled_trees :
    GibleSeq.SeqBB.t PTree.t -> GiblePar.ParBB.t PTree.t -> bool **)

let z = Camlcoq.Z.of_sint
let int n = Int.repr (z n)
let reg = Camlcoq.P.of_int
let pred = Camlcoq.P.of_int
let node = Camlcoq.P.of_int
let plit b p = Plit (b, pred p)

let const p d c: Gible.instr = RBop (p, Ointconst (z c), [], reg d)
let add p d1 r1 r2: Gible.instr = RBop (p, Olea (Aindexed2 (z 0)), [reg r1; reg r2], reg d1)
let mul p d1 r1 r2: Gible.instr = RBop (p, Omul, [reg r1; reg r2], reg d1)
let div p d1 r1 r2: Gible.instr = RBop (p, Odiv, [reg r1; reg r2], reg d1)
let seteq p d1 r1 r2: Gible.instr = RBsetpred (p, Ccomp Ceq, [reg r1; reg r2], pred d1)
let sett p d1 r1: Gible.instr = RBsetpred (p, Ccompimm (Ceq, int 0), [reg r1], pred d1)
let goto p n: Gible.instr = RBexit (p, (RBgoto (node n)))

let time_schedules name arg1 arg2 = 
  let _ = Timing.time (name ^ "_unhashed") (schedule_oracle [] arg1) arg2 in
  Timing.time name (schedule_oracle' [] arg1) arg2

let () =
  (* (if schedule_oracle [] *)
  (*      [ add None 2 1 4; *)
  (*        seteq (Some (plit true 1)) 3 4 2; *)
  (*        add (Some (plit true 1)) 1 2 4; *)
  (*        mul (Some (Pand (plit false 1, plit false 2))) 3 1 1; *)
  (*        mul (Some (plit true 2)) 3 1 4; *)
  (*        goto (Some (plit true 2)) 10; *)
  (*        mul (Some (plit false 2)) 3 3 3; *)
  (*        goto None 10; *)
  (*      ] *)
  (*      [ [ [ mul (Some (Pand (plit false 1, plit false 2))) 3 1 1; ]; *)
  (*          [ add None 2 1 4; *)
  (*            add (Some (plit true 1)) 1 2 4; *)
  (*            seteq (Some (plit true 1)) 3 4 2; ] ]; *)
  (*        [ [ mul (Some (plit true 2)) 3 1 4; ]; *)
  (*          [ mul (Some (plit false 2)) 3 3 3; ]; *)
  (*          [ goto None 10; ] *)
  (*        ] *)
  (*      ] *)
  (* then Printf.printf "Passed 1\n" *)
  (*  else Printf.printf "Failed 1\n"); *)
  (* (if schedule_oracle [] *)
  (*       [ seteq (Some (plit true 1)) 2 1 2; *)
  (*         goto None 10; *)
  (*      ] *)
  (*       [ [ [ goto (Some (plit false 1)) 10; *)
  (*             seteq None 2 1 2; *)
  (*             goto None 10; *)
  (*       ] ] ] *)
  (* then Printf.printf "Passed 1\n" *)
  (*  else Printf.printf "Failed 1\n");   *)
  (* (if schedule_oracle [] *)
  (*       [ seteq None 2 1 2; *)
  (*         seteq None 3 1 2; *)
  (*         seteq (Some (Por (plit true 2, plit false 3))) 4 1 3; *)
  (*      ] *)
  (*       [ [ [ seteq None 2 1 2; *)
  (*             seteq None 3 1 2; *)
  (*             seteq None 4 1 3; *)
  (*       ] ] ] *)
  (* then Printf.printf "Passed 1\n" *)
  (*  else Printf.printf "Failed 1\n");   *)
  (* (if schedule_oracle [] *)
  (*       [ sett (Some (plit false 1)) 2 1; *)
  (*         div (Some (plit true 1)) 1 2 3; *)
  (*       ] *)
  (*       [ [ [ div (Some (plit true 1)) 1 2 3; *)
  (*             sett (Some (plit false 1)) 2 1; *)
  (*       ] ] ] *)
  (* then Printf.printf "Passed 1\n" *)
  (*  else Printf.printf "Failed 1\n"); *)
  (* (if schedule_oracle [] *)
  (*       [ const (Some (plit true 1)) 1 0; *)
  (*         const (Some (Por (plit true 1, plit false 1))) 1 1; *)
  (*       ] *)
  (*       [ [ [ const None 1 1; *)
  (*       ] ] ] *)
  (*  then Printf.printf "Passed 1\n" *)
  (*  else Printf.printf "Failed 1\n"); *)
  (* (if schedule_oracle [(pred 3, pred 2)] *)
  (*      [ add None 2 1 4; *)
  (*        seteq None 1 10 11; *)
  (*        add (Some (plit true 1)) 1 2 4; *)
  (*        seteq (Some (plit true 1)) 2 12 13; *)
  (*        mul (Some (Pand (plit true 1, plit true 2))) 3 1 4; *)
  (*        goto (Some (Pand (plit true 1, plit true 2))) 10; *)
  (*        mul (Some (Pand (plit true 1, plit false 2))) 3 3 3; *)
  (*        goto (Some (Pand (plit true 1, plit false 2))) 10; *)
  (*        seteq (Some (plit false 1)) 3 12 13; *)
  (*        mul (Some (Pand (plit false 1, plit true 3))) 3 1 4; *)
  (*        goto (Some (Pand (plit false 1, plit true 3))) 10; *)
  (*        mul (Some (Pand (plit false 1, plit false 3))) 3 1 1; *)
  (*        mul (Some (Pand (plit false 1, plit false 3))) 3 3 3; *)
  (*        goto (Some (Pand (plit false 1, plit false 3))) 10; *)
  (*      ] *)
  (*      [ [ [ seteq None 1 10 11; *)
  (*            add None 2 1 4; *)
  (*            seteq (Some (plit false 1)) 3 12 13; *)
  (*            seteq (Some (plit true 1)) 2 12 13; *)
  (*            add (Some (plit true 1)) 1 2 4; *)
  (*            mul (Some (Pand (plit true 1, plit true 2))) 3 1 4; *)
  (*            mul (Some (Pand (plit true 1, plit false 2))) 3 3 3; *)
  (*            mul (Some (Pand (plit false 1, plit true 2))) 3 1 4; *)
  (*            mul (Some (Pand (plit false 1, plit false 2))) 3 1 1; *)
  (*            mul (Some (Pand (plit false 1, plit false 2))) 3 3 3; *)
  (*            goto None 10; *)
  (*      ] ] ] *)
  (* then Printf.printf "Passed 110\n" *)
  (*  else Printf.printf "Failed 102\n"); *)
  (*   (if schedule_oracle [(pred 3, pred 2)] *)
  (*      [ add None 2 1 4; *)
  (*        seteq None 1 10 11; *)
  (*        add (Some (plit true 1)) 1 2 4; *)
  (*        seteq (Some (plit true 1)) 2 12 13; *)
  (*        mul (Some (Pand (plit true 1, plit true 2))) 3 1 4; *)
  (*        goto (Some (Pand (plit true 1, plit true 2))) 10; *)
  (*        mul (Some (Pand (plit true 1, plit false 2))) 5 3 3; *)
  (*        goto (Some (Pand (plit true 1, plit false 2))) 10; *)
  (*        seteq (Some (plit false 1)) 3 12 13; *)
  (*        mul (Some (Pand (plit false 1, plit true 3))) 3 1 4; *)
  (*        goto (Some (Pand (plit false 1, plit true 3))) 10; *)
  (*        mul (Some (Pand (plit false 1, plit false 3))) 3 1 1; *)
  (*        mul (Some (Pand (plit false 1, plit false 3))) 5 3 3; *)
  (*        goto (Some (Pand (plit false 1, plit false 3))) 10; *)
  (*      ] *)
  (*      [ [ [ seteq None 1 10 11; *)
  (*            add None 2 1 4; *)
  (*            seteq (Some (plit false 1)) 3 12 13; *)
  (*            seteq (Some (plit true 1)) 2 12 13; *)
  (*            add (Some (plit true 1)) 1 2 4; *)
  (*            mul (Some (Pand (plit true 1, plit true 2))) 3 1 4; *)
  (*            mul (Some (Pand (plit false 1, plit true 2))) 3 1 4; *)
  (*            mul (Some (Pand (plit false 1, plit false 2))) 3 1 1; *)
  (*            mul (Some (Pand (plit true 1, plit false 2))) 5 3 3; *)
  (*            mul (Some (Pand (plit false 1, plit false 2))) 5 3 3; *)
  (*            goto None 10; *)
  (*      ] ] ] *)
  (* then Printf.printf "Passed 110\n" *)
  (*    else Printf.printf "Failed 102\n"); *)
  (*   (if schedule_oracle [(pred 3, pred 2)] *)
  (*      [ *)
  (*        seteq None 1 10 11; *)
  (*        seteq None 3 12 13; *)
  (*        seteq None 2 12 13; *)
  (*        add None 2 1 4; *)
  (*        mul (Some (Pand (plit false 1, plit false 3))) 3 1 1; *)
  (*        mul (Some (Pand (plit false 1, plit false 3))) 5 3 3; *)
  (*        goto (Some (Pand (plit false 1, plit false 3))) 10; *)
  (*        mul (Some (Pand (plit false 1, plit true 3))) 3 1 4; *)
  (*        goto (Some (Pand (plit false 1, plit true 3))) 10; *)
  (*        add (Some (plit true 1)) 1 2 4; *)
  (*        mul (Some (Pand (plit true 1, plit false 2))) 5 3 3; *)
  (*        goto (Some (Pand (plit true 1, plit false 2))) 10; *)
  (*        mul (Some (Pand (plit true 1, plit true 2))) 3 1 4; *)
  (*        goto (Some (Pand (plit true 1, plit true 2))) 10; *)
  (*      ] *)
  (*      [ [ [ seteq None 1 10 11; *)
  (*            seteq None 3 12 13; *)
  (*            seteq None 2 12 13; *)
  (*            mul (Some (Pand (plit false 1, plit false 2))) 3 1 1; *)
  (*            add None 2 1 4; *)
  (*            add (Some (plit true 1)) 1 2 4; *)
  (*            mul (Some (Pand (plit false 1, plit true 2))) 3 1 4; *)
  (*            mul (Some (Pand (plit true 1, plit true 2))) 3 1 4; *)
  (*            mul (Some (Pand (plit false 1, plit false 2))) 5 3 3; *)
  (*            mul (Some (Pand (plit true 1, plit false 2))) 5 3 3; *)
  (*            goto None 10; *)
  (*      ] ] ] *)
  (* then Printf.printf "Passed 110\n" *)
  (*    else Printf.printf "Failed 102\n") *)
    (if time_schedules "1"
       [ add (Some (Pand (plit false 1, plit false 2))) 2 2 1;
         goto (Some (Pand (plit true 1, plit true 1))) 10
       ]
       [[[ 
           goto (Some (Pand (plit true 1, plit true 1))) 10;
           add (Some (Pand (plit false 1, plit false 2))) 2 2 1
       ]]]
  then Printf.printf "Passed 110\n"
     else Printf.printf "Failed 102\n");
    (if time_schedules "2"
       [ 
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         goto (Some (Pand (plit true 2, plit true 2))) 10;
         goto (Some (Pand (plit true 3, plit true 3))) 10;
         goto (Some (Pand (plit true 4, plit true 4))) 10;
       ]
       [[[ 
            goto (Some (Pand (plit true 1, plit true 1))) 10;
            goto (Some (Pand (plit true 2, plit true 2))) 10;
            goto (Some (Pand (plit true 3, plit true 3))) 10;
            goto (Some (Pand (plit true 4, plit true 4))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
       ]]]
  then Printf.printf "Passed 110\n"
     else Printf.printf "Failed 102\n");
    (if time_schedules "3"
       [ 
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
         (* add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 2 2 4; *)
         (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         goto (Some (Pand (plit true 2, plit true 2))) 10;
         goto (Some (Pand (plit true 3, plit true 3))) 10;
         goto (Some (Pand (plit true 4, plit true 4))) 10;
       ]
       [[[ 
            goto (Some (Pand (plit true 1, plit true 1))) 10;
            (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
            goto (Some (Pand (plit true 2, plit true 2))) 10;
            (* add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 2 2 4; *)
            goto (Some (Pand (plit true 3, plit true 3))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
            goto (Some (Pand (plit true 4, plit true 4))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
       ]]]
  then Printf.printf "Passed 110\n"
     else Printf.printf "Failed 102\n");
    (if time_schedules "4"
       [ 
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
         (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         goto (Some (Pand (plit true 2, plit true 2))) 10;
         goto (Some (Pand (plit true 3, plit true 3))) 10;
         goto (Some (Pand (plit true 4, plit true 4))) 10;
       ]
       [[[ 
            goto (Some (Pand (plit true 1, plit true 1))) 10;
            (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
            goto (Some (Pand (plit true 2, plit true 2))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
            goto (Some (Pand (plit true 3, plit true 3))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
            goto (Some (Pand (plit true 4, plit true 4))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
       ]]]
  then Printf.printf "Passed 110\n"
     else Printf.printf "Failed 102\n");
    (if time_schedules "5"
       [            
         add (Some (Pand (plit false 1, plit false 10))) 40 50 51;
         seteq (Some (plit false 1)) 2 40 41;
         (* add (Some (Pand (plit true 10, plit true 4))) 40 52 53; *)
         (* seteq (Some (plit false 5)) 3 40 42; *)
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
         (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         goto (Some (Pand (plit true 2, plit true 2))) 10;
         goto (Some (Pand (plit true 3, plit true 3))) 10;
         goto (Some (Pand (plit true 4, plit true 4))) 10;
       ]
       [[[ 
            add (Some (Pand (plit false 1, plit false 10))) 40 50 51;
            seteq (Some (plit false 1)) 2 40 41;
            (* add (Some (Pand (plit true 10, plit true 4))) 40 52 53; *)
            (* seteq (Some (plit false 5)) 3 40 42; *)
            goto (Some (Pand (plit true 1, plit true 1))) 10;
            (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
            goto (Some (Pand (plit true 2, plit true 2))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
            goto (Some (Pand (plit true 3, plit true 3))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
            goto (Some (Pand (plit true 4, plit true 4))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
       ]]]
  then Printf.printf "Passed 110\n"
     else Printf.printf "Failed 104\n");
(if time_schedules "6"
       [            
         add (Some (Pand (plit false 1, plit false 10))) 40 50 51;
         seteq (Some (plit false 1)) 2 40 41;
         (* add (Some (Pand (plit true 10, plit true 4))) 40 52 53; *)
         (* seteq (Some (plit false 5)) 3 40 42; *)
            seteq (Some (plit false 5)) 3 41 40;
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
         (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         goto (Some (Pand (plit true 2, plit true 2))) 10;
         goto (Some (Pand (plit true 3, plit true 3))) 10;
         goto (Some (Pand (plit true 4, plit true 4))) 10;
       ]
       [[[ 
            add (Some (Pand (plit false 1, plit false 10))) 40 50 51;
            seteq (Some (plit false 1)) 2 40 41;
            (* add (Some (Pand (plit true 10, plit true 4))) 40 52 53; *)
            seteq (Some (plit false 5)) 3 41 40;
            goto (Some (Pand (plit true 1, plit true 1))) 10;
            (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
            goto (Some (Pand (plit true 2, plit true 2))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
            goto (Some (Pand (plit true 3, plit true 3))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
            goto (Some (Pand (plit true 4, plit true 4))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
       ]]]
  then Printf.printf "Passed 110\n"
     else Printf.printf "Failed 104\n");
    (if time_schedules "7"
       [            
         add (Some (Pand (plit false 1, plit false 10))) 40 50 51;
         seteq (Some (plit false 1)) 2 40 41;
         add (Some (Pand (plit true 10, plit true 4))) 40 52 53;
         seteq (Some (plit false 5)) 3 40 42;
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
         add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
         (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
         goto (Some (Pand (plit true 1, plit true 1))) 10;
         goto (Some (Pand (plit true 2, plit true 2))) 10;
         goto (Some (Pand (plit true 3, plit true 3))) 10;
         goto (Some (Pand (plit true 4, plit true 4))) 10;
       ]
       [[[ 
            add (Some (Pand (plit false 1, plit false 10))) 40 50 51;
            seteq (Some (plit false 1)) 2 40 41;
            add (Some (Pand (plit true 10, plit true 4))) 40 52 53;
            seteq (Some (plit false 5)) 3 40 42;
            goto (Some (Pand (plit true 1, plit true 1))) 10;
            (* add (Some (Pand (Pand (Pand (plit false 1, plit true 2), plit false 3), plit false 4))) 2 2 5; *)
            goto (Some (Pand (plit true 2, plit true 2))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit true 3), plit false 4))) 11 2 4;
            goto (Some (Pand (plit true 3, plit true 3))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit true 4))) 10 2 3;
            goto (Some (Pand (plit true 4, plit true 4))) 10;
            add (Some (Pand (Pand (Pand (plit false 1, plit false 2), plit false 3), plit false 4))) 2 2 1;
       ]]]
  then Printf.printf "Passed 110\n"
     else Printf.printf "Failed 104\n")