----------------------------------------------
--        A multiplication algorithm        --
--         created by Actor Prolog.         --
--  (c) 2002, Alexei A. Morozov, IRE RAS.   --
----------------------------------------------
-- The begining of program
-- Target function: a * b
with TEXT_IO;
use TEXT_IO;
procedure EXAMPLE is
package IO_INT is new INTEGER_IO(INTEGER);
use IO_INT;
r,b,a: INTEGER;
begin
   put("Enter unsigned number 'b', please: ");
   get(b);
   put("Enter unsigned number 'a', please: ");
   get(a);
   declare
   VAR0,VAR1: INTEGER;
   begin
      VAR0 := a;
      VAR1 := b;
      declare
      VAR3,VAR2,VAR4: INTEGER;
      begin
         VAR3 := 0;
         VAR2 := VAR0;
         VAR4 := VAR1;
         while VAR2 /= 0 loop
         begin
            if VAR2 rem 2 = 1 then
               VAR3 := (VAR3 + VAR4);
            elsif VAR2 rem 2 = 0 then
               VAR3 := (VAR3 + (VAR4 + VAR4));
            end if;
            if VAR2 rem 2 = 1 then
               VAR4 := VAR4;
            elsif VAR2 rem 2 = 0 then
               VAR4 := (VAR4 + VAR4);
            end if;
            if VAR2 rem 2 = 1 then
               VAR2 := (VAR2 + (-1));
            elsif VAR2 rem 2 = 0 then
               VAR2 := (VAR2 /2 + (-1));
            end if;
         end;
         end loop;
         r := VAR3;
      end;
   end;
   put("Variable r : ");
   put(r);
end;
-- The end of program

----------------------------------------------
--        A multiplication algorithm        --
--         created by Actor Prolog.         --
--  (c) 2002, Alexei A. Morozov, IRE RAS.   --
----------------------------------------------
-- The begining of program
-- Target function: a * b
with TEXT_IO;
use TEXT_IO;
procedure EXAMPLE is
package IO_INT is new INTEGER_IO(INTEGER);
use IO_INT;
r,b,a: INTEGER;
begin
   put("Enter unsigned number 'b', please: ");
   get(b);
   put("Enter unsigned number 'a', please: ");
   get(a);
   declare
   VAR0,VAR1: INTEGER;
   begin
      VAR0 := a;
      VAR1 := b;
      declare
      VAR3,VAR2,VAR4: INTEGER;
      begin
         VAR3 := 0;
         VAR2 := VAR0;
         VAR4 := VAR1;
         while VAR2 /= 0 loop
         begin
            if VAR2 rem 2 = 1 then
               VAR3 := (VAR3 + VAR4);
            elsif VAR2 rem 2 = 0 then
               VAR3 := VAR3;
            end if;
            if VAR2 rem 2 = 1 then
               VAR4 := VAR4;
            elsif VAR2 rem 2 = 0 then
               VAR4 := (VAR4 + VAR4);
            end if;
            if VAR2 rem 2 = 1 then
               VAR2 := (VAR2 + (-1));
            elsif VAR2 rem 2 = 0 then
               VAR2 := VAR2 /2;
            end if;
         end;
         end loop;
         r := VAR3;
      end;
   end;
   put("Variable r : ");
   put(r);
end;
-- The end of program