C.MAIN
C MAIN PROGRAM
C
      DIMENSION INP(2100),IOP(2100),IOB(2100)
       COMMON INP,IOP,IOB
C READ DATA RECORDS
       IOFF=0.
       CALL IN
       CALL TIME(IMIN,ISEC,IOFF)
C EXECUTE BENCHMARK PROGRAM
      CALL BENCH
       IOFF=1
       WRITE (4,100) IMIN,ISEC
100   FORMAT(1X,I3,5H MIN ,I3,4H SEC)
C
       CALL OUT
       STOP
       END
C.IN
C SUB-RTN TO READ DATA RECORDS
      SUBROUTINE IN
      DIMENSION INP(2100),IOP(2100),IOB(2100)
        COMMON INP,IOP,IOB
      DO 100 KM=1,2100
      INP(KM)=0
      IOP(KM)=0
      IOB(KM)=0
100   CONTINUE
      DO 500 KS=1,2048
      LL=2049-KS
      INP(KS)=LL
500   CONTINUE
101   RETURN
      END
C.OUT
C SUB-RTN LIST OUTPUT(INTERNAL-SORT)
      SUBROUTINE OUT
      DIMENSION INP(2100),IOP(2100),IOB(2100)
        COMMON INP,IOP,IOB
      ICC=1
302   ITC=ICC+11
      WRITE(4,2)(INP(L),L=ICC,ITC)
      WRITE(4,2)(IOB(L),L=ICC,ITC)
2     FORMAT(12I6)
      IF(INP(ITC))300,301,300
300   ICC=ICC+12
      GO TO 302
301   RETURN
      END
C.BNCH
      SUBROUTINE BENCH
      DIMENSION INP(2100),IOP(2100),IOB(2100)
        COMMON INP,IOP,IOB
      ICL=2**14
      DO 200 K=1,2048
      IOP(K)=K
200   CONTINUE
      IA=0
108   ICN=0
      IA=IA+1
      IB=2**IA
      DO 120 I=1,2048,IB
      IC=I+IB-1
      DO 104 K=1,IB
      JA=I
      DO 106 J=I,IC
      IF(IOP(J)-ICL)130,106,106
130   IF(IOP(JA)-ICL)107,109,109
107   K1=IOP(JA)
      K2=IOP(J)
      IF(INP(K1)-INP(K2))106,106,109
109   JA=J
106   CONTINUE
      ICN=ICN+1
      IOB(ICN)=IOP(JA)
      IOP(JA)=ICL
104   CONTINUE
120   CONTINUE
      DO 105 JJ=1,ICN
      IOP(JJ)=IOB(JJ)
105   CONTINUE
      IF(IB-2048)108,400,400
400   DO 110 M=1,ICN
      K=IOP(M)
      IOB(M)=INP(K)
110   CONTINUE
      RETURN
      END
