#include <perms.h>

//          Edinburgh IMP77 Compiler - Version 8.4
//
//     1  %external %record (*) %name Null == 0

struct VARIANT *NULL = 0;

//     2
//     3  %external %routine %spec Proc 6 (%integer {Enumeration} Enum Val Par, %integer {Enumeration} %name Enum Ref Par)

extern void PROC6(int ENUMVALPAR, int *ENUMREFPAR);

//     4  %external %routine %spec Proc 7 (%integer {One Fifty} Int 1 Par Val,

extern void PROC7(int INT1PARVAL, int INT2PARVAL, int *INTPARREF);

//     5+                                  %integer {One Fifty} Int 2 Par Val,
//     6+                                  %integer {One Fifty} %name Int Par Ref)
//     7  %external %routine %spec Proc 8 (%integer %array %name Arr 1 Par Ref {(0:49)},

extern void PROC8(int *ARR1PARREF, int *ARR2PARREF, int INT1PARVAL, int INT2PARVAL);

//     8+                                  %integer %array %name Arr 2 Par Ref {(0:50*50-1)} {(0:49, 0:49)},
//     9+                                  %integer Int 1 Par Val,
//    10+                                  %integer Int 2 Par Val)
//    11  %external %integer {Enumeration} %fn %spec Func 1 (%integer {Capital Letter} Ch 1 Par Val,

extern int FUNC1(int CH1PARVAL, int CH2PARVAL);

//    12+                                                    %integer {Capital Letter} Ch 2 Par Val)
//    13  %external %predicate %spec Func 2 (%string (30) %name Str 1 Par Ref, %string (30) %name Str 2 Par Ref)

extern int FUNC2(_imp_string30 *STR1PARREF, _imp_string30 *STR2PARREF);

//    14  %external %predicate %spec Func 3 (%integer {Enumeration} Enum Par Val)

extern int FUNC3(int ENUMPARVAL);

//    15
//    16  ! ****************************************************************************
//    17  ! *
//    18  ! *                   "DHRYSTONE" Benchmark Program
//    19  ! *                   -----------------------------
//    20  ! *
//    21  ! *  Version:    Imp, Version 2.1
//    22  ! *
//    23  ! *  File:       dhry_1.c (part 2 of 3)
//    24  ! *
//    25  ! *  Date:       May 25, 1988 & Mar 30, 2026
//    26  ! *
//    27  ! *  Author:     Reinhold P. Weicker, translated from C to Imp by Graham Toal
//    28  ! *
//    29  ! ****************************************************************************
//    30
//    31  %include "dhry.inc"
//  &1     ! This translation to Imp derived from https://github.com/sifive/benchmark-dhrystone/
//  &2
//  &3     !  ***************************************************************************
//  &4     !
//  &5     !                     "DHRYSTONE" Benchmark Program
//  &6     !                     -----------------------------
//  &7     !
//  &8     !    Version:    C, Version 2.1
//  &9     !
//  &10    !    File:       dhry.h (part 1 of 3)
//  &11    !
//  &12    !    Date:       May 25, 1988
//  &13    !
//  &14    !    Author:     Reinhold P. Weicker
//  &15    !                        Siemens AG, E STE 35
//  &16    !                        Postfach 3240
//  &17    !                        8520 Erlangen
//  &18    !                        Germany (West)
//  &19    !                                Phone:  [xxx-49]-9131-7-20330
//  &20    !                                        (8-17 Central European Time)
//  &21    !                                Usenet: ..!mcvax!unido!estevax!weicker
//  &22    !
//  &23    !                Original Version (in Ada) published in
//  &24    !                "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
//  &25    !                pp. 1013 - 1030, together with the statistics
//  &26    !                on which the distribution of statements etc. is based.
//  &27    !
//  &28    !                In this C version, the following C library functions are used:
//  &29    !                - strcpy, strcmp (inside the measurement loop)
//  &30    !                - printf, scanf (outside the measurement loop)
//  &31    !                In addition, Berkeley UNIX system calls "times ()" or "time ()"
//  &32    !                are used for execution time measurement. For measurements
//  &33    !                on other systems, these calls have to be changed.
//  &34    !
//  &35    !    Collection of Results:
//  &36    !                Reinhold Weicker (address see above) and
//  &37    !
//  &38    !                Rick Richardson
//  &39    !                PC Research. Inc.
//  &40    !                94 Apple Orchard Drive
//  &41    !                Tinton Falls, NJ 07724
//  &42    !                        Phone:  (201) 389-8963 (9-17 EST)
//  &43    !                        Usenet: ...!uunet!pcrat!rick
//  &44    !
//  &45    !        Please send results to Rick Richardson and/or Reinhold Weicker.
//  &46    !        Complete information should be given on hardware and software used.
//  &47    !        Hardware information includes: Machine type, CPU, type and size
//  &48    !        of caches; for microprocessors: clock frequency, memory speed
//  &49    !        (number of wait states).
//  &50    !        Software information includes: Compiler (and runtime library)
//  &51    !        manufacturer and version, compilation switches, OS version.
//  &52    !        The Operating System version may give an indication about the
//  &53    !        compiler; Dhrystone itself performs no OS calls in the measurement loop.
//  &54    !
//  &55    !        The complete output generated by the program should be mailed
//  &56    !        such that at least some checks for correctness can be made.
//  &57    !
//  &58    !  **************************************************************************
//  &59    !
//  &60    !    History:    This version C/2.1 has been made for two reasons:
//  &61    !
//  &62    !                1) There is an obvious need for a common C version of
//  &63    !                Dhrystone, since C is at present the most popular system
//  &64    !                programming language for the class of processors
//  &65    !                (microcomputers, minicomputers) where Dhrystone is used most.
//  &66    !                There should be, as far as possible, only one C version of
//  &67    !                Dhrystone such that results can be compared without
//  &68    !                restrictions. In the past, the C versions distributed
//  &69    !                by Rick Richardson (Version 1.1) and by Reinhold Weicker
//  &70    !                had small (though not significant) differences.
//  &71    !
//  &72    !                2) As far as it is possible without changes to the Dhrystone
//  &73    !                statistics, optimizing compilers should be prevented from
//  &74    !                removing significant statements.
//  &75    !
//  &76    !                This C version has been developed in cooperation with
//  &77    !                Rick Richardson (Tinton Falls, NJ), it incorporates many
//  &78    !                ideas from the "Version 1.1" distributed previously by
//  &79    !                him over the UNIX network Usenet.
//  &80    !                I also thank Chaim Benedelac (National Semiconductor),
//  &81    !                David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
//  &82    !                Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
//  &83    !                for their help with comments on earlier versions of the
//  &84    !                benchmark.
//  &85    !
//  &86    !    Changes:    In the initialization part, this version follows mostly
//  &87    !                Rick Richardson's version distributed via Usenet, not the
//  &88    !                version distributed earlier via floppy disk by Reinhold Weicker.
//  &89    !                As a concession to older compilers, names have been made
//  &90    !                unique within the first 8 characters.
//  &91    !                Inside the measurement loop, this version follows the
//  &92    !                version previously distributed by Reinhold Weicker.
//  &93    !
//  &94    !                At several places in the benchmark, code has been added,
//  &95    !                but within the measurement loop only in branches that
//  &96    !                are not executed. The intention is that optimizing compilers
//  &97    !                should be prevented from moving code out of the measurement
//  &98    !                loop, or from removing code altogether. Since the statements
//  &99    !                that are executed within the measurement loop have NOT been
//  &100   !                changed, the numbers defining the "Dhrystone distribution"
//  &101   !                (distribution of statements, operand types and locality)
//  &102   !                still hold. Except for sophisticated optimizing compilers,
//  &103   !                execution times for this version should be the same as
//  &104   !                for previous versions.
//  &105   !
//  &106   !                Since it has proven difficult to subtract the time for the
//  &107   !                measurement loop overhead in a correct way, the loop check
//  &108   !                has been made a part of the benchmark. This does have
//  &109   !                an impact - though a very minor one - on the distribution
//  &110   !                statistics which have been updated for this version.
//  &111   !
//  &112   !                All changes within the measurement loop are described
//  &113   !                and discussed in the companion paper "Rationale for
//  &114   !                Dhrystone version 2".
//  &115   !
//  &116   !                Because of the self-imposed limitation that the order and
//  &117   !                distribution of the executed statements should not be
//  &118   !                changed, there are still cases where optimizing compilers
//  &119   !                may not generate code for some statements. To a certain
//  &120   !                degree, this is unavoidable for small synthetic benchmarks.
//  &121   !                Users of the benchmark are advised to check code listings
//  &122   !                whether code is generated for all statements of Dhrystone.
//  &123   !
//  &124   !                Version 2.1 is identical to version 2.0 distributed via
//  &125   !                the UNIX network Usenet in March 1988 except that it corrects
//  &126   !                some minor deficiencies that were found by users of version 2.0.
//  &127   !                The only change within the measurement loop is that a
//  &128   !                non-executed "else" part was added to the "if" statement in
//  &129   !                Func_3, and a non-executed "else" part removed from Proc_3.
//  &130   !
//  &131   !  **************************************************************************
//  &132   !
//  &133   !   Defines:     The following "Defines" are possible:
//  &134   !                -DREG=register          (default: Not defined)
//  &135   !                        As an approximation to what an average C programmer
//  &136   !                        might do, the "register" storage class is applied
//  &137   !                        (if enabled by -DREG=register)
//  &138   !                        - for local variables, if they are used (dynamically)
//  &139   !                          five or more times
//  &140   !                        - for parameters if they are used (dynamically)
//  &141   !                          six or more times
//  &142   !                        Note that an optimal "register" strategy is
//  &143   !                        compiler-dependent, and that "register" declarations
//  &144   !                        do not necessarily lead to faster execution.
//  &145   !                -DNOSTRUCTASSIGN        (default: Not defined)
//  &146   !                        Define if the C compiler does not support
//  &147   !                        assignment of structures.
//  &148   !                -DNOENUMS               (default: Not defined)
//  &149   !                        Define if the C compiler does not support
//  &150   !                        enumeration types.
//  &151   !                -DTIMES                 (default)
//  &152   !                -DTIME
//  &153   !                        The "times" function of UNIX (returning process times)
//  &154   !                        or the "time" function (returning wallclock time)
//  &155   !                        is used for measurement.
//  &156   !                        For single user machines, "time ()" is adequate. For
//  &157   !                        multi-user machines where you cannot get single-user
//  &158   !                        access, use the "times ()" function. If you have
//  &159   !                        neither, use a stopwatch in the dead of night.
//  &160   !                        "printf"s are provided marking the points "Start Timer"
//  &161   !                        and "Stop Timer". DO NOT use the UNIX "time(1)"
//  &162   !                        command, as this will measure the total time to
//  &163   !                        run this program, which will (erroneously) include
//  &164   !                        the time to allocate storage (malloc) and to perform
//  &165   !                        the initialization.
//  &166   !                -DHZ=nnn
//  &167   !                        In Berkeley UNIX, the function "times" returns process
//  &168   !                        time in 1/HZ seconds, with HZ = 60 for most systems.
//  &169   !                        CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY
//  &170   !                        A VALUE.
//  &171   !
//  &172   !  **************************************************************************
//  &173   !
//  &174   !    Compilation model and measurement (IMPORTANT):
//  &175   !
//  &176   !    This C version of Dhrystone consists of three files:
//  &177   !    - dhry.h (this file, containing global definitions and comments)
//  &178   !    - dhry_1.c (containing the code corresponding to Ada package Pack_1)
//  &179   !    - dhry_2.c (containing the code corresponding to Ada package Pack_2)
//  &180   !
//  &181   !    The following "ground rules" apply for measurements:
//  &182   !    - Separate compilation
//  &183   !    - No procedure merging
//  &184   !    - Otherwise, compiler optimizations are allowed but should be indicated
//  &185   !    - Default results are those without register declarations
//  &186   !    See the companion paper "Rationale for Dhrystone Version 2" for a more
//  &187   !    detailed discussion of these ground rules.
//  &188   !
//  &189   !    For 16-Bit processors (e.g. 80186, 80286), times for all compilation
//  &190   !    models ("small", "medium", "large" etc.) should be given if possible,
//  &191   !    together with a definition of these models for the compiler system used.
//  &192   !
//  &193   !  *************************************************************************
//  &194   !
//  &195   !    Dhrystone (C version) statistics:
//  &196   !
//  &197   !    [Comment from the first distribution, updated for version 2.
//  &198   !     Note that because of language differences, the numbers are slightly
//  &199   !     different from the Ada version.]
//  &200   !
//  &201   !    The following program contains statements of a high level programming
//  &202   !    language (here: C) in a distribution considered representative:
//  &203   !
//  &204   !      assignments                  52 (51.0 %)
//  &205   !      control statements           33 (32.4 %)
//  &206   !      procedure, function calls    17 (16.7 %)
//  &207   !
//  &208   !    103 statements are dynamically executed. The program is balanced with
//  &209   !    respect to the three aspects:
//  &210   !
//  &211   !      - statement type
//  &212   !      - operand type
//  &213   !      - operand locality
//  &214   !           operand global, local, parameter, or constant.
//  &215   !
//  &216   !    The combination of these three aspects is balanced only approximately.
//  &217   !
//  &218   !    1. Statement Type:
//  &219   !    -----------------             number
//  &220   !
//  &221   !       V1 = V2                     9
//  &222   !         (incl. V1 = F(..)
//  &223   !       V = Constant               12
//  &224   !       Assignment,                 7
//  &225   !         with array element
//  &226   !       Assignment,                 6
//  &227   !         with record component
//  &228   !                                  --
//  &229   !                                  34       34
//  &230   !
//  &231   !       X = Y +|-|"&&"|"|" Z        5
//  &232   !       X = Y +|-|"==" Constant     6
//  &233   !       X = X +|- 1                 3
//  &234   !       X = Y *|/ Z                 2
//  &235   !       X = Expression,             1
//  &236   !             two operators
//  &237   !       X = Expression,             1
//  &238   !             three operators
//  &239   !                                  --
//  &240   !                                  18       18
//  &241   !
//  &242   !       if ....                    14
//  &243   !         with "else"      7
//  &244   !         without "else"   7
//  &245   !             executed        3
//  &246   !             not executed    4
//  &247   !       for ...                     7  |  counted every time
//  &248   !       while ...                   4  |  the loop condition
//  &249   !       do ... while                1  |  is evaluated
//  &250   !       switch ...                  1
//  &251   !       break                       1
//  &252   !       declaration with            1
//  &253   !         initialization
//  &254   !                                  --
//  &255   !                                  34       34
//  &256   !
//  &257   !       P (...)  procedure call    11
//  &258   !         user procedure      10
//  &259   !         library procedure    1
//  &260   !       X = F (...)
//  &261   !               function  call      6
//  &262   !         user function        5
//  &263   !         library function     1
//  &264   !                                  --
//  &265   !                                  17       17
//  &266   !                                          ---
//  &267   !                                          103
//  &268   !
//  &269   !      The average number of parameters in procedure or function calls
//  &270   !      is 1.82 (not counting the function values aX *
//  &271   !
//  &272   !    2. Operators
//  &273   !    ------------
//  &274   !                            number    approximate
//  &275   !                                      percentage
//  &276   !
//  &277   !      Arithmetic             32          50.8
//  &278   !
//  &279   !         +                     21          33.3
//  &280   !         -                      7          11.1
//  &281   !         *                      3           4.8
//  &282   !         / (int div)            1           1.6
//  &283   !
//  &284   !      Comparison             27           42.8
//  &285   !
//  &286   !         ==                     9           14.3
//  &287   !         /=                     4            6.3
//  &288   !         >                      1            1.6
//  &289   !         <                      3            4.8
//  &290   !         >=                     1            1.6
//  &291   !         <=                     9           14.3
//  &292   !
//  &293   !      Logic                   4            6.3
//  &294   !
//  &295   !         && (AND-THEN)          1            1.6
//  &296   !         |  (OR)                1            1.6
//  &297   !         !  (NOT)               2            3.2
//  &298   !
//  &299   !                             --          -----
//  &300   !                             63          100.1
//  &301   !
//  &302   !
//  &303   !    3. Operand Type (counted once per operand reference):
//  &304   !    ---------------
//  &305   !                            number    approximate
//  &306   !                                      percentage
//  &307   !
//  &308   !       Integer               175        72.3 %
//  &309   !       Character              45        18.6 %
//  &310   !       Pointer                12         5.0 %
//  &311   !       String30                6         2.5 %
//  &312   !       Array                   2         0.8 %
//  &313   !       Record                  2         0.8 %
//  &314   !                             ---       -------
//  &315   !                             242       100.0 %
//  &316   !
//  &317   !    When there is an access path leading to the final operand (e.g. a record
//  &318   !    component), only the final data type on the access path is counted.
//  &319   !
//  &320   !
//  &321   !    4. Operand Locality:
//  &322   !    -------------------
//  &323   !                                  number    approximate
//  &324   !                                            percentage
//  &325   !
//  &326   !       local variable              114        47.1 %
//  &327   !       global variable              22         9.1 %
//  &328   !       parameter                    45        18.6 %
//  &329   !          value                        23         9.5 %
//  &330   !          reference                    22         9.1 %
//  &331   !       function result               6         2.5 %
//  &332   !       constant                     55        22.7 %
//  &333   !                                   ---       -------
//  &334   !                                   242       100.0 %
//  &335   !
//  &336   !
//  &337   !    The program does not compute anything meaningful, but it is syntactically
//  &338   !    and semantically correct. All variables have a value assigned to them
//  &339   !    before they are used as a source operand.
//  &340   !
//  &341   !    There has been no explicit effort to account for the effects of a
//  &342   !    cache, or to balance the use of long or short displacements for code or
//  &343   !    data.
//  &344   !
//  &345   !  **************************************************************************
//  &346
//  &347   { Compiler and system dependent definitions: }
//  &348
//  &349   { Use times(2) time function unless    }
//  &350   { explicitly defined otherwise         }
//  &351
//  &352   { Use Microsoft C hi-res clock }
//  &353
//  &354   %const %integer Mic secs Per Second     = 1000000       { Berkeley UNIX C returns process times in seconds/HZ }
//  &355
//  &356   !! If using gtcpp:
//  &357   !!   $define structassign(d, s)      d = s
//  &358
//  &359   %const %integer Ident 1 = 0
//  &360   %const %integer Ident 2 = 1
//  &361   %const %integer Ident 3 = 2
//  &362   %const %integer Ident 4 = 3
//  &363   %const %integer Ident 5 = 4
//  &364   ! typedef int   Enumeration;
//  &365
//  &366   { for boolean and enumeration types in Ada, Pascal }
//  &367
//  &368   { General definitions: }
//  &369
//  &370   { Value of a Null pointer }
//  &371   !!%external %record (*) %name %spec Null
//  &372   %const %integer true  = 1
//  &373   %const %integer false = 0
//  &374
//  &375   ! typedef int     One Thirty;
//  &376   ! typedef int     One Fifty;
//  &377   ! typedef char    Capital Letter;
//  &378   ! typedef int     Boolean;
//  &379   ! typedef char    Str 30 [31];
//  &380   ! typedef int     Arr 1 Dim [50];
//  &381   ! typedef int     Arr 2 Dim [50] [50];
//  &382
//  &383
//  &384   %recordformat var 1 fm    (%integer {Enumeration} Enum Comp, %integer     Int Comp, %string (30) Str Comp)
//  &385   %recordformat var 2 fm    (%integer {Enumeration} E Comp 2, %string (30) Str 2 Comp)
//  &386   %recordformat var 3 fm    (%byteinteger Ch 1 Comp, %byteinteger Ch 2 Comp)
//  &387   %recordformat variant fm  (%record (var 1 fm) var 1 %or %record (var 2 fm) var 2 %or %record (var 3 fm) var 3)
//  &388   %recordformat Rec Type fm (%record (Rec Type fm) %name Ptr Comp,
//  &389 +                            %integer {Enumeration} Discr,
//  &390 +                            %record (variant fm) variant)
//  &391
//  &392   %external %record (Rec Type fm) %spec        Rec Type
//  &393   %external %record (Rec Type fm) %name %spec  Rec Pointer;
//  &394
//  &395   %endoffile
//    32
//    33  %const %integer DHRY ITERS = 100000
//    34
//    35  { Global Variables: }
//    36
//    37  %external %record (Rec Type fm) %name  Ptr Glob,
//    38+                                        Next Ptr Glob
//    39  %external %integer                     Int Glob
//    40  %external %integer {Boolean}           Bool Glob
//    41  %external %byte %integer               Ch 1 Glob,
//    42+                                        Ch 2 Glob
//    43  %external %integer %array              Arr 1 Glob (0:49)
//    44
//    45  !!! PROBLEM! Imp77 doesn't allow N-D external arrays, only local ones!
//    46  %external %integer %array              Arr 2 Glob (0:50*50-1) {(0:49, 0:49)}
//    47
//    48  !extern char     *malloc ()
//    49  !!%external %integer {Enumeration} %fn %spec     Func 1
//    50    { forward declaration necessary since Enumeration may not simply be int }
//    51
//    52  !#ifndef REG
//    53  %external %integer {Boolean} Reg = false
//    54  !#define REG
//    55          { REG becomes defined as empty }
//    56          { i.e. no register variables   }
//    57  !#else
//    58  !        %integer {Boolean} Reg = true
//    59  !#endif
//    60
//    61  { variables for time measurement: }
//    62
//    63  !#ifdef TIMES
//    64  !struct tms      time info
//    65  !extern  int     times ()
//    66  !                { see library function "times" }
//    67  !#define Too Small Time (2*HZ)
//    68  !                { Measurements should last at least about 2 seconds }
//    69  !#endif
//    70  !#ifdef TIME
//    71  !extern long     time()
//    72  !                { see library function "time"  }
//    73  !#define Too Small Time 2
//    74  !                { Measurements should last at least 2 seconds }
//    75  !#endif
//    76  !#ifdef MSC CLOCK
//    77  !extern clock t	clock()
//    78  !#define Too Small Time (2*HZ)
//    79  !#endif
//    80
//    81  %const %integer           Too Small Time = 2 * 1000000  {must run at least 2 seconds}
//    82
//    83  %external %long %integer  Begin Time, %c
//    84+                           End Time, %c
//    85+                           User Time
//    86
//    87  %external %real           Microseconds, %c
//    88+                           Dhrystones Per Second
//    89
//    90  { end of variables for time measurement }
//    91
//    92
//    93  %begin
//    94  {***}
//    95    %routinespec Proc 1 (%record (Rec Type fm) %name Ptr Val Par)
//    96    %routinespec Proc 2 (%integer {One Fifty} %name  Int Par Ref)
//    97    %routinespec Proc 3 (%record (Rec Type fm) %name Ptr Ref Par)
//    98    %routinespec Proc 4
//    99    %routinespec Proc 5
//   100
//   101    { main program, corresponds to procedures        }
//   102    { Main and Proc 0 in the Ada version             }
//   103
//   104    %integer {One Fifty}   Int 1 Loc
//   105    %integer {One Fifty}   Int 2 Loc
//   106    %integer {One Fifty}   Int 3 Loc
//   107    %byte %integer         Ch Index
//   108    %integer {Enumeration} Enum Loc
//   109    %string (30)           Str 1 Loc
//   110    %string (30)           Str 2 Loc
//   111    %integer               Run Index
//   112    %integer               Number Of Runs
//   113
//   114    { Initializations }
//   115
//   116    %record (Rec Type fm) Next Ptr Glob
//   117    %record (Rec Type fm) Ptr Glob {= (Rec Pointer) malloc (sizeof (Rec Type))}
//   118
//   119    Ptr Glob_Ptr Comp                    == Next Ptr Glob
//   120    Ptr Glob_Discr                       = Ident 1
//   121    Ptr Glob_variant_var 1_Enum Comp     = Ident 3
//   122    Ptr Glob_variant_var 1_Int Comp      = 40
//   123    Ptr Glob_variant_var 1_Str Comp = "DHRYSTONE PROGRAM, SOME STRING"
//   124    Str 1 Loc = "DHRYSTONE PROGRAM, 1'ST STRING"
//   125
//   126    Arr 2 Glob (8*50+7){(8,7)} = 10
//   127          { Was missing in published program. Without this statement,    }
//   128          { Arr 2 Glob [8][7] would have an undefined value.             }
//   129          { Warning: With 16-Bit processors and Number Of Runs > 32000,  }
//   130          { overflow may occur for this array element.                   }
//   131
//   132    newline
//   133    printstring ("Dhrystone Benchmark, Version 2.1 (Language: Imp)")
//   134    newlines(2)
//   135
//   136    %if Reg # 0 %start
//   137      printstring ("Program compiled with 'register' attribute")
//   138      newlines(2)
//   139    %else
//   140      printstring ("Program compiled without 'register' attribute")
//   141      newlines(2)
//   142    %finish
//   143
//   144    Number Of Runs = DHRY ITERS
//   145
//   146  !  printstring ("Please give the number of runs through the benchmark: ")
//   147  !  %begin
//   148  !    %integer n
//   149  !    read(n)
//   150  !    Number Of Runs = n
//   151  !  %end
//   152  !  newline
//   153
//   154    printstring ("Execution starts, ")
//   155    write(Number Of Runs, -1)
//   156    printstring (" runs through Dhrystone")
//   157    newline
//   158
//   159    {*************}
//   160    { Start timer }
//   161    {*************}
//   162
//   163  !#ifdef TIMES
//   164  !  times (&time info)
//   165  !  Begin Time = (long) time info.tms utime
//   166  !#endif
//   167  !#ifdef TIME
//   168  !  Begin Time = time ( (long *) 0)
//   169  !#endif
//   170  !#ifdef MSC CLOCK
//   171  !  Begin Time = clock()
//   172  !#endif
//   173
//   174    Begin Time = cpu time
//   175
//   176    %for Run Index = 1, 1, Number Of Runs %cycle
//   177
//   178      Proc 5
//   179      Proc 4
//   180        { Ch 1 Glob == 'A', Ch 2 Glob == 'B', Bool Glob == true }
//   181      Int 1 Loc = 2
//   182      Int 2 Loc = 3
//   183      Str 2 Loc = "DHRYSTONE PROGRAM, 2'ND STRING"
//   184      Enum Loc = Ident 2
//   185      %if %not Func 2 (Str 1 Loc, Str 2 Loc) %then Bool Glob = false %else Bool Glob = true
//   186        { Bool Glob == 1 }
//   187      %while Int 1 Loc < Int 2 Loc %cycle { loop body executed once }
//   188        Int 3 Loc = 5 * Int 1 Loc - Int 2 Loc
//   189          { Int 3 Loc == 7 }
//   190        Proc 7 (Int 1 Loc, Int 2 Loc, Int 3 Loc)
//   191          { Int 3 Loc == 7 }
//   192        Int 1 Loc = Int 1 Loc + 1
//   193      %repeat { while }
//   194        { Int 1 Loc == 3, Int 2 Loc == 3, Int 3 Loc == 7 }
//   195      Proc 8 (Arr 1 Glob, Arr 2 Glob, Int 1 Loc, Int 3 Loc)
//   196        { Int Glob == 5 }
//   197      Proc 1 (Ptr Glob)
//   198      %for Ch Index = 'A', 1,  Ch 2 Glob %cycle
//   199                               { loop body executed twice }
//   200        %if Enum Loc = Func 1 (Ch Index, 'C') %start
//   201            { then, not executed }
//   202          Proc 6 (Ident 1, Enum Loc)
//   203          Str 2 Loc = "DHRYSTONE PROGRAM, 3'RD STRING"
//   204          Int 2 Loc = Run Index
//   205          Int Glob = Run Index
//   206        %finish
//   207      %repeat
//   208        { Int 1 Loc == 3, Int 2 Loc == 3, Int 3 Loc == 7 }
//   209      Int 2 Loc = Int 2 Loc * Int 1 Loc
//   210      Int 1 Loc = Int 2 Loc // Int 3 Loc
//   211      Int 2 Loc = 7 * (Int 2 Loc - Int 3 Loc) - Int 1 Loc
//   212        { Int 1 Loc == 1, Int 2 Loc == 13, Int 3 Loc == 7 }
//   213      Proc 2 (Int 1 Loc)
//   214        { Int 1 Loc == 5 }
//   215
//   216    %repeat { loop "for Run Index" }
//   217
//   218    {************}
//   219    { Stop timer }
//   220    {************}
//   221
//   222  !#ifdef TIMES
//   223  !  times (&time info)
//   224  !  End Time = (long) time info.tms utime
//   225  !#endif
//   226  !#ifdef TIME
//   227  !  End Time = time ( (long *) 0)
//   228  !#endif
//   229  !#ifdef MSC CLOCK
//   230  !  End Time = clock()
//   231  !#endif
//   232
//   233    End Time = cpu time
//   234
//   235    printstring ("Execution ends"); newline
//   236    printstring (""); newline
//   237    printstring ("Final values of the variables used in the benchmark:"); newline
//   238    printstring (""); newline
//   239    printstring ("Int_Glob:            "); write( Int Glob, -1); newline
//   240    printstring ("        should be:   "); write( 5, -1); newline
//   241    printstring ("Bool_Glob:           "); write( Bool Glob, -1); newline
//   242    printstring ("        should be:   "); write( 1, -1); newline
//   243    printstring ("Ch_1_Glob:           "); print symbol(Ch 1 Glob); newline
//   244    printstring ("        should be:   "); print symbol('A'); newline
//   245    printstring ("Ch_2_Glob:           "); print symbol(Ch 2 Glob); newline
//   246    printstring ("        should be:   "); print symbol('B'); newline
//   247    printstring ("Arr_1_Glob[8]:       "); write( Arr 1 Glob(8), -1); newline
//   248    printstring ("        should be:   "); write( 7, -1); newline
//   249    printstring ("Arr_2_Glob[8][7]:    "); write( Arr 2 Glob(8*50+7){(8,7)}, -1); newline
//   250    printstring ("        should be:   Number_Of_Runs + 10"); newline
//   251    printstring ("Ptr_Glob->"); newline
//   252    printstring ("  Ptr_Comp:          "); write(ADDR(Ptr Glob_Ptr Comp), -1); newline
//   253    printstring ("        should be:   (implementation-dependent)"); newline
//   254    printstring ("  Discr:             "); write( Ptr Glob_Discr, -1); newline
//   255    printstring ("        should be:   "); write( 0, -1); newline
//   256    printstring ("  Enum_Comp:         "); write( Ptr Glob_variant_var 1_Enum Comp, -1); newline
//   257    printstring ("        should be:   "); write( 2, -1); newline
//   258    printstring ("  Int_Comp:          "); write( Ptr Glob_variant_var 1_Int Comp, -1); newline
//   259    printstring ("        should be:   "); write( 17, -1); newline
//   260    printstring ("  Str_Comp:          "); print string(Ptr Glob_variant_var 1_Str Comp); newline
//   261    printstring ("        should be:   DHRYSTONE PROGRAM, SOME STRING"); newline
//   262    printstring ("Next_Ptr_Glob->"); newline
//   263    printstring ("  Ptr_Comp:          "); write(ADDR(Next Ptr Glob_Ptr Comp), -1); newline
//   264    printstring ("        should be:   (implementation-dependent), same as above"); newline
//   265    printstring ("  Discr:             "); write( Next Ptr Glob_Discr, -1); newline
//   266    printstring ("        should be:   "); write( 0, -1); newline
//   267    printstring ("  Enum_Comp:         "); write( Next Ptr Glob_variant_var 1_Enum Comp, -1); newline
//   268    printstring ("        should be:   "); write( 1, -1); newline
//   269    printstring ("  Int_Comp:          "); write( Next Ptr Glob_variant_var 1_Int Comp, -1); newline
//   270    printstring ("        should be:   "); write( 18, -1); newline
//   271    printstring ("  Str_Comp:          "); print string(Next Ptr Glob_variant_var 1_Str Comp); newline
//   272    printstring ("        should be:   DHRYSTONE PROGRAM, SOME STRING"); newline
//   273    printstring ("Int_1_Loc:           "); write( Int 1 Loc, -1); newline
//   274    printstring ("        should be:   "); write( 5, -1); newline
//   275    printstring ("Int_2_Loc:           "); write( Int 2 Loc, -1); newline
//   276    printstring ("        should be:   "); write( 13, -1); newline
//   277    printstring ("Int_3_Loc:           "); write( Int 3 Loc, -1); newline
//   278    printstring ("        should be:   "); write( 7, -1); newline
//   279    printstring ("Enum_Loc:            "); write( Enum Loc, -1); newline
//   280    printstring ("        should be:   "); write( 1, -1); newline
//   281    printstring ("Str_1_Loc:           "); print string(Str 1 Loc); newline
//   282    printstring ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING"); newline
//   283    printstring ("Str_2_Loc:           "); print string(Str 2 Loc); newline
//   284    printstring ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING"); newline
//   285    newline
//   286
//   287    User Time = End Time - Begin Time
//   288
//   289  !!  %if User Time < Too Small Time %start
//   290  !!    printf ("Measured time too small to obtain meaningful results"); newline
//   291  !!    printf ("Please increase number of runs"); newline
//   292  !!    newline
//   293  !!  %else
//   294  !#ifdef TIME
//   295  !    Microseconds = (float) User Time * Mic secs Per Second
//   296  !                        / (float) Number Of Runs
//   297  !    Dhrystones Per Second = (float) Number Of Runs / (float) User Time
//   298  !#else
//   299  !    Microseconds = (float) User Time * Mic secs Per Second
//   300  !                        / ((float) HZ * ((float) Number Of Runs))
//   301  !    Dhrystones Per Second = ((float) HZ * (float) Number Of Runs)
//   302  !                        / (float) User Time
//   303  !#endif
//   304
//   305      Microseconds = User Time // Number Of Runs  {CPU TIME function has been adjusted to return microseconds!}
//   306      Dhrystones Per Second = (Number Of Runs * (1000000//1000)) // (User Time//1000)  {need to scale down by 1000 to fit in 32-bit %integer}
//   307
//   308      printstring ("Microseconds for one run through Dhrystone: ")
//   309      write(INT(Microseconds), -1); space; newline
//   310      printstring ("Dhrystones per Second:                      ")
//   311      write(INT(Dhrystones Per Second), -1); space; newline
//   312      newline
//   313  !!  %finish
//   314
//   315  !%end
//   316
//   317
//   318  %routine Proc 1 (%record (Rec Type fm) %name Ptr Val Par)
//   319  {****************}
//   320      { executed once }
//   321    %record (Rec Type fm) %name Next Record == Ptr Val Par_Ptr Comp   {or '='???}
//   322                                          { == Ptr Glob Next }
//   323    { Local variable, initialized with Ptr Val Par->Ptr Comp,    }
//   324    { corresponds to "rename" in Ada, "with" in Pascal           }
//   325
//   326    {structassign} Ptr Val Par_Ptr Comp = Ptr Glob
//   327    Ptr Val Par_variant_var 1_Int Comp = 5
//   328    Next Record_variant_var 1_Int Comp = Ptr Val Par_variant_var 1_Int Comp
//   329    Next Record_Ptr Comp = Ptr Val Par_Ptr Comp
//   330    Proc 3 (Next Record_Ptr Comp)
//   331      { Ptr Val Par_Ptr Comp_Ptr Comp = Ptr Glob_Ptr Comp }
//   332    %if Next Record_Discr = Ident 1 %start
//   333      { then, executed }
//   334      Next Record_variant_var 1_Int Comp = 6
//   335      Proc 6 (Ptr Val Par_variant_var 1_Enum Comp, Next Record_variant_var 1_Enum Comp)
//   336      Next Record_Ptr Comp = Ptr Glob_Ptr Comp
//   337      Proc 7 (Next Record_variant_var 1_Int Comp, 10, Next Record_variant_var 1_Int Comp)
//   338    %else { not executed }
//   339      {structassign} Ptr Val Par = Ptr Val Par_Ptr Comp
//   340    %finish
//   341  %end { Proc 1 }
//   342
//   343
//   344  %routine Proc 2 (%integer {One Fifty} %name  Int Par Ref)
//   345  {****************}
//   346      { executed once }
//   347      { *Int Par Ref == 1, becomes 4 }
//   348    %integer {One Fifty}     Int Loc
//   349    %integer {Enumeration}   Enum Loc
//   350
//   351    Int Loc = Int Par Ref + 10
//   352    %cycle { executed once }
//   353      %if Ch 1 Glob = 'A' %start
//   354        { then, executed }
//   355        Int Loc = Int Loc - 1
//   356        Int Par Ref = Int Loc - Int Glob
//   357        Enum Loc = Ident 1
//   358      %finish { if }
//   359    %repeat %until Enum Loc = Ident 1 { true }
//   360  %end { Proc 2 }
//   361
//   362
//   363  %routine Proc 3 (%record (Rec Type fm) %name Ptr Ref Par)
//   364  {****************}
//   365      { executed once }
//   366      { Ptr Ref Par becomes Ptr Glob }
//   367
//   368    %if Ptr Glob ## Null %then { then, executed } Ptr Ref Par == Ptr Glob_Ptr Comp
//   369    Proc 7 (10, Int Glob, Ptr Glob_variant_var 1_Int Comp)
//   370  %end { Proc 3 }
//   371
//   372
//   373  %routine Proc 4 { without parameters }
//   374  {*****}
//   375      { executed once }
//   376    %integer {Boolean} Bool Loc
//   377
//   378    %if Ch 1 Glob = 'A' %then Bool Loc = true %else Bool Loc = false
//   379    Bool Glob = Bool Loc ! Bool Glob
//   380    Ch 2 Glob = 'B'
//   381  %end { Proc 4 }
//   382
//   383
//   384  %routine Proc 5 { without parameters }

struct VAR1FM {
  union {
    struct {
      int ENUMCOMP;
      int INTCOMP;
      _imp_string30 STRCOMP;
    };
  };
};

//   385  {*****}

struct VAR2FM {
  union {
    struct {
      int ECOMP2;
      _imp_string30 STR2COMP;
    };
  };
};

//   386      { executed once }

struct VAR3FM {
  union {
    struct {
      unsigned char CH1COMP;
      unsigned char CH2COMP;
    };
  };
};

//   387    Ch 1 Glob = 'A'

struct VARIANTFM {
  union {
    struct {
      struct VAR1FM VAR1;
    };
    struct {
      struct VAR2FM VAR2;
    };
    struct {
      struct VAR3FM VAR3;
    };
  };
};

//   388    Bool Glob = false

struct RECTYPEFM {
  union {
    struct {
      struct RECTYPEFM *PTRCOMP;
      int DISCR;
      struct VARIANTFM VARIANT;
    };
  };
};

//   389  %end { Proc 5 }
//   390
//   391
//   392  { Procedure for the assignment of structures,          }

extern struct RECTYPEFM RECTYPE;

//   393  { if the C compiler doesn't support this feature       }

extern struct RECTYPEFM *RECPOINTER;

//   394

struct RECTYPEFM *PTRGLOB;
struct RECTYPEFM *NEXTPTRGLOB;

//   395  %endofprogram

int INTGLOB;

//
//   297 Statements compiled

int BOOLGLOB;

unsigned char CH1GLOB;
unsigned char CH2GLOB;

int ARR1GLOB[50];
struct _imp_dv ARR1GLOB_dv = {ARR1GLOB, sizeof(int) /*, dims, <bounds> */};

int ARR2GLOB[2500];
struct _imp_dv ARR2GLOB_dv = {ARR2GLOB, sizeof(int) /*, dims, <bounds> */};

int REG = 0;

long int BEGINTIME;
long int ENDTIME;
long int USERTIME;

float MICROSECONDS;
float DHRYSTONESPERSECOND;

int main(int argc, char **argv) { /*%begin*/
  _imp_initialise(argc, argv);
  auto void PROC1(struct RECTYPEFM * PTRVALPAR);

  auto void PROC2(int *INTPARREF);

  auto void PROC3(struct RECTYPEFM * PTRREFPAR);

  auto void PROC4(void);

  auto void PROC5(void);

  int INT1LOC;

  int INT2LOC;

  int INT3LOC;

  unsigned char CHINDEX;

  int ENUMLOC;

  _imp_string30 STR1LOC;

  _imp_string30 STR2LOC;

  int RUNINDEX;

  int NUMBEROFRUNS;

  struct RECTYPEFM NEXTPTRGLOB;

  struct RECTYPEFM PTRGLOB;

  PTRGLOB.PTRCOMP = (struct RECTYPEFM *)/*?*/ &NEXTPTRGLOB;

  PTRGLOB.DISCR = 0;

  PTRGLOB.VARIANT.VAR1.ENUMCOMP = 2;

  PTRGLOB.VARIANT.VAR1.INTCOMP = 40;


  /* clang-format off */
_imp_strncpy(/*?*/&PTRGLOB.VARIANT.VAR1.STRCOMP, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = _imp_str_literal("DHRYSTONE PROGRAM, SOME STRING"); (void *)&tmp;}), /*max:*/255);

  /* clang-format on */


  /* clang-format off */
_imp_strncpy(/*?*/&STR1LOC, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = _imp_str_literal("DHRYSTONE PROGRAM, 1'ST STRING"); (void *)&tmp;}), /*max:*/30);

  /* clang-format on */

  ARR2GLOB[8 * 50 + 7] = 10;

  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Dhrystone Benchmark, Version 2.1 (Language: Imp)"));

  _imp_NEWLINES(2);

  if (REG == 0) goto L_0001;

  _imp_PRINTSTRING(_imp_str_literal("Program compiled with 'register' attribute"));

  _imp_NEWLINES(2);

  goto L_0002;
L_0001:;

  _imp_PRINTSTRING(_imp_str_literal("Program compiled without 'register' attribute"));

  _imp_NEWLINES(2);

L_0002:;

  NUMBEROFRUNS = 100000;

  _imp_PRINTSTRING(_imp_str_literal("Execution starts, "));

  _imp_WRITE(NUMBEROFRUNS, -1);

  _imp_PRINTSTRING(_imp_str_literal(" runs through Dhrystone"));

  _imp_NEWLINE();

  BEGINTIME = _imp_CPUTIME();

  // %for RUNINDEX = 1, 1, NUMBEROFRUNS %cycle
  {
    int _final = NUMBEROFRUNS;
    if (invalid_for_loop(1, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle RUNINDEX = 1, 1, NUMBEROFRUNS");
    RUNINDEX = 0;
  L_0003:
    if (RUNINDEX == _final) goto L_0004;
    RUNINDEX += 1;

    PROC5();

    PROC4();

    INT1LOC = 2;

    INT2LOC = 3;


    /* clang-format off */
_imp_strncpy(/*?*/&STR2LOC, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = _imp_str_literal("DHRYSTONE PROGRAM, 2'ND STRING"); (void *)&tmp;}), /*max:*/30);

    /* clang-format on */

    ENUMLOC = 1;

    if (FUNC2((_imp_string30 *)/*p*/ /*?*/ &STR1LOC, (_imp_string30 *)/*p*/ /*?*/ &STR2LOC)) goto L_0006;
    BOOLGLOB = 0;
    goto L_0007;
  L_0006:;
    BOOLGLOB = 1;
  L_0007:;

  L_0008:;
    if (INT1LOC >= INT2LOC) goto L_0009;

    INT3LOC = 5 * INT1LOC - INT2LOC;

    PROC7(INT1LOC, INT2LOC, /*?*/ &INT3LOC);

    INT1LOC = INT1LOC + 1;

    goto L_0008;
  L_0009:;

    PROC8(ARR1GLOB, ARR2GLOB, INT1LOC, INT3LOC);

    PROC1(/*?*/ &PTRGLOB);

    // %for CHINDEX = 65, 1, CH2GLOB %cycle
    {
      int _final = CH2GLOB;
      if (invalid_for_loop(65, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle CHINDEX = 65, 1, CH2GLOB");
      CHINDEX = 64;
    L_000A:
      if (CHINDEX == _final) goto L_000B;
      CHINDEX += 1;

      if (ENUMLOC != FUNC1(CHINDEX, 67)) goto L_000D;

      PROC6(0, /*?*/ &ENUMLOC);


      /* clang-format off */
_imp_strncpy(/*?*/&STR2LOC, ({__typeof__(_imp_string255) tmp;/*B*/ tmp = _imp_str_literal("DHRYSTONE PROGRAM, 3'RD STRING"); (void *)&tmp;}), /*max:*/30);

      /* clang-format on */

      INT2LOC = RUNINDEX;

      INTGLOB = RUNINDEX;

    L_000D:;

      goto L_000A;
    }

  L_000B:;

    INT2LOC = INT2LOC * INT1LOC;

    INT1LOC = ((long)INT2LOC / (long)INT3LOC);

    INT2LOC = 7 * (INT2LOC - INT3LOC) - INT1LOC;

    PROC2(/*?*/ &INT1LOC);

    goto L_0003;
  }

L_0004:;

  ENDTIME = _imp_CPUTIME();

  _imp_PRINTSTRING(_imp_str_literal("Execution ends"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal(""));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Final values of the variables used in the benchmark:"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal(""));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Int_Glob:            "));
  _imp_WRITE(INTGLOB, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(5, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Bool_Glob:           "));
  _imp_WRITE(BOOLGLOB, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(1, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Ch_1_Glob:           "));
  _imp_PRINTSYMBOL(CH1GLOB);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_PRINTSYMBOL(65);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Ch_2_Glob:           "));
  _imp_PRINTSYMBOL(CH2GLOB);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_PRINTSYMBOL(66);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Arr_1_Glob[8]:       "));
  _imp_WRITE(ARR1GLOB[8], -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(7, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Arr_2_Glob[8][7]:    "));
  _imp_WRITE(ARR2GLOB[8 * 50 + 7], -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   Number_Of_Runs + 10"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Ptr_Glob->"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Ptr_Comp:          "));
  _imp_WRITE(_imp_ADDR(PTRGLOB.PTRCOMP), -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   (implementation-dependent)"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Discr:             "));
  _imp_WRITE(PTRGLOB.DISCR, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(0, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Enum_Comp:         "));
  _imp_WRITE(PTRGLOB.VARIANT.VAR1.ENUMCOMP, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(2, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Int_Comp:          "));
  _imp_WRITE(PTRGLOB.VARIANT.VAR1.INTCOMP, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(17, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Str_Comp:          "));
  _imp_PRINTSTRING(
      /* clang-format off */
*({  __typeof__(_imp_string255) tmp = PTRGLOB.VARIANT.VAR1.STRCOMP/*q*/;  (_imp_string255 *)&tmp;  })
      /* clang-format on */
  );
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   DHRYSTONE PROGRAM, SOME STRING"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Next_Ptr_Glob->"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Ptr_Comp:          "));
  _imp_WRITE(_imp_ADDR(NEXTPTRGLOB.PTRCOMP), -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   (implementation-dependent), same as above"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Discr:             "));
  _imp_WRITE(NEXTPTRGLOB.DISCR, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(0, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Enum_Comp:         "));
  _imp_WRITE(NEXTPTRGLOB.VARIANT.VAR1.ENUMCOMP, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(1, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Int_Comp:          "));
  _imp_WRITE(NEXTPTRGLOB.VARIANT.VAR1.INTCOMP, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(18, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("  Str_Comp:          "));
  _imp_PRINTSTRING(
      /* clang-format off */
*({  __typeof__(_imp_string255) tmp = NEXTPTRGLOB.VARIANT.VAR1.STRCOMP/*q*/;  (_imp_string255 *)&tmp;  })
      /* clang-format on */
  );
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   DHRYSTONE PROGRAM, SOME STRING"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Int_1_Loc:           "));
  _imp_WRITE(INT1LOC, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(5, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Int_2_Loc:           "));
  _imp_WRITE(INT2LOC, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(13, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Int_3_Loc:           "));
  _imp_WRITE(INT3LOC, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(7, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Enum_Loc:            "));
  _imp_WRITE(ENUMLOC, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   "));
  _imp_WRITE(1, -1);
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Str_1_Loc:           "));
  _imp_PRINTSTRING(
      /* clang-format off */
*({  __typeof__(_imp_string30) tmp = STR1LOC/*q*/;  (_imp_string255 *)&tmp;  })
      /* clang-format on */
  );
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   DHRYSTONE PROGRAM, 1'ST STRING"));
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Str_2_Loc:           "));
  _imp_PRINTSTRING(
      /* clang-format off */
*({  __typeof__(_imp_string30) tmp = STR2LOC/*q*/;  (_imp_string255 *)&tmp;  })
      /* clang-format on */
  );
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("        should be:   DHRYSTONE PROGRAM, 2'ND STRING"));
  _imp_NEWLINE();

  _imp_NEWLINE();

  USERTIME = ENDTIME - BEGINTIME;

  MICROSECONDS = ((long)USERTIME / (long)NUMBEROFRUNS);

  DHRYSTONESPERSECOND = ((long)(NUMBEROFRUNS * (((long)1000000 / (long)1000))) / (long)(((long)USERTIME / (long)1000)));

  _imp_PRINTSTRING(_imp_str_literal("Microseconds for one run through Dhrystone: "));

  _imp_WRITE(_imp_INT(MICROSECONDS), -1);
  _imp_SPACE();
  _imp_NEWLINE();

  _imp_PRINTSTRING(_imp_str_literal("Dhrystones per Second:                      "));

  _imp_WRITE(_imp_INT(DHRYSTONESPERSECOND), -1);
  _imp_SPACE();
  _imp_NEWLINE();

  _imp_NEWLINE();

  void PROC1(struct RECTYPEFM * PTRVALPAR) {
    struct RECTYPEFM *NEXTRECORD;
    NEXTRECORD = (struct RECTYPEFM *)PTRVALPAR->PTRCOMP;

    *PTRVALPAR->PTRCOMP = PTRGLOB;

    PTRVALPAR->VARIANT.VAR1.INTCOMP = 5;

    NEXTRECORD->VARIANT.VAR1.INTCOMP = PTRVALPAR->VARIANT.VAR1.INTCOMP;

    *NEXTRECORD->PTRCOMP = *PTRVALPAR->PTRCOMP;

    PROC3(NEXTRECORD->PTRCOMP);

    if (NEXTRECORD->DISCR != 0) goto L_000E;

    NEXTRECORD->VARIANT.VAR1.INTCOMP = 6;

    PROC6(PTRVALPAR->VARIANT.VAR1.ENUMCOMP, /*?*/ &NEXTRECORD->VARIANT.VAR1.ENUMCOMP);

    *NEXTRECORD->PTRCOMP = *PTRGLOB.PTRCOMP;

    PROC7(NEXTRECORD->VARIANT.VAR1.INTCOMP, 10, /*?*/ &NEXTRECORD->VARIANT.VAR1.INTCOMP);

    goto L_000F;
  L_000E:;

    *PTRVALPAR = *PTRVALPAR->PTRCOMP;

  L_000F:;

    return;
  } /* end of PROC1 */

  void PROC2(int *INTPARREF) {
    int INTLOC;

    int ENUMLOC;

    INTLOC = *INTPARREF + 10;

  L_0010:;

    if (CH1GLOB != 65) goto L_0011;

    INTLOC = INTLOC - 1;

    *INTPARREF = INTLOC - INTGLOB;

    ENUMLOC = 0;

  L_0011:;

    if (ENUMLOC == 0) goto L_0012;
    goto L_0010;
  L_0012:;

    return;
  } /* end of PROC2 */

  void PROC3(struct RECTYPEFM * PTRREFPAR) {

    /* clang-format off */
if (_imp_ADDR((void *)(/*?*/&PTRGLOB)) == _imp_ADDR((void *)(NULL))) goto L_0013;

    /* clang-format on */
    PTRREFPAR = (struct RECTYPEFM *)PTRGLOB.PTRCOMP;
  L_0013:;

    PROC7(10, INTGLOB, /*?*/ &PTRGLOB.VARIANT.VAR1.INTCOMP);

    return;
  } /* end of PROC3 */

  void PROC4(void) {
    int BOOLLOC;

    if (CH1GLOB != 65) goto L_0014;
    BOOLLOC = 1;
    goto L_0015;
  L_0014:;
    BOOLLOC = 0;
  L_0015:;

    BOOLGLOB = BOOLLOC | BOOLGLOB;

    CH2GLOB = 66;

    return;
  } /* end of PROC4 */

  void PROC5(void) {
    CH1GLOB = 65;

    BOOLGLOB = 0;

    return;
  } /* end of PROC5 */

  _imp_stop(0);
  return 0;
end_0:;
}