(* pour debugger ../../compiler/hec.byte -i -v -I ../../lib t1.ept *)
(* pour debugger
   directory parsing global analysis dataflow sequential sigali simulation translation main
   set arguments -v ../test/good/t1.ept *)

type t = A | B

node bool2int(b: bool) returns (o: int)
  let
    o = merge b (true -> 1) (false -> 0)
  tel

node t2bool(x: t) returns (b: bool)
  let
    b = merge x (A-> true) (B-> false)
  tel

node filter(x:int; c:t) returns (y:int on A(c))
  let
    y = x when A(c)
  tel

node fusion(x1:int; x2:int; c:t) returns (y :int)
  let
    y = merge c (A -> x1) (B -> x2)
  tel

node main() returns (y,c':int)
var c:t;x:int;
let
  x = 1 fby if x > 10 then 1 else x + 2;
  c = A fby B fby c;
  y = fusion(filter(x,c),-4,c);
  c' = bool2int(t2bool(c));
tel
