home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / gcc / cc1plus / !gcc / files / cc / dhrystone next >
Encoding:
Text File  |  1996-10-27  |  21.8 KB  |  700 lines

  1. /****** A Version of the famous dhrystone benchmark ******* */
  2. /*
  3.  Sun Oct  1 10:40:53 1989  Doug Lea  (dl at g.oswego.edu)
  4.  Changes made to the standard version to run under C++:
  5.  
  6.  * include standard  prototypes for printf and exit
  7.  * include Int.h and Char.h
  8.  * convert all `int' and `char' to `Int' and `Char'
  9.     (except those needed for timing)
  10.  * predeclare all functions
  11.  * convert all function headers from old-C
  12.  * Change name of struct tms tms to Tms
  13.  * wrote mystrcpy and mystrcmp to handle Chars, not chars
  14.  * added coercion to bad-looking Proc3 call in Proc1
  15.  * initialized String1Loc in Proc0
  16.  * use `new' instead of malloc
  17.  
  18.  
  19. This program is marginally useful in looking at the effects of various
  20. C++ constructs when defining a heavily constructive class like
  21. Int and Char. The Int.h and Char.h files can be compiled several
  22. ways, as listed at the top of each
  23.  
  24. */
  25.  
  26. #include "Int.h"
  27. #include "Char.h"
  28.  
  29. /*
  30.  *    "DHRYSTONE" Benchmark Program
  31.  *
  32.  *    Version:    C/1, 12/01/84
  33.  *
  34.  *    Date:        PROGRAM updated 11/02/85, RESULTS updated 12/13/85
  35.  *
  36.  *    Author:        Reinhold P. Weicker,  CACM Vol 27, No 10, 10/84 pg. 1013
  37.  *            Translated from ADA by Rick Richardson
  38.  *            Every method to preserve ADA-likeness has been used,
  39.  *            at the expense of C-ness.
  40.  *
  41.  *    Compile:    cc -O dry.c -o drynr            : No registers
  42.  *            cc -O -DREG=register dry.c -o dryr    : Registers
  43.  *
  44.  *    Defines:    Defines are provided for old C compiler's
  45.  *            which don't have enums, and can't assign structures.
  46.  *            The time(2) function is library dependant; Most
  47.  *            return the time in seconds, but beware of some, like
  48.  *            Aztec C, which return other units.
  49.  *            The LOOPS define is initially set for 50000 loops.
  50.  *            If you have a machine with large integers and is
  51.  *            very fast, please change this number to 500000 to
  52.  *            get better accuracy.  Please select the way to
  53.  *            measure the execution time using the TIME define.
  54.  *            For single user machines, time(2) is adequate. For
  55.  *            multi-user machines where you cannot get single-user
  56.  *            access, use the times(2) function.  If you have
  57.  *            neither, use a stopwatch in the dead of night.
  58.  *            Use a "printf" at the point marked "start timer"
  59.  *            to begin your timings. DO NOT use the UNIX "time(1)"
  60.  *            command, as this will measure the total time to
  61.  *            run this program, which will (erroneously) include
  62.  *            the time to malloc(3) storage and to compute the
  63.  *            time it takes to do nothing.
  64.  *
  65.  *    Run:        drynr; dryr
  66.  *
  67.  *    Results:    If you get any new machine/OS results, please send to:
  68.  *
  69.  *                {ihnp4,vax135,..}!houxm!castor!pcrat!rer
  70.  *
  71.  *            and thanks to all that do.  Space prevents listing
  72.  *            the names of those who have provided some of these
  73.  *            results.
  74.  *
  75.  *    Note:        I order the list in increasing performance of the
  76.  *            "with registers" benchmark.  If the compiler doesn't
  77.  *            provide register variables, then the benchmark
  78.  *            is the same for both REG and NOREG.  I'm not going
  79.  *            to list a compiler in a better place because if it
  80.  *            had register variables it might do better. No
  81.  *            register variables is a big loss in my book.
  82.  *
  83.  *    PLEASE:        Send complete information about the machine type,
  84.  *            clock speed, OS and C manufacturer/version.  If
  85.  *            the machine is modified, tell me what was done.
  86.  *            On UNIX, execute uname -a and cc -V to get this info.
  87.  *
  88.  *    80x8x NOTE:    80x8x benchers: please try to do all memory models
  89.  *            for a particular compiler.
  90.  *
  91.  *--------------------------------RESULTS BEGIN--------------------------------
  92.  *
  93.  * MACHINE    MICROPROCESSOR    OPERATING    COMPILER    DHRYSTONES/SEC.
  94.  * TYPE                SYSTEM                NO REG    REGS
  95.  * --------------------------    ------------    -----------    ---------------
  96.  * Commodore 64    6510-1MHz    C64 ROM        C Power 2.8      36      36
  97.  * HP-110    8086-5.33Mhz    MSDOS 2.11    Lattice 2.14     284     284
  98.  * IBM PC/XT    8088-4.77Mhz    PC/IX        cc         257     287
  99.  * P-E 3205    ?        Xelos(SVR2)     cc         279     296
  100.  * Perq-II    2901 bitslice    Accent S5c     cc (CMU)     301     301
  101.  * IBM PC/XT    8088-4.77Mhz    COHERENT 2.3.43    MarkWilliams cc  296     317
  102.  * Cosmos    68000-8Mhz    UniSoft        cc         305     322
  103.  * IBM PC/XT    8088-4.77Mhz    Venix/86 2.0    cc         297     324
  104.  * DEC PRO 350  11/23           Venix/PRO SVR2  cc               299     325
  105.  * PC/XT        8088-4.77Mhz    Venix/86 SYS V  cc               339     377
  106.  * IBM PC    8088-4.77Mhz    MSDOS 2.0    b16cc 2.0     310     340
  107.  * Commodore Amiga        ?        Lattice 3.02     368     371
  108.  * IBM PC    8088-4.77Mhz    MSDOS 2.0    CI-C86 2.20M     390     390
  109.  * IBM PC/XT    8088-4.77Mhz    PCDOS 2.1    Wizard 2.1     367     403
  110.  * IBM PC/XT    8088-4.77Mhz    PCDOS 3.1    Lattice 2.15     403     403 @
  111.  * IBM PC    8088-4.77Mhz    PCDOS 3.1    Datalight 1.10     416     416
  112.  * IBM PC/XT    8088-4.77Mhz    PCDOS 2.1    Microsoft 3.0     390     427
  113.  * PDP-11/34    -        UNIX V7M    cc         387     438
  114.  * IBM PC    8088, 4.77mhz    PC-DOS 2.1    Aztec C v3.2d     423     454
  115.  * Tandy 1000    V20, 4.77mhz    MS-DOS 2.11    Aztec C v3.2d     423     458
  116.  * PDP-11/34    -        RSTS/E        decus c         438     495
  117.  * Onyx C8002    Z8000-4Mhz    IS/1 1.1 (V7)    cc         476     511
  118.  * Perkin-Elmer 3230        Xelos (SysV.2)    cc         507     565
  119.  * DEC PRO 380  11/73           Venix/PRO SVR2  cc               577     628
  120.  * FHL QT+    68000-10Mhz    Os9/68000    version 1.3     603     649 FH
  121.  * Apollo DN550    68010-?Mhz    AegisSR9/IX    cc 3.12         666     666
  122.  * HP-110    8086-5.33Mhz    MSDOS 2.11    Aztec-C         641     676
  123.  * ATT PC6300    8086-8Mhz    MSDOS 2.11    b16cc 2.0     632     684
  124.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    CI-C86 2.1     666     684
  125.  * Tandy 6000    68000-8Mhz    Xenix 3.0    cc         694     694
  126.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc         684     704 MM
  127.  * Macintosh    68000-7.8Mhz 2M    Mac Rom        Mac C 32 bit int 694     704
  128.  * Macintosh    68000-7.7Mhz    -        MegaMax C 2.0     661     709
  129.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc         704     714 LM
  130.  * Codata 3300    68000-8Mhz    UniPlus+ (v7)    cc         678     725
  131.  * Cadmus 9000    68010-10Mhz    UNIX        cc         714     735
  132.  * AT&T 6300    8086-8Mhz       Venix/86 SVR2   cc               668     743
  133.  * Cadmus 9790    68010-10Mhz 1MB    SVR0,Cadmus3.7    cc         720     747
  134.  * NEC PC9801F    8086-8Mhz    PCDOS 2.11    Lattice 2.15     768      -  @
  135.  * ATT PC6300    8086-8Mhz    MSDOS 2.11    CI-C86 2.20M     769     769
  136.  * Burroughs XE550 68010-10Mhz    Centix 2.10    cc         769     769 CT1
  137.  * EAGLE/TURBO  8086-8Mhz       Venix/86 SVR2   cc               696     779
  138.  * ALTOS 586    8086-10Mhz    Xenix 3.0b    cc          724     793
  139.  * DEC 11/73    J-11 micro    Ultrix-11 V3.0    System V     735     793
  140.  * ATT 3B2/300    WE32000-?Mhz    UNIX 5.0.2    cc         735     806
  141.  * Apollo DN320    68010-?Mhz    AegisSR9/IX    cc 3.12         806     806
  142.  * IRIS-2400    68010-10Mhz    UNIX System V    cc         772     829
  143.  * Atari 520ST  68000-8Mhz      TOS             DigResearch      839     846
  144.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    MS 3.0(large)     833     847 LM
  145.  * VAX 11/750    -        Ultrix 1.1    4.2BSD cc     781     862
  146.  * P-E  7350A    68000-8MHz    UniSoft V.2    cc         821     875
  147.  * VAX 11/750    -        UNIX 4.2bsd    cc         862     877
  148.  * Fast Mac    68000-7.7Mhz    -        MegaMax C 2.0     839     904 +
  149.  * IBM PC/XT    8086-9.54Mhz    PCDOS 3.1    Microsoft 3.0     833     909 C1
  150.  * DEC 11/44            Ultrix-11 V3.0    System V     862     909
  151.  * Macintosh    68000-7.8Mhz 2M    Mac Rom        Mac C 16 bit int 877     909 S
  152.  * P-E 3210    ?        Xelos R01(SVR2)    cc         849     924
  153.  * P-E 3220    ?               Ed. 7 v2.3      cc         892     925
  154.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc -i         909     925
  155.  * AT&T 6300    8086, 8mhz    MS-DOS 2.11    Aztec C v3.2d     862     943
  156.  * IBM PC/AT    80286-6Mhz    Xenix 3.0    cc         892     961
  157.  * VAX 11/750    w/FPA        Eunice 3.2    cc         914     976
  158.  * IBM PC/XT    8086-9.54Mhz    PCDOS 3.1    Wizard 2.1     892     980 C1
  159.  * IBM PC/XT    8086-9.54Mhz    PCDOS 3.1    Lattice 2.15     980     980 C1
  160.  * Plexus P35    68000-10Mhz    UNIX System III cc         984     980
  161.  * PDP-11/73    KDJ11-AA 15Mhz    UNIX V7M 2.1    cc         862     981
  162.  * VAX 11/750    w/FPA        UNIX 4.3bsd    cc         994     997
  163.  * IRIS-1400    68010-10Mhz    UNIX System V    cc         909    1000
  164.  * IBM PC/AT    80286-6Mhz    Venix/86 2.1    cc         961    1000
  165.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    b16cc 2.0     943    1063
  166.  * Zilog S8000/11 Z8001-5.5Mhz    Zeus 3.2    cc        1011    1084
  167.  * NSC ICM-3216 NSC 32016-10Mhz    UNIX SVR2    cc        1041    1084
  168.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    MS 3.0(small)    1063    1086
  169.  * VAX 11/750    w/FPA        VMS        VAX-11 C 2.0     958    1091
  170.  * Stride    68000-10Mhz    System-V/68    cc        1041    1111
  171.  * ATT PC7300    68010-10Mhz    UNIX 5.2    cc        1041    1111
  172.  * P-E 3230    ?        Xelos R01(SVR2)    cc        1040    1126
  173.  * Stride    68000-12Mhz    System-V/68    cc        1063    1136
  174.  * IBM PC/AT    80286-6Mhz      Venix/286 SVR2  cc              1056    1149
  175.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    Datalight 1.10    1190    1190
  176.  * ATT PC6300+    80286-6Mhz    MSDOS 3.1    b16cc 2.0    1111    1219
  177.  * IBM PC/AT    80286-6Mhz    PCDOS 3.1    Wizard 2.1    1136    1219
  178.  * Sun2/120    68010-10Mhz    Sun 4.2BSD    cc        1136    1219
  179.  * IBM PC/AT    80286-6Mhz    PCDOS 3.0    CI-C86 2.20M    1219    1219
  180.  * MASSCOMP 500    68010-10MHz    RTU V3.0    cc (V3.2)    1156    1238
  181.  * Cyb DataMate    68010-12.5Mhz    Uniplus 5.0    Unisoft cc    1162    1250
  182.  * PDP 11/70    -        UNIX 5.2    cc        1162    1250
  183.  * IBM PC/AT    80286-6Mhz    PCDOS 3.1    Lattice 2.15    1250    1250
  184.  * IBM PC/AT    80286-7.5Mhz    Venix/86 2.1    cc        1190    1315 *15
  185.  * Sun2/120    68010-10Mhz    Standalone    cc        1219    1315
  186.  * Intel 380    80286-8Mhz    Xenix R3.0up1    cc        1250    1315 *16
  187.  * ATT 3B2/400    WE32100-?Mhz    UNIX 5.2    cc        1315    1315
  188.  * P-E 3250XP    -        Xelos R01(SVR2)    cc        1215    1318
  189.  * DG MV4000    -        AOS/VS 5.00    cc        1333    1333
  190.  * IBM PC/AT    80286-8Mhz    Venix/86 2.1    cc        1275    1380 *16
  191.  * IBM PC/AT    80286-6Mhz    MSDOS 3.0    Microsoft 3.0    1250    1388
  192.  * ATT PC6300+    80286-6Mhz    MSDOS 3.1    CI-C86 2.20M    1428    1428
  193.  * COMPAQ/286   80286-8Mhz      Venix/286 SVR2  cc              1326    1443
  194.  * IBM PC/AT    80286-7.5Mhz    Venix/286 SVR2  cc              1333    1449 *15
  195.  * Cyb DataMate    68010-12.5Mhz    Uniplus 5.0    Unisoft cc    1470    1562 S
  196.  * VAX 11/780    -        UNIX 5.2    cc        1515    1562
  197.  * MicroVAX-II    -        -        -        1562    1612
  198.  * VAX 11/780    -        UNIX 4.3bsd    cc        1646    1662
  199.  * Apollo DN660    -        AegisSR9/IX    cc 3.12        1666    1666
  200.  * ATT 3B20    -        UNIX 5.2    cc        1515    1724
  201.  * NEC PC-98XA    80286-8Mhz    PCDOS 3.1    Lattice 2.15    1724    1724 @
  202.  * HP9000-500    B series CPU    HP-UX 4.02    cc        1724    -
  203.  * IBM PC/STD    80286-8Mhz    MSDOS 3.0     Microsoft 3.0    1724    1785 C2
  204.  * DEC-2065    KL10-Model B    TOPS-20 6.1FT5    Port. C Comp.    1937    1946
  205.  * Gould PN6005    -        UTX 1.1(4.2BSD)    cc        1675    1964
  206.  * DEC2060    KL-10        TOPS-20        cc        2000    2000 &
  207.  * VAX 11/785    -        UNIX 5.2    cc        2083    2083
  208.  * VAX 11/785    -        VMS        VAX-11 C 2.0    2083    2083
  209.  * VAX 11/785    -        UNIX SVR2    cc        2123    2083
  210.  * VAX 11/785    -        UNIX 4.3bsd    cc        2135    2136
  211.  * Pyramid 90x    -        OSx 2.3        cc        2272    2272
  212.  * Pyramid 90x    FPA,cache,4Mb    OSx 2.5        cc no -O    2777    2777
  213.  * Alliant FX-8 CE        ?        ?        2622    2901 FX
  214.  * Pyramid 90x    w/cache        OSx 2.5        cc w/-O        3333    3333
  215.  * IBM-4341-II    -        VM/SP3        Waterloo C 1.2  3333    3333
  216.  * IRIS-2400T    68020-16.67Mhz    UNIX System V    cc        3105    3401
  217.  * SUN 3/75    68020-16.67Mhz    SUN 4.2 V3    cc        3333    3571
  218.  * IBM-4341    Model 12    UTS 5.0        ?        3685    3685
  219.  * SUN-3/160    68020-16.67Mhz  Sun 4.2 V3.0A   cc        3381    3764
  220.  * Sun 3/180    68020-16.67Mhz    Sun 4.2        cc        3333    3846
  221.  * IBM-4341    Model 12    UTS 5.0        ?        3910    3910 MN
  222.  * MC 5400    68020-16.67MHz    RTU V3.0    cc (V4.0)    3952    4054
  223.  * NCR Tower32  68020-16.67Mhz  SYS 5.0 Rel 2.0 cc              3846    4545
  224.  * Gould PN9080    -        UTX-32 1.1c    cc        -    4629
  225.  * MC 5600/5700    68020-16.67MHz    RTU V3.0    cc (V4.0)    4504    4746 %
  226.  * Gould 1460-342 ECL proc      UTX/32 1.1/c    cc              5342    5677 G1
  227.  * VAX 8600    -        UNIX 4.3bsd    cc        7024    7088
  228.  * VAX 8600    -        VMS        VAX-11 C 2.0    7142    7142
  229.  * CCI POWER 6/32        COS(SV+4.2)    cc        7500    7800
  230.  * CCI POWER 6/32        POWER 6 UNIX/V    cc        8236    8498
  231.  * CCI POWER 6/32        4.2 Rel. 1.2b    cc        8963    9544
  232.  * Sperry (CCI Power 6)        4.2BSD        cc        9345   10000
  233.  * CRAY-X-MP/12       105Mhz    COS 1.14    Cray C         10204   10204
  234.  * IBM-3083    -        UTS 5.0 Rel 1    cc           16666   12500
  235.  * CRAY-1A        80Mhz    CTSS        Cray C 2.0     12100   13888
  236.  * IBM-3083    -        VM/CMS HPO 3.4    Waterloo C 1.2 13889   13889
  237.  * Amdahl 470 V/8         UTS/V 5.2       cc v1.23       15560   15560
  238.  * CRAY-X-MP/48       105Mhz    CTSS        Cray C 2.0     15625   17857
  239.  * Amdahl 580    -        UTS 5.0 Rel 1.2    cc v1.5        23076   23076
  240.  * Amdahl 5860             UTS/V 5.2       cc v1.23       28970   28970
  241.  *
  242.  *   *   Crystal changed from 'stock' to listed value.
  243.  *   +   This Macintosh was upgraded from 128K to 512K in such a way that
  244.  *       the new 384K of memory is not slowed down by video generator accesses.
  245.  *   %   Single processor; MC == MASSCOMP
  246.  *   &   A version 7 C compiler written at New Mexico Tech.
  247.  *   @   vanilla Lattice compiler used with MicroPro standard library
  248.  *   S   Shorts used instead of ints
  249.  *   LM  Large Memory Model. (Otherwise, all 80x8x results are small model)
  250.  *   MM  Medium Memory Model. (Otherwise, all 80x8x results are small model)
  251.  *   C1  Univation PC TURBO Co-processor; 9.54Mhz 8086, 640K RAM
  252.  *   C2  Seattle Telecom STD-286 board
  253.  *   C?  Unknown co-processor board?
  254.  *   CT1 Convergent Technologies MegaFrame, 1 processor.
  255.  *   MN  Using Mike Newtons 'optimizer' (see net.sources).
  256.  *   G1  This Gould machine has 2 processors and was able to run 2 dhrystone
  257.  *       Benchmarks in parallel with no slowdown.
  258.  *   FH  FHC == Frank Hogg Labs (Hazelwood Uniquad 2 in an FHL box).
  259.  *   FX  The FX-8 has two kinds of processors.  This figure is for CE's
  260.  *     (computation engines).  The other processor type is an IP (interactive
  261.  *     processor) which is a 68010-12Mhz. Figures were not precisely
  262.  *     determined for the IP.
  263.  *   ?   I don't trust results marked with '?'.  These were sent to me with
  264.  *       either incomplete info, or with times that just don't make sense.
  265.  *     ?? means I think the performance is too poor, ?! means too good.
  266.  *       If anybody can confirm these figures, please respond.
  267.  *
  268.  *--------------------------------RESULTS END----------------------------------
  269.  *
  270.  *    The following program contains statements of a high-level programming
  271.  *    language (C) in a distribution considered representative:
  272.  *
  273.  *    assignments            53%
  274.  *    control statements        32%
  275.  *    procedure, function calls    15%
  276.  *
  277.  *    100 statements are dynamically executed.  The program is balanced with
  278.  *    respect to the three aspects:
  279.  *        - statement type
  280.  *        - operand type (for simple data types)
  281.  *        - operand access
  282.  *            operand global, local, parameter, or constant.
  283.  *
  284.  *    The combination of these three aspects is balanced only approximately.
  285.  *
  286.  *    The program does not compute anything meaningfull, but it is
  287.  *    syntactically and semantically correct.
  288.  *
  289.  */
  290.  
  291. /* Accuracy of timings and human fatigue controlled by next two lines */
  292. #ifdef QUICK
  293. #define LOOPS    50000        /* Use this for slow or 16 bit machines */
  294. #else
  295. #define LOOPS    500000        /* Use this for faster machines */
  296. #endif
  297.  
  298. /* Compiler dependent options */
  299. #undef    NOENUM            /* Define if compiler has no enum's */
  300. #undef    NOSTRUCTASSIGN        /* Define if compiler can't assign structures */
  301. /* cfront 3.0 can't handle the assignments */
  302. #ifndef __GNUG__
  303. #define    NOSTRUCTASSIGN
  304. #endif
  305.  
  306.  
  307. /* define only one of the next two defines */
  308.  
  309. #define TIME            /* Use time(2) time function */
  310.  
  311. #ifdef TIMES
  312. #include <sys/types.h>
  313. #include <sys/times.h>
  314. #endif
  315. #ifdef TIME
  316. #include <time.h>
  317. #endif
  318.  
  319. /* define the granularity of your times(2) function (when used) */
  320. #define HZ 50
  321.  
  322. #ifndef HZ
  323. #if 1
  324. #define HZ    60        /* times(2) returns 1/60 second (most) */
  325. #else
  326. #define HZ    100        /* times(2) returns 1/100 second (WECo) */
  327. #endif
  328. #endif
  329.  
  330.  
  331. #ifdef    NOSTRUCTASSIGN
  332. #include <string.h>
  333. #define    structassign(d, s)    memcpy(&(d), &(s), sizeof(d))
  334. #else
  335. #define    structassign(d, s)    d = s
  336. #endif
  337.  
  338. #ifdef    NOENUM
  339. #define    Ident1    1
  340. #define    Ident2    2
  341. #define    Ident3    3
  342. #define    Ident4    4
  343. #define    Ident5    5
  344. typedef int    Enumeration;
  345. #else
  346. typedef enum    {Ident1, Ident2, Ident3, Ident4, Ident5} Enumeration;
  347. #endif
  348.  
  349.  
  350.  
  351. typedef Int    OneToThirty;
  352. typedef Int    OneToFifty;
  353. typedef Char    CapitalLetter;
  354. typedef Char    String30[31];
  355. typedef Int    Array1Dim[51];
  356. typedef Int    Array2Dim[51][51];
  357.  
  358. struct    Record
  359. {
  360.     struct Record        *PtrComp;
  361.     Enumeration        Discr;
  362.     Enumeration        EnumComp;
  363.     OneToFifty        IntComp;
  364.     String30        StringComp;
  365. };
  366.  
  367. typedef struct Record     RecordType;
  368. typedef RecordType *    RecordPtr;
  369. typedef int        dhry_boolean;
  370.  
  371. #define    TRUE        1
  372. #define    FALSE        0
  373.  
  374. #ifndef REG
  375. #define    REG
  376. #endif
  377.  
  378.  
  379. /* added: - dl */
  380.  
  381. extern "C" {
  382. extern int printf(const char* ...);
  383. extern void exit(int);
  384. }
  385.  
  386. void Proc0();
  387. void Proc1(RecordPtr PtrParIn);
  388. void Proc2(OneToFifty    *IntParIO);
  389. void Proc3(RecordPtr    *PtrParOut);
  390. void Proc4();
  391. void Proc5();
  392. dhry_boolean Func3(Enumeration    EnumParIn);
  393. void Proc6(REG Enumeration    EnumParIn, REG Enumeration    *EnumParOut);
  394. void Proc7(OneToFifty IntParI1, OneToFifty IntParI2, OneToFifty *IntParOut);
  395. void Proc8(Array1Dim    Array1Par,
  396.       Array2Dim    Array2Par,
  397.       OneToFifty IntParI1,
  398.       OneToFifty IntParI2);
  399. Enumeration Func1(CapitalLetter    CharPar1, CapitalLetter    CharPar2);
  400. dhry_boolean Func2(String30    StrParI1, String30    StrParI2);
  401. dhry_boolean Func3(Enumeration    EnumParIn);
  402.  
  403. void mystrcpy(String30 s, char* t)
  404. {
  405.   for (; *t != '\0'; ++s, ++t) *s = *t;
  406.   *s = '\0';
  407. }
  408.  
  409. char mystrcmp(String30 s, String30 t)
  410. {
  411.   for (; *s == *t; ++s, ++t) if (*s == '\0') return 0;
  412.   return char(*s - *t);
  413. }
  414.  
  415. /*end - dl */
  416.  
  417. main()
  418. {
  419.     Proc0();
  420.     exit(0);
  421. }
  422.  
  423. /*
  424.  * Package 1
  425.  */
  426. Int        IntGlob;
  427. dhry_boolean        BoolGlob;
  428. char        Char1Glob;
  429. char        Char2Glob;
  430. Array1Dim    Array1Glob;
  431. Array2Dim    Array2Glob;
  432. RecordPtr    PtrGlb;
  433. RecordPtr    PtrGlbNext;
  434.  
  435. void Proc0()
  436. {
  437.     OneToFifty        IntLoc1;
  438.     REG OneToFifty        IntLoc2;
  439.     OneToFifty        IntLoc3;
  440.     REG char        CharLoc;
  441.     REG char        CharIndex;
  442.     Enumeration         EnumLoc;
  443.     String30        String1Loc;
  444.     String30        String2Loc;
  445.  
  446. #ifdef TIME
  447.     long            starttime;
  448.     long            benchtime;
  449.     long            nulltime;
  450.     register unsigned int    i;
  451.  
  452.     starttime = time( (time_t *) 0);
  453.     for (i = 0; i < LOOPS; ++i);
  454.     nulltime = time( (time_t*) 0) - starttime; /* Computes o'head of loop */
  455. #endif
  456. #ifdef TIMES
  457.     time_t            starttime;
  458.     time_t            benchtime;
  459.     time_t            nulltime;
  460.     struct tms        Tms;
  461.     register unsigned int    i;
  462.  
  463.     times(&Tms); starttime = Tms.tms_utime;
  464.     for (i = 0; i < LOOPS; ++i);
  465.     times(&Tms);
  466.     nulltime = Tms.tms_utime - starttime; /* Computes overhead of looping */
  467. #endif
  468.  
  469.     PtrGlbNext = new Record;
  470.     PtrGlb = new Record;
  471.     PtrGlb->PtrComp = PtrGlbNext;
  472.     PtrGlb->Discr = Ident1;
  473.     PtrGlb->EnumComp = Ident3;
  474.     PtrGlb->IntComp = 40;
  475.     mystrcpy(PtrGlb->StringComp, "DHRYSTONE PROGRAM, SOME STRING");
  476.     mystrcpy(String1Loc, "JUST INITIALIZED TO SOME JUNK.");
  477.  
  478. /*****************
  479. -- Start Timer --
  480. *****************/
  481. #ifdef TIME
  482.     starttime = time( (time_t*) 0);
  483. #endif
  484. #ifdef TIMES
  485.     times(&Tms); starttime = Tms.tms_utime;
  486. #endif
  487.     for (i = 0; i < LOOPS; ++i)
  488.     {
  489.  
  490.         Proc5();
  491.         Proc4();
  492.         IntLoc1 = 2;
  493.         IntLoc2 = 3;
  494.         mystrcpy(String2Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
  495.         EnumLoc = Ident2;
  496.         BoolGlob = ! Func2(String1Loc, String2Loc);
  497.         while (IntLoc1 < IntLoc2)
  498.         {
  499.             IntLoc3 = 5 * IntLoc1 - IntLoc2;
  500.             Proc7(IntLoc1, IntLoc2, &IntLoc3);
  501.             ++IntLoc1;
  502.         }
  503.         Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3);
  504.         Proc1(PtrGlb);
  505.         for (CharIndex = 'A'; CharIndex <= Char2Glob; ++CharIndex)
  506.             if (EnumLoc == Func1(CharIndex, 'C'))
  507.                 Proc6(Ident1, &EnumLoc);
  508.         IntLoc3 = IntLoc2 * IntLoc1;
  509.         IntLoc2 = IntLoc3 / IntLoc1;
  510.         IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1;
  511.         Proc2(&IntLoc1);
  512.     }
  513.  
  514. /*****************
  515. -- Stop Timer --
  516. *****************/
  517.  
  518. #ifdef TIME
  519.     benchtime = time( (time_t *) 0) - starttime - nulltime;
  520.     printf("Dhrystone time for %ld passes = %ld\n",
  521.         (long) LOOPS, benchtime);
  522.     if (benchtime)
  523.       printf("This machine benchmarks at %ld dhrystones/second\n",
  524.          ((long) LOOPS) / benchtime);
  525. #endif
  526. #ifdef TIMES
  527.     times(&Tms);
  528.     benchtime = Tms.tms_utime - starttime - nulltime;
  529.     printf("Dhrystone time for %ld passes = %ld\n",
  530.         (long) LOOPS, benchtime/HZ);
  531.     if (benchtime)
  532.       printf("This machine benchmarks at %ld dhrystones/second\n",
  533.          ((long) LOOPS) * HZ / benchtime);
  534. #endif
  535.  
  536. }
  537.  
  538. void Proc1(RecordPtr PtrParIn)
  539. {
  540. #define    NextRecord    (*(PtrParIn->PtrComp))
  541.  
  542.     structassign(NextRecord, *PtrGlb);
  543.     PtrParIn->IntComp = 5;
  544.     NextRecord.IntComp = PtrParIn->IntComp;
  545.     NextRecord.PtrComp = PtrParIn->PtrComp;
  546. /* - added coercion (glossing over error in original code) - dl */
  547.     Proc3(&(NextRecord.PtrComp));
  548.     if (NextRecord.Discr == Ident1)
  549.     {
  550.         NextRecord.IntComp = 6;
  551.         Proc6(PtrParIn->EnumComp, &NextRecord.EnumComp);
  552.         NextRecord.PtrComp = PtrGlb->PtrComp;
  553.         Proc7(NextRecord.IntComp, 10, &NextRecord.IntComp);
  554.     }
  555.     else
  556.         structassign(*PtrParIn, NextRecord);
  557.  
  558. #undef    NextRecord
  559. }
  560.  
  561. void Proc2(OneToFifty    *IntParIO)
  562. {
  563.     REG OneToFifty        IntLoc;
  564.     REG Enumeration        EnumLoc;
  565.  
  566.     IntLoc = *IntParIO + 10;
  567.     for(;;)
  568.     {
  569.         if (Char1Glob == 'A')
  570.         {
  571.             --IntLoc;
  572.             *IntParIO = IntLoc - IntGlob;
  573.             EnumLoc = Ident1;
  574.         }
  575.         if (EnumLoc == Ident1)
  576.             break;
  577.     }
  578. }
  579.  
  580. void Proc3(RecordPtr    *PtrParOut)
  581. {
  582.     if (PtrGlb)
  583.         *PtrParOut = PtrGlb->PtrComp;
  584.     else
  585.         IntGlob = 100;
  586.     Proc7(10, IntGlob, &PtrGlb->IntComp);
  587. }
  588.  
  589. void Proc4()
  590. {
  591.     REG dhry_boolean    BoolLoc;
  592.  
  593.     BoolLoc = Char1Glob == 'A';
  594.     BoolLoc |= BoolGlob;
  595.     Char2Glob = 'B';
  596. }
  597.  
  598. void Proc5()
  599. {
  600.     Char1Glob = 'A';
  601.     BoolGlob = FALSE;
  602. }
  603.  
  604.  
  605.  
  606.  
  607. void Proc6(REG Enumeration    EnumParIn, REG Enumeration    *EnumParOut)
  608. {
  609.     *EnumParOut = EnumParIn;
  610.     if (! Func3(EnumParIn) )
  611.         *EnumParOut = Ident4;
  612.     switch (EnumParIn)
  613.     {
  614.     case Ident1:    *EnumParOut = Ident1; break;
  615.     case Ident2:    if (IntGlob > 100) *EnumParOut = Ident1;
  616.             else *EnumParOut = Ident4;
  617.             break;
  618.     case Ident3:    *EnumParOut = Ident2; break;
  619.     case Ident4:    break;
  620.     case Ident5:    *EnumParOut = Ident3;
  621.     }
  622. }
  623.  
  624. void Proc7(OneToFifty IntParI1, OneToFifty IntParI2, OneToFifty *IntParOut)
  625. {
  626.     REG OneToFifty    IntLoc;
  627.  
  628.     IntLoc = IntParI1 + 2;
  629.     *IntParOut = IntParI2 + IntLoc;
  630. }
  631.  
  632. void Proc8(Array1Dim    Array1Par,
  633.       Array2Dim    Array2Par,
  634.       OneToFifty IntParI1,
  635.       OneToFifty IntParI2)
  636. {
  637.     REG OneToFifty    IntLoc;
  638.     REG OneToFifty    IntIndex;
  639.  
  640.     IntLoc = IntParI1 + 5;
  641.     Array1Par[IntLoc] = IntParI2;
  642.     Array1Par[IntLoc+1] = Array1Par[IntLoc];
  643.     Array1Par[IntLoc+30] = IntLoc;
  644.     for (IntIndex = IntLoc; IntIndex <= (IntLoc+1); ++IntIndex)
  645.         Array2Par[IntLoc][IntIndex] = IntLoc;
  646.     ++Array2Par[IntLoc][IntLoc-1];
  647.     Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc];
  648.     IntGlob = 5;
  649. }
  650.  
  651. Enumeration Func1(CapitalLetter    CharPar1, CapitalLetter    CharPar2)
  652. {
  653.     REG CapitalLetter    CharLoc1;
  654.     REG CapitalLetter    CharLoc2;
  655.  
  656.     CharLoc1 = CharPar1;
  657.     CharLoc2 = CharLoc1;
  658.     if (CharLoc2 != CharPar2)
  659.         return (Ident1);
  660.     else
  661.         return (Ident2);
  662. }
  663.  
  664. dhry_boolean Func2(String30    StrParI1, String30    StrParI2)
  665. {
  666.     REG OneToThirty        IntLoc;
  667.     REG CapitalLetter    CharLoc;
  668.  
  669.     IntLoc = 1;
  670.     while (IntLoc <= 1)
  671.         if (Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1)
  672.         {
  673.             CharLoc = 'A';
  674.             ++IntLoc;
  675.         }
  676.     if (CharLoc >= 'W' && CharLoc <= 'Z')
  677.         IntLoc = 7;
  678.     if (CharLoc == 'X')
  679.         return(TRUE);
  680.     else
  681.     {
  682.         if (mystrcmp(StrParI1, StrParI2) > 0)
  683.         {
  684.             IntLoc += 7;
  685.             return (TRUE);
  686.         }
  687.         else
  688.             return (FALSE);
  689.     }
  690. }
  691.  
  692. dhry_boolean Func3(Enumeration    EnumParIn)
  693. {
  694.     REG Enumeration    EnumLoc;
  695.  
  696.     EnumLoc = EnumParIn;
  697.     if (EnumLoc == Ident3) return (TRUE);
  698.     return (FALSE);
  699. }
  700.