      SUBROUTINE MAIN
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      CALL INIT
      IF (.NOT.(OPTION .EQ. 4))GOTO 23000
      CALL SCOMPR
      GOTO 23001
23000 CONTINUE
      CALL LOAD
      CALL PAIR
      CALL GROW
      CALL LABEL
      CALL REPORT
23001 CONTINUE
      CALL CLEAN
      RETURN
      END
      SUBROUTINE CLEAN
      INTEGER JUNK
      INTEGER REMOVE
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      CALL CLOSE (OFILE)
      IF (.NOT.(NFILE .NE. 1))GOTO 23002
      CALL CLOSE (NFILE)
23002 CONTINUE
      CALL CLOSE(OCOPY)
      JUNK = REMOVE (OCNAME)
      CALL CLOSE(NCOPY)
      JUNK = REMOVE (NCNAME)
      CALL CLOSE(TFILE)
      JUNK = REMOVE (TFNAME)
      RETURN
      END
      INTEGER FUNCTION ENTER (LINE)
      LOGICAL*1 LINE (100)
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER H
      INTEGER HASH
      INTEGER I, P
      LOGICAL*1 TEXT (512)
      INTEGER JUNK
      INTEGER EQUAL, GETLIN, NOTE
      H = HASH (LINE)
      P = BUCKET (H)
23004 IF (.NOT.(P .NE. 0))GOTO 23005
      I = SSTORE(P + 1)
      CALL SEEK (TLOC(I), TFILE)
      JUNK = GETLIN (TEXT, TFILE)
      IF (.NOT.(EQUAL (LINE, TEXT) .EQ. 1))GOTO 23006
      ENTER=(I)
      RETURN
23006 CONTINUE
      P = SSTORE(P)
      GOTO 23004
23005 CONTINUE
      IF (.NOT.(NINX .GE. 1000))GOTO 23008
      CALL ERROR (45Htoo many unique lines; symbol table overflow.)
23008 CONTINUE
      I = NINX
      NINX = NINX + 1
      H = HASH (LINE)
      SSTORE(NSYM) = BUCKET (H)
      SSTORE(NSYM + 1) = I
      BUCKET (H) = NSYM
      NSYM = NSYM + 2
      CALL SEEK (TFEND, TFILE)
      CALL PTRCPY(TFEND, TLOC(I))
      CALL PUTLIN (LINE, TFILE)
      JUNK = NOTE(TFEND, TFILE)
      ENTER=(I)
      RETURN
      END
      SUBROUTINE GLIST
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER OI, NI
      INTEGER JUNK
      INTEGER GETLIN
      LOGICAL*1 LINE (512)
      LOGICAL*1 NBAR(3)
      LOGICAL*1 CIBL(4)
      LOGICAL*1 CI5BL(8)
      LOGICAL*1 OBAR(3)
      LOGICAL*1 CD(3)
      LOGICAL*1 BL5BAR(7)
      LOGICAL*1 BLD(3)
      LOGICAL*1 BLIBL(4)
      LOGICAL*1 BLI5BL(8)
      DATA NBAR(1)/110/,NBAR(2)/124/,NBAR(3)/0/
      DATA CIBL(1)/99/,CIBL(2)/105/,CIBL(3)/32/,CIBL(4)/0/
      DATA CI5BL(1)/99/,CI5BL(2)/105/,CI5BL(3)/32/,CI5BL(4)/32/,CI5BL(5)
     */32/,CI5BL(6)/32/,CI5BL(7)/32/,CI5BL(8)/0/
      DATA OBAR(1)/111/,OBAR(2)/124/,OBAR(3)/0/
      DATA CD(1)/99/,CD(2)/100/,CD(3)/0/
      DATA BL5BAR(1)/32/,BL5BAR(2)/32/,BL5BAR(3)/32/,BL5BAR(4)/32/,BL5BA
     *R(5)/32/,BL5BAR(6)/124/,BL5BAR(7)/0/
      DATA BLD(1)/32/,BLD(2)/100/,BLD(3)/0/
      DATA BLIBL(1)/32/,BLIBL(2)/105/,BLIBL(3)/32/,BLIBL(4)/0/
      DATA BLI5BL(1)/32/,BLI5BL(2)/105/,BLI5BL(3)/32/,BLI5BL(4)/32/,BLI5
     *BL(5)/32/,BLI5BL(6)/32/,BLI5BL(7)/32/,BLI5BL(8)/0/
      OI = 2
      NI = 2
23010 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 0 .AND. NCOUNT(NI) .EQ. 0))GOTO 23013
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23015
      CALL PUTCH (10, 2)
23015 CONTINUE
23017 IF (.NOT.(OCOUNT(OI) .EQ. 0 .AND. NCOUNT(NI) .EQ. 0))GOTO 23018
      JUNK = GETLIN (LINE, OCOPY)
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23019
      CALL PUTINT (OI - 1, 7, 2)
      CALL PUTINT (NI - 1, 5, 2)
      CALL PUTLIN (LINE, 2)
23019 CONTINUE
      JUNK = GETLIN (LINE, NCOPY)
      OI = OI + 1
      NI = NI + 1
      GOTO 23017
23018 CONTINUE
      GOTO 23014
23013 CONTINUE
      IF (.NOT.(OCOUNT(OI) .NE. 1 .AND. NCOUNT(NI) .EQ. 1))GOTO 23021
      CALL PUTCH (10, 2)
23023 IF (.NOT.(NCOUNT(NI) .EQ. 1))GOTO 23025
      JUNK = GETLIN (LINE, NCOPY)
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23026
      CALL PUTLIN (BLI5BL, 2)
      CALL PUTINT (NI - 1, 5, 2)
      CALL PUTCH (124, 2)
      GOTO 23027
23026 CONTINUE
      CALL PUTLIN (BLIBL, 2)
      CALL PUTINT (NI - 1, 4, 2)
      CALL PUTLIN (NBAR, 2)
23027 CONTINUE
      CALL PUTLIN (LINE, 2)
23024 NI = NI + 1
      GOTO 23023
23025 CONTINUE
      GOTO 23022
23021 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 1 .AND. NCOUNT(NI) .NE. 1))GOTO 23028
      CALL PUTCH (10, 2)
23030 IF (.NOT.(OCOUNT(OI) .EQ. 1))GOTO 23032
      JUNK = GETLIN (LINE, OCOPY)
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23033
      CALL PUTLIN (BLD, 2)
      CALL PUTINT (OI - 1, 5, 2)
      CALL PUTLIN (BL5BAR, 2)
      GOTO 23034
23033 CONTINUE
      CALL PUTLIN (BLD, 2)
      CALL PUTINT (OI - 1, 5, 2)
      CALL PUTLIN (OBAR, 2)
23034 CONTINUE
      CALL PUTLIN (LINE, 2)
23031 OI = OI + 1
      GOTO 23030
23032 CONTINUE
      GOTO 23029
23028 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 1 .AND. NCOUNT(NI) .EQ. 1))GOTO 23035
      CALL PUTCH (10, 2)
23037 IF (.NOT.(OCOUNT(OI) .EQ. 1))GOTO 23039
      JUNK = GETLIN (LINE, OCOPY)
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23040
      CALL PUTLIN (CD, 2)
      CALL PUTINT (OI - 1, 5, 2)
      CALL PUTLIN (BL5BAR, 2)
      GOTO 23041
23040 CONTINUE
      CALL PUTLIN (CD, 2)
      CALL PUTINT (OI - 1, 5, 2)
      CALL PUTLIN (OBAR, 2)
23041 CONTINUE
      CALL PUTLIN (LINE, 2)
23038 OI = OI + 1
      GOTO 23037
23039 CONTINUE
      CALL PUTCH (10, 2)
23042 IF (.NOT.(NCOUNT(NI) .EQ. 1))GOTO 23044
      JUNK = GETLIN (LINE, NCOPY)
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23045
      CALL PUTLIN (CI5BL, 2)
      CALL PUTINT (NI - 1, 5, 2)
      CALL PUTCH (124, 2)
      GOTO 23046
23045 CONTINUE
      CALL PUTLIN (CIBL, 2)
      CALL PUTINT (NI - 1, 4, 2)
      CALL PUTLIN (NBAR, 2)
23046 CONTINUE
      CALL PUTLIN (LINE, 2)
23043 NI = NI + 1
      GOTO 23042
23044 CONTINUE
      GOTO 23036
23035 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 2 .AND. NCOUNT(NI) .EQ. 2))GOTO 23047
      GOTO 23012
23047 CONTINUE
23036 CONTINUE
23029 CONTINUE
23022 CONTINUE
23014 CONTINUE
23011 GOTO 23010
23012 CONTINUE
      RETURN
      END
      SUBROUTINE GREVIS
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER OI, NI
      INTEGER JUNK
      INTEGER GETLIN
      LOGICAL*1 LINE (512)
      LOGICAL*1 BRBAR(9)
      LOGICAL*1 ERBAR(7)
      LOGICAL*1 BDSTAR(9)
      LOGICAL*1 EDSTAR(7)
      DATA BRBAR(1)/91/,BRBAR(2)/99/,BRBAR(3)/99/,BRBAR(4)/93/,BRBAR(5)/
     *109/,BRBAR(6)/99/,BRBAR(7)/32/,BRBAR(8)/124/,BRBAR(9)/0/
      DATA ERBAR(1)/91/,ERBAR(2)/99/,ERBAR(3)/99/,ERBAR(4)/93/,ERBAR(5)/
     *109/,ERBAR(6)/99/,ERBAR(7)/0/
      DATA BDSTAR(1)/91/,BDSTAR(2)/99/,BDSTAR(3)/99/,BDSTAR(4)/93/,BDSTA
     *R(5)/109/,BDSTAR(6)/99/,BDSTAR(7)/32/,BDSTAR(8)/42/,BDSTAR(9)/0/
      DATA EDSTAR(1)/91/,EDSTAR(2)/99/,EDSTAR(3)/99/,EDSTAR(4)/93/,EDSTA
     *R(5)/109/,EDSTAR(6)/99/,EDSTAR(7)/0/
      OI = 2
      NI = 2
23049 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 0 .AND. NCOUNT(NI) .EQ. 0))GOTO 23052
      OI = OI + 1
      NI = NI + 1
      JUNK = GETLIN (LINE, NCOPY)
      CALL PUTLIN (LINE, 2)
      GOTO 23053
23052 CONTINUE
      IF (.NOT.(OCOUNT(OI) .NE. 1 .AND. NCOUNT(NI) .EQ. 1))GOTO 23054
      CALL PUTLIN (BRBAR, 2)
      CALL PUTCH (10, 2)
23056 IF (.NOT.(NCOUNT(NI) .EQ. 1))GOTO 23058
      JUNK = GETLIN (LINE, NCOPY)
      CALL PUTLIN (LINE, 2)
23057 NI = NI + 1
      GOTO 23056
23058 CONTINUE
      CALL PUTLIN (ERBAR, 2)
      CALL PUTCH (10, 2)
      GOTO 23055
23054 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 1 .AND. NCOUNT(NI) .NE. 1))GOTO 23059
      CALL PUTLIN (BDSTAR, 2)
      CALL PUTCH (10, 2)
      CALL PUTLIN (EDSTAR, 2)
      CALL PUTCH (10, 2)
23061 IF (.NOT.(OCOUNT(OI) .EQ. 1))GOTO 23063
23062 OI = OI + 1
      GOTO 23061
23063 CONTINUE
      GOTO 23060
23059 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 1 .AND. NCOUNT(NI) .EQ. 1))GOTO 23064
23066 IF (.NOT.(OCOUNT(OI) .EQ. 1))GOTO 23068
23067 OI = OI + 1
      GOTO 23066
23068 CONTINUE
      CALL PUTLIN (BRBAR, 2)
      CALL PUTCH (10, 2)
23069 IF (.NOT.(NCOUNT(NI) .EQ. 1))GOTO 23071
      JUNK = GETLIN (LINE, NCOPY)
      CALL PUTLIN (LINE, 2)
23070 NI = NI + 1
      GOTO 23069
23071 CONTINUE
      CALL PUTLIN (ERBAR, 2)
      CALL PUTCH (10, 2)
      GOTO 23065
23064 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 2 .AND. NCOUNT(NI) .EQ. 2))GOTO 23072
      GOTO 23051
23072 CONTINUE
23065 CONTINUE
23060 CONTINUE
23055 CONTINUE
23053 CONTINUE
23050 GOTO 23049
23051 CONTINUE
      RETURN
      END
      SUBROUTINE GSCRIP
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER OI, NI, OFFSET, LENGTH
      INTEGER JUNK
      INTEGER GETLIN
      LOGICAL*1 LINE (512)
      OI = 2
      NI = 2
      OFFSET = 0
23074 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 0 .AND. NCOUNT(NI) .EQ. 0))GOTO 23077
      OI = OI + 1
      NI = NI + 1
      JUNK = GETLIN (LINE, NCOPY)
      GOTO 23078
23077 CONTINUE
      IF (.NOT.(OCOUNT(OI) .NE. 1 .AND. NCOUNT(NI) .EQ. 1))GOTO 23079
      CALL PUTINT (OI - 2 + OFFSET, 0, 2)
      CALL PUTCH (97, 2)
      CALL PUTCH (10, 2)
      LENGTH = 0
23081 IF (.NOT.(NCOUNT(NI) .EQ. 1))GOTO 23083
      LENGTH = LENGTH + 1
      JUNK = GETLIN (LINE, NCOPY)
      CALL PUTLIN (LINE, 2)
23082 NI = NI + 1
      GOTO 23081
23083 CONTINUE
      CALL PUTCH (46, 2)
      CALL PUTCH (10, 2)
      OFFSET = OFFSET + LENGTH
      GOTO 23080
23079 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 1 .AND. NCOUNT(NI) .NE. 1))GOTO 23084
      LENGTH = 0
23086 IF (.NOT.(OCOUNT(OI) .EQ. 1))GOTO 23088
      LENGTH = LENGTH + 1
23087 OI = OI + 1
      GOTO 23086
23088 CONTINUE
      CALL PUTINT (OI - 1 - LENGTH + OFFSET, 0, 2)
      CALL PUTCH (44, 2)
      CALL PUTINT (OI - 2 + OFFSET, 0, 2)
      CALL PUTCH (100, 2)
      CALL PUTCH (10, 2)
      OFFSET = OFFSET - LENGTH
      GOTO 23085
23084 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 1 .AND. NCOUNT(NI) .EQ. 1))GOTO 23089
      LENGTH = 0
23091 IF (.NOT.(OCOUNT(OI) .EQ. 1))GOTO 23093
      LENGTH = LENGTH + 1
23092 OI = OI + 1
      GOTO 23091
23093 CONTINUE
      CALL PUTINT (OI - 1 - LENGTH + OFFSET, 0, 2)
      CALL PUTCH (44, 2)
      CALL PUTINT (OI - 2 + OFFSET, 0, 2)
      CALL PUTCH (99, 2)
      CALL PUTCH (10, 2)
      OFFSET = OFFSET - LENGTH
      LENGTH = 0
23094 IF (.NOT.(NCOUNT(NI) .EQ. 1))GOTO 23096
      LENGTH = LENGTH + 1
      JUNK = GETLIN (LINE, NCOPY)
      CALL PUTLIN (LINE, 2)
23095 NI = NI + 1
      GOTO 23094
23096 CONTINUE
      CALL PUTCH (46, 2)
      CALL PUTCH (10, 2)
      OFFSET = OFFSET + LENGTH
      GOTO 23090
23089 CONTINUE
      IF (.NOT.(OCOUNT(OI) .EQ. 2 .AND. NCOUNT(NI) .EQ. 2))GOTO 23097
      GOTO 23076
23097 CONTINUE
23090 CONTINUE
23085 CONTINUE
23080 CONTINUE
23078 CONTINUE
23075 GOTO 23074
23076 CONTINUE
      CALL PUTCH (119, 2)
      CALL PUTCH (10, 2)
      RETURN
      END
      SUBROUTINE GROW
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER I, NX
      I = 1
23099 IF (.NOT.(I .LT. NSIZE))GOTO 23101
      NX = NXREF(I)
      IF (.NOT.(NX .GT. 0))GOTO 23102
      IF (.NOT.(NXREF(I + 1) .LT. 0 .AND. NXREF(I + 1) .EQ. OXREF(NX + 1
     *)))GOTO 23104
      OXREF(NX + 1) = I + 1
      NXREF(I + 1) = NX + 1
23104 CONTINUE
23102 CONTINUE
23100 I = I + 1
      GOTO 23099
23101 CONTINUE
      I = NSIZE
23106 IF (.NOT.(I .GT. 1))GOTO 23108
      NX = NXREF(I)
      IF (.NOT.(NX .GT. 0))GOTO 23109
      IF (.NOT.(NXREF(I - 1) .LT. 0 .AND. NXREF(I - 1) .EQ. OXREF(NX - 1
     *)))GOTO 23111
      OXREF(NX - 1) = I - 1
      NXREF(I - 1) = NX - 1
23111 CONTINUE
23109 CONTINUE
23107 I = I - 1
      GOTO 23106
23108 CONTINUE
      RETURN
      END
      INTEGER FUNCTION HASH (LINE)
      LOGICAL*1 LINE (100)
      INTEGER I
      HASH = 0
      I = 1
23113 IF (.NOT.(LINE (I) .NE. 0))GOTO 23115
      HASH = HASH + LINE (I)
23114 I = I + 1
      GOTO 23113
23115 CONTINUE
      HASH = MOD (IABS (HASH), 1021) + 1
      RETURN
      END
      SUBROUTINE INIT
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER OPEN, CREATE
      INTEGER ARGNO, I, JUNK
      INTEGER EQUAL, GETARG, NOTE
      LOGICAL*1 ARG (40)
      LOGICAL*1 TF1(4)
      LOGICAL*1 TF2(4)
      LOGICAL*1 TF3(4)
      DATA TF1(1)/100/,TF1(2)/102/,TF1(3)/49/,TF1(4)/0/
      DATA TF2(1)/100/,TF2(2)/102/,TF2(3)/50/,TF2(4)/0/
      DATA TF3(1)/100/,TF3(2)/102/,TF3(3)/51/,TF3(4)/0/
      CALL QUERY (48Husage:  diff [-{c|d|r|s|v}] old_file [new_file].)
      OPTION = 1
      VERBOS = 0
      ARGNO = 1
      IF (.NOT.(GETARG (1, ARG, 40) .NE. -1))GOTO 23116
      IF (.NOT.(ARG (1) .EQ. 45))GOTO 23118
      CALL FOLD(ARG)
      I = 2
23120 IF (.NOT.(ARG (I) .NE. 0))GOTO 23122
      IF (.NOT.(ARG (I) .EQ. 99))GOTO 23123
      OPTION = 4
      GOTO 23124
23123 CONTINUE
      IF (.NOT.(ARG (I) .EQ. 100))GOTO 23125
      OPTION = 1
      GOTO 23126
23125 CONTINUE
      IF (.NOT.(ARG (I) .EQ. 114))GOTO 23127
      OPTION = 2
      GOTO 23128
23127 CONTINUE
      IF (.NOT.(ARG (I) .EQ. 115))GOTO 23129
      OPTION = 3
      GOTO 23130
23129 CONTINUE
      IF (.NOT.(ARG (I) .EQ. 118))GOTO 23131
      VERBOS = 1
      GOTO 23132
23131 CONTINUE
      CALL USAGE
23132 CONTINUE
23130 CONTINUE
23128 CONTINUE
23126 CONTINUE
23124 CONTINUE
23121 I = I + 1
      GOTO 23120
23122 CONTINUE
      ARGNO = 2
23118 CONTINUE
23116 CONTINUE
      IF (.NOT.(GETARG (ARGNO, ARG, 40) .EQ. -1))GOTO 23133
      CALL USAGE
      GOTO 23134
23133 CONTINUE
      OFILE = OPEN (ARG, 1)
      IF (.NOT.(OFILE .EQ. -3))GOTO 23135
      CALL CANT (ARG)
23135 CONTINUE
      ARGNO = ARGNO + 1
      IF (.NOT.(GETARG (ARGNO, ARG, 40) .EQ. -1))GOTO 23137
      NFILE = 1
      GOTO 23138
23137 CONTINUE
      NFILE = OPEN (ARG, 1)
      IF (.NOT.(NFILE .EQ. -3))GOTO 23139
      CALL CANT (ARG)
23139 CONTINUE
      ARGNO = ARGNO + 1
      CALL CLOSE(1)
23138 CONTINUE
23134 CONTINUE
      IF (.NOT.(GETARG (ARGNO, ARG, 40) .NE. -1))GOTO 23141
      CALL USAGE
23141 CONTINUE
      NINX = 1
      NSYM = 1
      CALL SCRATF(TF1, TFNAME)
      TFILE = CREATE (TFNAME, 3)
      IF (.NOT.(TFILE .EQ. -3))GOTO 23143
      CALL ERROR (26Hcan't open temporary file.)
23143 CONTINUE
      JUNK = NOTE(TFEND, TFILE)
      CALL SCRATF(TF2, OCNAME)
      OCOPY = CREATE (OCNAME, 3)
      IF (.NOT.(OCOPY .EQ. -3))GOTO 23145
      CALL ERROR (26Hcan't open temporary file.)
23145 CONTINUE
      JUNK = NOTE(OCSTRT, OCOPY)
      CALL SCRATF(TF3, NCNAME)
      NCOPY = CREATE (NCNAME, 3)
      IF (.NOT.(NCOPY .EQ. -3))GOTO 23147
      CALL ERROR (26Hcan't open temporary file.)
23147 CONTINUE
      JUNK = NOTE(NCSTRT, NCOPY)
      RETURN
      END
      SUBROUTINE LABEL
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER OI, NI, OX, NX
      OI = 2
      NI = 2
23149 CONTINUE
      OX = OXREF(OI)
      NX = NXREF(NI)
      IF (.NOT.(OI .GE. OSIZE .AND. NI .GE. NSIZE))GOTO 23152
      GOTO 23151
23152 CONTINUE
      IF (.NOT.(OI .LT. OSIZE .AND. OX .LT. 0))GOTO 23154
      OCOUNT(OI) = 1
      OI = OI + 1
      GOTO 23155
23154 CONTINUE
      IF (.NOT.(NI .LT. NSIZE .AND. NX .LT. 0))GOTO 23156
      NCOUNT(NI) = 1
      NI = NI + 1
      GOTO 23157
23156 CONTINUE
      IF (.NOT.(OX .EQ. NI .AND. NX .EQ. OI))GOTO 23158
      OCOUNT(OI) = 0
      OI = OI + 1
      NCOUNT(NI) = 0
      NI = NI + 1
      GOTO 23159
23158 CONTINUE
      IF (.NOT.(OI .LE. OSIZE .AND. NI .LE. NSIZE))GOTO 23160
      NCOUNT(NI) = 1
      NI = NI + 1
      OCOUNT(NX) = 1
      OCOUNT(OI) = 1
      OI = OI + 1
      NCOUNT(OX) = 1
      GOTO 23161
23160 CONTINUE
      CALL REMARK (16Hoi, ox, ni, nx:.)
      CALL PUTINT (OI, 10, 3)
      CALL PUTINT (OX, 10, 3)
      CALL PUTINT (NI, 10, 3)
      CALL PUTINT (NX, 10, 3)
      CALL PUTCH (10, 3)
      CALL ERROR (24Hin label:  can't happen.)
23161 CONTINUE
23159 CONTINUE
23157 CONTINUE
23155 CONTINUE
23153 CONTINUE
23150 GOTO 23149
23151 CONTINUE
      OCOUNT(1) = 2
      OCOUNT(OSIZE) = 2
      NCOUNT(1) = 2
      NCOUNT(NSIZE) = 2
      RETURN
      END
      SUBROUTINE LOAD
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER LNO, I
      INTEGER ENTER
      INTEGER H
      LOGICAL*1 LINE (512)
      INTEGER GETLIN, LENGTH
      DO 23162 H = 1, 1021
      BUCKET (H) = 0
23162 CONTINUE
23163 CONTINUE
      DO 23164 LNO = 1, 1000
      OCOUNT(LNO) = 0
      NCOUNT(LNO) = 0
23164 CONTINUE
23165 CONTINUE
      LNO = 2
23166 IF (.NOT.(GETLIN (LINE, OFILE) .NE. -1))GOTO 23168
      IF (.NOT.(LNO .GT. 1000))GOTO 23169
      CALL ERROR (29Hold file too large to handle.)
23169 CONTINUE
      CALL PUTLIN (LINE, OCOPY)
      I = ENTER (LINE)
      OCOUNT(I) = OCOUNT(I) + 1
      OLDLNO(I) = LNO
      OXREF(LNO) = -I
23167 LNO = LNO + 1
      GOTO 23166
23168 CONTINUE
      OSIZE = LNO
      LNO = 2
23171 IF (.NOT.(GETLIN (LINE, NFILE) .NE. -1))GOTO 23173
      IF (.NOT.(LNO .GT. 1000))GOTO 23174
      CALL ERROR (29Hnew file too large to handle.)
23174 CONTINUE
      CALL PUTLIN (LINE, NCOPY)
      I = ENTER (LINE)
      NCOUNT(I) = NCOUNT(I) + 1
      NXREF(LNO) = -I
23172 LNO = LNO + 1
      GOTO 23171
23173 CONTINUE
      NSIZE = LNO
      RETURN
      END
      SUBROUTINE PAIR
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      INTEGER I, J, K
      I = 2
23176 IF (.NOT.(I .LT. NSIZE))GOTO 23178
      J = -NXREF(I)
      IF (.NOT.(OCOUNT(J) .EQ. 1 .AND. NCOUNT(J) .EQ. 1))GOTO 23179
      NXREF(I) = OLDLNO(J)
      K = OLDLNO(J)
      OXREF(K) = I
23179 CONTINUE
23177 I = I + 1
      GOTO 23176
23178 CONTINUE
      NXREF(1) = 1
      OXREF(1) = 1
      NXREF(NSIZE) = OSIZE
      OXREF(OSIZE) = NSIZE
      RETURN
      END
      SUBROUTINE REPORT
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      CALL SEEK (OCSTRT, OCOPY)
      CALL SEEK (NCSTRT, NCOPY)
      IF (.NOT.(OPTION .EQ. 1))GOTO 23181
      CALL GLIST
      GOTO 23182
23181 CONTINUE
      IF (.NOT.(OPTION .EQ. 2))GOTO 23183
      CALL GREVIS
      GOTO 23184
23183 CONTINUE
      IF (.NOT.(OPTION .EQ. 3))GOTO 23185
      CALL GSCRIP
      GOTO 23186
23185 CONTINUE
      CALL ERROR (25Hin report:  can't happen.)
23186 CONTINUE
23184 CONTINUE
23182 CONTINUE
      RETURN
      END
      SUBROUTINE SCOMPR
      INTEGER OCOUNT(1000), NCOUNT(1000), OXREF(1000), NXREF(1000), OLDL
     *NO(1000), BUCKET (1021), SSTORE(2000)
      INTEGER*4 TLOC(1000)
      COMMON /C1/ OCOUNT
      COMMON /C2/ NCOUNT
      COMMON /C3/ OXREF
      COMMON /C4/ NXREF
      COMMON /C5/ OLDLNO
      COMMON /C6/ BUCKET
      COMMON /C7/ SSTORE
      COMMON /C8/ TLOC
      INTEGER NSYM, NINX, NSIZE, OSIZE
      INTEGER OFILE, NFILE, TFILE, OCOPY, NCOPY
      INTEGER*4 OCSTRT, NCSTRT, TFEND
      INTEGER  OPTION, VERBOS
      LOGICAL*1 TFNAME(40), OCNAME(40), NCNAME(40)
      COMMON /DIFCOM/ NSYM, NINX, OFILE, NFILE, TFILE, OCSTRT, NCSTRT, T
     *FEND, NSIZE, OSIZE, OCOPY, NCOPY, OPTION, VERBOS, TFNAME, OCNAME, 
     *NCNAME
      LOGICAL*1 LINE1 (512), LINE2 (512)
      INTEGER LINENO, M1, M2
      INTEGER EQUAL, GETLIN
      LOGICAL*1 DIFRNT(10)
      LOGICAL*1 EOFOLD(16)
      LOGICAL*1 EOFNEW(16)
      DATA DIFRNT(1)/100/,DIFRNT(2)/105/,DIFRNT(3)/102/,DIFRNT(4)/102/,D
     *IFRNT(5)/101/,DIFRNT(6)/114/,DIFRNT(7)/101/,DIFRNT(8)/110/,DIFRNT(
     *9)/116/,DIFRNT(10)/0/
      DATA EOFOLD(1)/101/,EOFOLD(2)/111/,EOFOLD(3)/102/,EOFOLD(4)/32/,EO
     *FOLD(5)/111/,EOFOLD(6)/110/,EOFOLD(7)/32/,EOFOLD(8)/111/,EOFOLD(9)
     */108/,EOFOLD(10)/100/,EOFOLD(11)/32/,EOFOLD(12)/102/,EOFOLD(13)/10
     *5/,EOFOLD(14)/108/,EOFOLD(15)/101/,EOFOLD(16)/0/
      DATA EOFNEW(1)/101/,EOFNEW(2)/111/,EOFNEW(3)/102/,EOFNEW(4)/32/,EO
     *FNEW(5)/111/,EOFNEW(6)/110/,EOFNEW(7)/32/,EOFNEW(8)/110/,EOFNEW(9)
     */101/,EOFNEW(10)/119/,EOFNEW(11)/32/,EOFNEW(12)/102/,EOFNEW(13)/10
     *5/,EOFNEW(14)/108/,EOFNEW(15)/101/,EOFNEW(16)/0/
      LINENO = 0
23187 CONTINUE
      M1 = GETLIN (LINE1, OFILE)
      M2 = GETLIN (LINE2, NFILE)
      IF (.NOT.(M1 .EQ. -1 .OR. M2 .EQ. -1))GOTO 23190
      GOTO 23189
23190 CONTINUE
      LINENO = LINENO + 1
      IF (.NOT.(EQUAL (LINE1, LINE2) .EQ. 0))GOTO 23192
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23194
      CALL PUTCH (10, 2)
      CALL PUTINT (LINENO, 5, 2)
      CALL PUTCH (10, 2)
      CALL PUTLIN (LINE1, 2)
      CALL PUTLIN (LINE2, 2)
      GOTO 23195
23194 CONTINUE
      CALL PUTLIN (DIFRNT, 2)
      CALL PUTCH (10, 2)
      RETURN
23195 CONTINUE
23192 CONTINUE
23188 GOTO 23187
23189 CONTINUE
      IF (.NOT.(M1 .EQ. -1 .AND. M2 .NE. -1))GOTO 23196
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23198
      CALL PUTLIN (EOFOLD, 2)
      CALL PUTCH (10, 2)
      GOTO 23199
23198 CONTINUE
      CALL PUTLIN (DIFRNT, 2)
      CALL PUTCH (10, 2)
23199 CONTINUE
23196 CONTINUE
      IF (.NOT.(M1 .NE. -1 .AND. M2 .EQ. -1))GOTO 23200
      IF (.NOT.(VERBOS .EQ. 1))GOTO 23202
      CALL PUTLIN (EOFNEW, 2)
      CALL PUTCH (10, 2)
      GOTO 23203
23202 CONTINUE
      CALL PUTLIN (DIFRNT, 2)
      CALL PUTCH (10, 2)
23203 CONTINUE
23200 CONTINUE
      RETURN
      END
      SUBROUTINE USAGE
      CALL ERROR (48Husage:  diff [-{c|d|r|s|v}] old_file [new_file].)
      END
