#include "perms.h"

#define PARM_OPT 1
#ifdef _U // Don't do unassigned checks...
#undef _U
#define _U(x) (x)
#endif
                                                                //      1  %external %routine %spec Proc 6 (%integer {Enumeration} Enum Val Par, %integer {Enumeration} %name Enum Ref Par)
extern void PROC6( int ENUMVALPAR, int /*name*/*ENUMREFPAR );
                                                                //      2  %external %routine %spec Proc 7 (%integer {One Fifty} Int 1 Par Val,
extern void PROC7( int INT1PARVAL, int INT2PARVAL, int /*name*/*INTPARREF );
                                                                //      3                                   %integer {One Fifty} Int 2 Par Val,
                                                                //      4                                   %integer {One Fifty} %name Int Par Ref)
                                                                //      5  %external %routine %spec Proc 8 (%integer %array %name Arr 1 Par Ref {(0:49)},
extern void PROC8( int /*arrayname*/*ARR1PARREF, int /*arrayname*/*ARR2PARREF, int INT1PARVAL, int INT2PARVAL );
                                                                //      6                                   %integer %array %name Arr 2 Par Ref {(0:50*50-1)} {(0:49, 0:49)},
                                                                //      7                                   %integer Int 1 Par Val,
                                                                //      8                                   %integer Int 2 Par Val)
                                                                //      9  %external %integer {Enumeration} %fn %spec Func 1 (%integer {Capital Letter} Ch 1 Par Val,
extern int FUNC1( int CH1PARVAL, int CH2PARVAL );
                                                                //     10                                                     %integer {Capital Letter} Ch 2 Par Val)
                                                                //     11  %external %predicate %spec Func 2 (%string (30) %name Str 1 Par Ref, %string (30) %name Str 2 Par Ref)
extern int /*Boolean*/ FUNC2( _imp_string /*%string(30)*/ /*name*/*STR1PARREF, _imp_string /*%string(30)*/ /*name*/*STR2PARREF );
                                                                //     12  %external %predicate %spec Func 3 (%integer {Enumeration} Enum Par Val)
extern int /*Boolean*/ FUNC3( int ENUMPARVAL );
                                                                //     13  
                                                                //     14  ! ****************************************************************************
                                                                //     15  ! *
                                                                //     16  ! *                   "DHRYSTONE" Benchmark Program
                                                                //     17  ! *                   -----------------------------
                                                                //     18  ! *                                                                            
                                                                //     19  ! *  Version:    Imp, Version 2.1
                                                                //     20  ! *                                                                            
                                                                //     21  ! *  File:       dhry_2.c (part 3 of 3)
                                                                //     22  ! *
                                                                //     23  ! *  Date:       May 25, 1988 & Mar 30, 2026
                                                                //     24  ! *
                                                                //     25  ! *  Author:     Reinhold P. Weicker, translated from C to Imp by Graham Toal
                                                                //     26  ! *
                                                                //     27  ! ****************************************************************************
                                                                //     28  
                                                                //     29  %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)
typedef struct VAR1FM VAR1FM;
struct VAR1FM {
  int ENUMCOMP;
  int INTCOMP;
  _imp_string /*%string(30)*/ STRCOMP;
};
                                                                //    385  %recordformat var 2 fm    (%integer {Enumeration} E Comp 2, %string (30) Str 2 Comp)
typedef struct VAR2FM VAR2FM;
struct VAR2FM {
  int ECOMP2;
  _imp_string /*%string(30)*/ STR2COMP;
};
                                                                //    386  %recordformat var 3 fm    (%byteinteger Ch 1 Comp, %byteinteger Ch 2 Comp)
typedef struct VAR3FM VAR3FM;
struct VAR3FM {
  unsigned char CH1COMP;
  unsigned char CH2COMP;
};
                                                                //    387  %recordformat variant fm  (%record (var 1 fm) var 1 %or %record (var 2 fm) var 2 %or %record (var 3 fm) var 3)
typedef struct VARIANTFM VARIANTFM;
struct VARIANTFM {
   VAR1FM VAR1;
   VAR2FM VAR2;
   VAR3FM VAR3;
};
                                                                //    388  %recordformat Rec Type fm (%record (Rec Type fm) %name Ptr Comp,
typedef struct RECTYPEFM RECTYPEFM;
struct RECTYPEFM {
   RECTYPEFM /*name*/*PTRCOMP;
  int DISCR;
   VARIANTFM VARIANT;
};
                                                                //    389                             %integer {Enumeration} Discr,
                                                                //    390                             %record (variant fm) variant)
                                                                //    391  
                                                                //    392  %external %record (Rec Type fm) %spec        Rec Type
extern  RECTYPEFM RECTYPE;
                                                                //    393  %external %record (Rec Type fm) %name %spec  Rec Pointer;
extern  RECTYPEFM /*name*/*RECPOINTER;
                                                                //    394  
                                                                //    395  %endoffile
                                                                //     30  
                                                                //     31  %external %integer %spec        Int Glob
extern int INTGLOB;
                                                                //     32  %external %byte %integer %spec  Ch 1 Glob
extern unsigned char CH1GLOB;
                                                                //     33  
                                                                //     34  
                                                                //     35  %external %routine Proc 6 (%integer {Enumeration} Enum Val Par, %integer {Enumeration} %name Enum Ref Par)
void PROC6( int ENUMVALPAR, int /*name*/*ENUMREFPAR )
{
  __label__ _imp_endofblock;
                                                                //     36  {*******************************}
                                                                //     37      { executed once }
                                                                //     38      { Enum Val Par == Ident 3, Enum Ref Par becomes Ident 2 }
                                                                //     39    %switch EV(Ident 1:Ident 5)
static int sw1_EV_idx;
static const void * /*SWITCH*/ sw1_EV[5] = { &&sw1_EV_0, &&sw1_EV_1, &&sw1_EV_2, &&sw1_EV_3, &&sw1_EV_4,  };
                                                                //     40    
                                                                //     41    Enum Ref Par = Enum Val Par
*ENUMREFPAR = ENUMVALPAR;
                                                                //     42    Enum Ref Par = Ident 4 %if %not Func 3 (Enum Val Par)    { then, not executed }
if (FUNC3(ENUMVALPAR)) goto L_0002;
*ENUMREFPAR = 3;
L_0002:;
                                                                //     43  
                                                                //     44    ->EV(Enum Val Par)
sw1_EV_idx = ENUMVALPAR; goto *sw1_EV[sw1_EV_idx]; 
                                                                //     45    
                                                                //     46      EV(Ident 1): 
sw1_EV_0:;
                                                                //     47        Enum Ref Par = Ident 1
*ENUMREFPAR = 0;
                                                                //     48        ->end
goto U_1000;
                                                                //     49        
                                                                //     50      EV(Ident 2): 
sw1_EV_1:;
                                                                //     51        %if Int Glob > 100 %then Enum Ref Par = Ident 1 %c
if (((INTGLOB) <= (100))) goto L_0003;
*ENUMREFPAR = 0;
goto L_0004;
L_0003:;
*ENUMREFPAR = 3;
L_0004:;
                                                                //     52        %else Enum Ref Par = Ident 4
                                                                //     53        ->end
goto U_1000;
                                                                //     54        
                                                                //     55      EV(Ident 3): { executed }
sw1_EV_2:;
                                                                //     56        Enum Ref Par = Ident 2
*ENUMREFPAR = 1;
                                                                //     57        ->end
goto U_1000;
                                                                //     58        
                                                                //     59      EV(Ident 4): ->end
sw1_EV_3:;
goto U_1000;
                                                                //     60      
                                                                //     61      EV(Ident 5): 
sw1_EV_4:;
                                                                //     62        Enum Ref Par = Ident 3
*ENUMREFPAR = 2;
                                                                //     63        ->end
goto U_1000;
                                                                //     64  
                                                                //     65    end: { switch }
U_1000:;
                                                                //     66  %end { Proc 6 }
return;
_imp_endofblock: ;
} // End of block PROC6 at level 1
                                                                //     67  
                                                                //     68  
                                                                //     69  %external %routine Proc 7 (%integer {One Fifty} Int 1 Par Val,
void PROC7( int INT1PARVAL, int INT2PARVAL, int /*name*/*INTPARREF )
{
  __label__ _imp_endofblock;
                                                                //     70                             %integer {One Fifty} Int 2 Par Val,
                                                                //     71                             %integer {One Fifty} %name Int Par Ref)
                                                                //     72  {********************************************}
                                                                //     73      { executed three times                                      } 
                                                                //     74      { first call:      Int 1 Par Val == 2, Int 2 Par Val == 3,  }
                                                                //     75      {                  Int Par Ref becomes 7                    }
                                                                //     76      { second call:     Int 1 Par Val == 10, Int 2 Par Val == 5, }
                                                                //     77      {                  Int Par Ref becomes 17                   }
                                                                //     78      { third call:      Int 1 Par Val == 6, Int 2 Par Val == 10, }
                                                                //     79      {                  Int Par Ref becomes 18                   }
                                                                //     80    %integer {One Fifty} Int Loc
int INTLOC;
                                                                //     81  
                                                                //     82    Int Loc = Int 1 Par Val + 2
INTLOC = (((int)INT1PARVAL) + (2));
                                                                //     83    Int Par Ref = Int 2 Par Val + Int Loc
*INTPARREF = (((int)INT2PARVAL) + (INTLOC));
                                                                //     84  %end { Proc 7 }
return;
_imp_endofblock: ;
} // End of block PROC7 at level 1
                                                                //     85  
                                                                //     86  
                                                                //     87  %external %routine Proc 8 (%integer %array %name Arr 1 Par Ref {(0:49)},
void PROC8( int /*arrayname*/*ARR1PARREF, int /*arrayname*/*ARR2PARREF, int INT1PARVAL, int INT2PARVAL )
{
  __label__ _imp_endofblock;
                                                                //     88                             %integer %array %name Arr 2 Par Ref {(0:50*50-1)} {(0:49, 0:49)},
                                                                //     89                             %integer Int 1 Par Val,
                                                                //     90                             %integer Int 2 Par Val)
                                                                //     91  {*******************************************************************}
                                                                //     92      { executed once      }
                                                                //     93      { Int Par Val 1 == 3 }
                                                                //     94      { Int Par Val 2 == 7 }
                                                                //     95    %integer {One Fifty} Int Index
int INTINDEX;
                                                                //     96    %integer {One Fifty} Int Loc
int INTLOC;
                                                                //     97  
                                                                //     98    Int Loc = Int 1 Par Val + 5
INTLOC = (((int)INT1PARVAL) + (5));
                                                                //     99    Arr 1 Par Ref (Int Loc) = Int 2 Par Val
ARR1PARREF[INTLOC] = INT2PARVAL;
                                                                //    100    Arr 1 Par Ref (Int Loc+1) = Arr 1 Par Ref (Int Loc)
ARR1PARREF[(((int)INTLOC) + (1))] = ARR1PARREF[INTLOC];
                                                                //    101    Arr 1 Par Ref (Int Loc+30) = Int Loc
ARR1PARREF[(((int)INTLOC) + (30))] = INTLOC;
                                                                //    102    Arr 2 Par Ref (Int Loc*50 + Int Index) {(Int Loc, Int Index)} = Int Loc %for Int Index = Int Loc, 1, Int Loc+1
{static int _initial, _increment, _final, _control;
_initial = INTLOC; _increment = 1; _final = (((int)INTLOC) + (1)); INTINDEX = _control = _initial;
if (((_final-_initial) % _increment) != 0) _imp_signal(5,1,0,"Illegal cycle INTINDEX = INTLOC, 1, (((int)INTLOC) + (1))");
INTINDEX -= _increment; _control -= _increment;
L_0005:;
if (INTINDEX == _final) goto L_0006;
INTINDEX += _increment; _control += _increment;
if (INTINDEX != _control) _imp_signal(4,2,0,"Corrupt control variable INTINDEX"); /* FOR loop control variable corrupted */
}
ARR2PARREF[(((int)((((int)INTLOC) * (50)))) + (INTINDEX))] = INTLOC;
goto L_0005;
L_0006:;
                                                                //    103    Arr 2 Par Ref (Int Loc*50 + Int Loc-1) {(Int Loc, Int Loc-1)} = Arr 2 Par Ref (Int Loc*50 + Int Loc-1){(Int Loc, Int Loc-1)} + 1
ARR2PARREF[(((int)((((int)((((int)INTLOC) * (50)))) + (INTLOC)))) - (1))] = (((int *)ARR2PARREF[(((int)((((int)((((int)INTLOC) * (50)))) + (INTLOC)))) - (1))]) + (1));
                                                                //    104    Arr 2 Par Ref ((Int Loc+20)*50 + Int Loc) {(Int Loc+20, Int Loc)} = Arr 1 Par Ref (Int Loc)
ARR2PARREF[(((int)((((int)((((int)INTLOC) + (20)))) * (50)))) + (INTLOC))] = ARR1PARREF[INTLOC];
                                                                //    105    Int Glob = 5
INTGLOB = 5;
                                                                //    106  %end { Proc 8 }
return;
_imp_endofblock: ;
} // End of block PROC8 at level 1
                                                                //    107  
                                                                //    108  
                                                                //    109  %external %integer {Enumeration} %fn Func 1 (%integer {Capital Letter} Ch 1 Par Val,
int FUNC1( int CH1PARVAL, int CH2PARVAL )
{
  __label__ _imp_endofblock;
                                                                //    110                                               %integer {Capital Letter} Ch 2 Par Val)
                                                                //    111  {***********************************************}
                                                                //    112      { executed three times                                         }
                                                                //    113      { first call:      Ch 1 Par Val == 'H', Ch 2 Par Val == 'R'    }
                                                                //    114      { second call:     Ch 1 Par Val == 'A', Ch 2 Par Val == 'C'    }
                                                                //    115      { third call:      Ch 1 Par Val == 'B', Ch 2 Par Val == 'C'    }
                                                                //    116  
                                                                //    117    %integer {Capital Letter}        Ch 1 Loc
int CH1LOC;
                                                                //    118    %integer {Capital Letter}        Ch 2 Loc
int CH2LOC;
                                                                //    119  
                                                                //    120    Ch 1 Loc = Ch 1 Par Val
CH1LOC = CH1PARVAL;
                                                                //    121    Ch 2 Loc = Ch 1 Loc
CH2LOC = CH1LOC;
                                                                //    122    %if Ch 2 Loc # Ch 2 Par Val %start
if (((CH2LOC) == (CH2PARVAL))) goto L_0008;
                                                                //    123      { then, executed }
                                                                //    124      %result = Ident 1
return 0;
                                                                //    125    %else  { not executed }
L_0008:;
                                                                //    126      Ch 1 Glob = Ch 1 Loc
CH1GLOB = CH1LOC;
                                                                //    127      %result = Ident 2
return 1;
                                                                //    128    %finish
                                                                //    129  %end { Func 1 }
_imp_endofblock: ;
} // End of block FUNC1 at level 1
                                                                //    130  
                                                                //    131  
                                                                //    132  %external %predicate Func 2 (%string (30) %name Str 1 Par Ref, %string (30) %name Str 2 Par Ref)
int /*Boolean*/ FUNC2( _imp_string /*%string(30)*/ /*name*/*STR1PARREF, _imp_string /*%string(30)*/ /*name*/*STR2PARREF )
{
  __label__ _imp_endofblock;
                                                                //    133  {***********************************************}
                                                                //    134      { executed once }
                                                                //    135      { Str 1 Par Ref == "DHRYSTONE PROGRAM, 1'ST STRING" }
                                                                //    136      { Str 2 Par Ref == "DHRYSTONE PROGRAM, 2'ND STRING" }
                                                                //    137  
                                                                //    138    %integer {One Thirty}        Int Loc
int INTLOC;
                                                                //    139    %integer {Capital Letter}    Ch Loc
int CHLOC;
                                                                //    140  
                                                                //    141    Int Loc = 2
INTLOC = 2;
                                                                //    142    %while Int Loc <= 2 %cycle { loop body executed once }
L_0009:;
if (((INTLOC) > (2))) goto L_000a;
                                                                //    143      %if Func 1 (CHARNO(Str 1 Par Ref, Int Loc),
if (((FUNC1(*_imp_CHARNO(STR1PARREF, INTLOC), *_imp_CHARNO(STR2PARREF, (((int)INTLOC) + (1))))) != (0))) goto L_000c;
                                                                //    144                  CHARNO(Str 2 Par Ref, Int Loc+1)) = Ident 1 %start { then, executed }
                                                                //    145        Ch Loc = 'A'
CHLOC = 65;
                                                                //    146        Int Loc = Int Loc + 1
INTLOC = (((int)INTLOC) + (1));
                                                                //    147      %finish { if }
L_000c:;
                                                                //    148    %repeat { while }
goto L_0009;
L_000a:;
                                                                //    149    Int Loc = 7 %if 'W' <= Ch Loc < 'Z'    { then, not executed }
if ((((87) > (CHLOC))) || (((CHLOC) >= (90)))) goto L_000d;
INTLOC = 7;
L_000d:;
                                                                //    150      
                                                                //    151    %true %if Ch Loc = 'R'                 { then, not executed }
if (((CHLOC) != (82))) goto L_000e;
return 1;
L_000e:;
                                                                //    152  
                                                                //    153    { else executed }
                                                                //    154    %if Str 1 Par Ref > Str 2 Par Ref %start
if ((_imp_strcmp(*STR1PARREF, *STR2PARREF) <= 0)) goto L_000f;
                                                                //    155      { then, not executed }
                                                                //    156      Int Loc  = Int Loc + 7
INTLOC = (((int)INTLOC) + (7));
                                                                //    157      Int Glob = Int Loc
INTGLOB = INTLOC;
                                                                //    158      %true
return 1;
                                                                //    159    %finish %else %false { executed }
L_000f:;
return 0;
                                                                //    160    { if Ch Loc }
                                                                //    161  %end { Func 2 }
_imp_endofblock: ;
} // End of block FUNC2 at level 1
                                                                //    162  
                                                                //    163  
                                                                //    164  %external %predicate Func 3 (%integer {Enumeration} Enum Par Val)
int /*Boolean*/ FUNC3( int ENUMPARVAL )
{
  __label__ _imp_endofblock;
                                                                //    165  {*************************}
                                                                //    166      { executed once        }
                                                                //    167      { Enum Par Val == Ident 3 }
                                                                //    168    %integer {Enumeration} Enum Loc
int ENUMLOC;
                                                                //    169    Enum Loc = Enum Par Val
ENUMLOC = ENUMPARVAL;
                                                                //    170    %true %if Enum Loc = Ident 3     { then, executed }
if (((ENUMLOC) != (2))) goto L_0010;
return 1;
L_0010:;
                                                                //    171    %false                           { not executed }
return 0;
                                                                //    172  %end { Func 3 }
_imp_endofblock: ;
} // End of block FUNC3 at level 1
                                                                //    173  
                                                                //    174  %end %of %file
// End of file
// COMPILE WITH: gcc12 -DVALGRIND_AVAILABLE -DPARM_OPT -UPARM_UNASS -O -g -ftrivial-auto-var-init=pattern -fmerge-constants -fno-strict-aliasing -Wall -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-unused-function -Wno-maybe-uninitialized -Wno-uninitialized -frecord-gcc-switches -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize-undefined-trap-on-error -fsanitize=float-cast-overflow -fno-sanitize-recover=all -fstack-protector -Wno-frame-address -fno-omit-frame-pointer -Wno-return-type -Wno-comment -ftrapv -ggdb3 -gdwarf-4 -I. -I.. -c -o dhrystone/dhry_2.o dhrystone/dhry_2.c -lm
