let rec eq_ctype typ t1 t2 = eq_object (object_of typ) t1 t2

and eq_object obj t1 t2 =
  match obj with
    | C_int _ -> p_icmp Ceq t1 t2
    | C_float _ -> p_rcmp Ceq t1 t2
    | C_comp c -> p_call (EqComp.obtain c) [t1;t2]
    | C_array a -> p_call (EqArray.obtain (tarray_of_arrayinfo a [])) [t1;t2]
    | C_pointer _ -> p_equal t1 t2

and eq_logic_type lt t1 t2 =
  match lt with
    | Ctype typ -> eq_ctype typ t1 t2
    | _ -> p_equal t1 t2