maxpos(S,i) is
@$\bb$@ Var k @$\in$@ Int;
   initially k=i-1 @$ \land $@ j=i
   do 
     k@$ \ge $@0 @$\rightarrow$@ if 
                 S.k @$>$@ S.j @$\rightarrow$@ j,k:=k,k-1
                @$\assync$@ S.k@$ \le $@S.j @$\rightarrow$@ k:= k-1
            fi
   od
@$\be$@




