procedure Main is
   function Half (N : Integer) return Integer is
     (if N mod 2 = 0 then N / 2 else raise Constraint_Error with "odd");

   function Even_Half (N : Integer) return Integer is
     (if N mod 2 = 0 then N / 2 else raise Constraint_Error)
   with Pre => N mod 2 = 0;

   X : Integer := Even_Half (10);
begin
   if X > 100 then
      raise Program_Error;
   end if;
   if X >= 0 then
      X := X / 2 + (declare Y : constant Integer := X; begin (if Y >= 0 then Y else raise Program_Error));
   end if;
end Main;
