drop function if exists f1(int);
create or replace function f1(int) returns double precision as 
$$
declare
begin
  return 1;
end;
$$ language plpgsql;

drop procedure if exists p1();
create or replace procedure p1() as 
$$
declare
  res1 double precision;
  res2 double precision;
  res3 double precision;
  res4 double precision;
  res5 double precision;
  res6 double precision;
  res7 double precision;
  res8 double precision;
  res9 double precision;
  res10 double precision;
  res11 double precision;
  res12 double precision;
  res13 double precision;
  res14 double precision;
  res15 double precision;
  res16 double precision;
  res17 double precision;
  res18 double precision;
  res19 double precision;
  res20 double precision;
  res21 double precision;
  res22 double precision;
  res23 double precision;
  res24 double precision;
  res25 double precision;
  res26 double precision;
  res27 double precision;
  res28 double precision;
  res29 double precision;
  res30 double precision;
  res31 double precision;
  res32 double precision;
  res33 double precision;
  res34 double precision;
  res35 double precision;
  res36 double precision;
  res37 double precision;
  res38 double precision;
  res39 double precision;
  res40 double precision;
  res41 double precision;
  res42 double precision;
  res43 double precision;
  res44 double precision;
  res45 double precision;
  res46 double precision;
  res47 double precision;
  res48 double precision;
  res49 double precision;
  res50 double precision;
  res51 double precision;
  res52 double precision;
  res53 double precision;
  res54 double precision;
  res55 double precision;
  res56 double precision;
  res57 double precision;
  res58 double precision;
  res59 double precision;
  res60 double precision;
  res61 double precision;
  res62 double precision;
  res63 double precision;
  res64 double precision;
  res65 double precision;
  res66 double precision;
  res67 double precision;
  res68 double precision;
  res69 double precision;
  res70 double precision;
  res71 double precision;
  res72 double precision;
  res73 double precision;
  res74 double precision;
  res75 double precision;
  res76 double precision;
  res77 double precision;
  res78 double precision;
  res79 double precision;
  res80 double precision;
 begin
    res1 := f1(1);
    res2 := f1(1);
    res3 := f1(1);
    res4 := f1(1);
    res5 := f1(1);
    res6 := f1(1);
    res7 := f1(1);
    res8 := f1(1);
    res8 := f1(1);
    res10 := f1(1);   
    res11 := f1(1);
    res12 := f1(1);
    res13 := f1(1);
    res14 := f1(1);
    res15 := f1(1);
    res16 := f1(1);
    res17 := f1(1);
    res18 := f1(1);
    res18 := f1(1);
    res20 := f1(1);   
    res21 := f1(1);
    res22 := f1(1);
    res23 := f1(1);
    res24 := f1(1);
    res25 := f1(1);
    res26 := f1(1);
    res27 := f1(1);
    res28 := f1(1);
    res29 := f1(1);
    res30 := f1(1);  
    res31 := f1(1);
    res32 := f1(1);
    res33 := f1(1);
    res34 := f1(1);
    res35 := f1(1);
    res36 := f1(1);
    res37 := f1(1);
    res38 := f1(1);
    res39 := f1(1);
    res40 := f1(1);    
    res41 := f1(1);
    res42 := f1(1);
    res43 := f1(1);
    res44 := f1(1);
    res45 := f1(1);
    res46 := f1(1);
    res47 := f1(1);
    res48 := f1(1);
    res49 := f1(1);
    res50 := f1(1);
    res51 := f1(1);
    res52 := f1(1);
    res53 := f1(1);
    res54 := f1(1);
    res55 := f1(1);
    res56 := f1(1);
    res57 := f1(1);
    res58 := f1(1);
    res59 := f1(1);
    res60 := f1(1);
    res61 := f1(1);
    res62 := f1(1);
    res63 := f1(1);
    res64 := f1(1);
    res65 := f1(1);
    res66 := f1(1);
    res67 := f1(1);
    res68 := f1(1);
    res69 := f1(1);
    res70 := f1(1);
    res71 := f1(1);
    res72 := f1(1);
    res73 := f1(1);
    res74 := f1(1);
    res75 := f1(1);
    res76 := f1(1);
    res77 := f1(1);
    res78 := f1(1);
    res79 := f1(1);
    res80 := f1(1);
end;
$$ language plpgsql;

drop procedure if exists p2();
create or replace procedure p2() as 
$$
begin 
  call p1();
end;
$$ language plpgsql;

\timing on
do $$
declare
  ln_result int;
begin
  for i in 1..61488
  loop
    ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);
    ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);
    ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);
    ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);ln_result := f1(1);
    call p2(); call p2(); call p2(); call p2(); call p1(); call p1(); call p1(); call p1(); call p1(); call p1(); 
    call p2(); call p2(); call p2(); call p2(); call p1(); call p1(); call p1(); call p1(); call p1(); call p1(); 
    call p2(); call p2(); call p2(); call p2(); call p1(); call p1(); call p1(); call p1(); call p1(); call p1(); 
    call p2(); call p2(); call p2(); call p2(); call p1(); call p1(); call p1(); call p1(); call p1(); call p1(); 
    call p2(); call p2(); call p2(); call p2(); call p1(); call p1(); call p1(); call p1(); call p1(); call p1();    
   end loop;
end;
$$ language plpgsql;
