// Effectus auto-generated Mad Pascal source code listing
program resievePrg;

uses
  Crt, StringUtils;

var
  eff_loop_var : byte;
  eff_cnt : byte;
  eff_string : string;
// Effectus example:
// Benchmark test
// calculating prime numbers
var
  ch : byte absolute 764;  // ch_byte_array
  RTCLOCK : byte absolute 20;  // RTCLOCK_byte_array
  FLAGS : array[0..8191] of byte;  // FLAGS_byte_array

procedure SIEVEProc;
var
  SQRCOUNT : byte = 91;  // SQRCOUNT_byte_array
  FRAME : byte = 0;  // FRAME_byte_array
  N : word;  // N_byte_array
  K : word;  // K_byte_array
begin
 WHILE FRAME=RTCLOCK do begin
  end;
  FillChar(FLAGS, 8190, 1);
 FOR N:=2 TO SQRCOUNT do begin
  if  FLAGS[N]=1  then begin
  K := N*2;
 WHILE K<=8191 do begin
  FLAGS[K] := 0;
  Inc(K, N);
  end;
  end;  // if
  end;
end;

procedure MAINProc;
var
  N : word;  // N_byte_array
  COUNT : word = 0;  // COUNT_byte_array
begin
  RTCLOCK := 0;
  SIEVEProc;
  Write('Effectus 0.5');
  Write('', eol, ' ', RTCLOCK, ' JIFFIES');
 FOR N:=2 TO 8191 do begin
  if  FLAGS[N]=1  then begin
  Inc(COUNT);
  end;  // if
  end;
  Write('', eol, ' ', COUNT, ' PRIMES');
 WHILE ch=255 do begin
  end;
end;

begin
  MAINProc;
end.
