#include <perms.h>
extern void PROC6(int ENUMVALPAR, int *ENUMREFPAR);
extern void PROC7(int INT1PARVAL, int INT2PARVAL, int *INTPARREF);
extern void PROC8(int *ARR1PARREF, int *ARR2PARREF, int INT1PARVAL, int INT2PARVAL);
extern int FUNC1(int CH1PARVAL, int CH2PARVAL);
extern int FUNC2(_imp_string30 *STR1PARREF, _imp_string30 *STR2PARREF);
extern int FUNC3(int ENUMPARVAL);
// Edinburgh IMP77 Compiler - Version 8.4
//
// 1 %external %routine %spec Proc 6 (%integer {Enumeration} Enum Val Par, %integer {Enumeration} %name Enum Ref Par)
// 2 %external %routine %spec Proc 7 (%integer {One Fifty} Int 1 Par Val,
// 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)},
// 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,
// 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)
// 12 %external %predicate %spec Func 3 (%integer {Enumeration} Enum Par Val)
// 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)
// &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
// 30
// 31 %external %integer %spec Int Glob
// 32 %external %byte %integer %spec Ch 1 Glob
// 33
// 34
// 35 %external %routine Proc 6 (%integer {Enumeration} Enum Val Par, %integer {Enumeration} %name Enum Ref Par)
// 36 {*******************************}
// 37 { executed once }
// 38 { Enum Val Par == Ident 3, Enum Ref Par becomes Ident 2 }
// 39 %switch EV(Ident 1:Ident 5)
// 40
// 41 Enum Ref Par = Enum Val Par
// 42 Enum Ref Par = Ident 4 %if %not Func 3 (Enum Val Par) { then, not executed }
// 43
// 44 ->EV(Enum Val Par)
// 45
// 46 EV(Ident 1):
// 47 Enum Ref Par = Ident 1
// 48 ->end
// 49
// 50 EV(Ident 2):
// 51 %if Int Glob > 100 %then Enum Ref Par = Ident 1 %c
// 52+ %else Enum Ref Par = Ident 4
// 53 ->end
// 54
// 55 EV(Ident 3): { executed }
// 56 Enum Ref Par = Ident 2
// 57 ->end
// 58
// 59 EV(Ident 4): ->end
// 60
// 61 EV(Ident 5):
// 62 Enum Ref Par = Ident 3
// 63 ->end
// 64
// 65 end: { switch }
// 66 %end { Proc 6 }
// 67
// 68
// 69 %external %routine Proc 7 (%integer {One Fifty} Int 1 Par Val,
// 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
// 81
// 82 Int Loc = Int 1 Par Val + 2
// 83 Int Par Ref = Int 2 Par Val + Int Loc
// 84 %end { Proc 7 }
// 85
// 86
// 87 %external %routine Proc 8 (%integer %array %name Arr 1 Par Ref {(0:49)},
// 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
// 96 %integer {One Fifty} Int Loc
// 97
// 98 Int Loc = Int 1 Par Val + 5
// 99 Arr 1 Par Ref (Int Loc) = Int 2 Par Val
// 100 Arr 1 Par Ref (Int Loc+1) = Arr 1 Par Ref (Int Loc)
// 101 Arr 1 Par Ref (Int Loc+30) = Int Loc
// 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
// 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
// 104 Arr 2 Par Ref ((Int Loc+20)*50 + Int Loc) {(Int Loc+20, Int Loc)} = Arr 1 Par Ref (Int Loc)
// 105 Int Glob = 5
// 106 %end { Proc 8 }
// 107
// 108
// 109 %external %integer {Enumeration} %fn Func 1 (%integer {Capital Letter} Ch 1 Par Val,
// 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
// 118 %integer {Capital Letter} Ch 2 Loc
// 119
// 120 Ch 1 Loc = Ch 1 Par Val
// 121 Ch 2 Loc = Ch 1 Loc
// 122 %if Ch 2 Loc # Ch 2 Par Val %start
// 123 { then, executed }
// 124 %result = Ident 1
// 125 %else { not executed }
// 126 Ch 1 Glob = Ch 1 Loc
// 127 %result = Ident 2
// 128 %finish
// 129 %end { Func 1 }
// 130
// 131
// 132 %external %predicate Func 2 (%string (30) %name Str 1 Par Ref, %string (30) %name Str 2 Par Ref)
// 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
// 139 %integer {Capital Letter} Ch Loc
// 140
// 141 Int Loc = 2
// 142 %while Int Loc <= 2 %cycle { loop body executed once }
// 143 %if Func 1 (CHARNO(Str 1 Par Ref, Int Loc),
// 144+ CHARNO(Str 2 Par Ref, Int Loc+1)) = Ident 1 %start { then, executed }
// 145 Ch Loc = 'A'
// 146 Int Loc = Int Loc + 1
// 147 %finish { if }
// 148 %repeat { while }
// 149 Int Loc = 7 %if 'W' <= Ch Loc < 'Z' { then, not executed }
// 150
// 151 %true %if Ch Loc = 'R' { then, not executed }
// 152
// 153 { else executed }
// 154 %if Str 1 Par Ref > Str 2 Par Ref %start
// 155 { then, not executed }
// 156 Int Loc = Int Loc + 7
// 157 Int Glob = Int Loc
// 158 %true
// 159 %finish %else %false { executed }
// 160 { if Ch Loc }
// 161 %end { Func 2 }
// 162
// 163
// 164 %external %predicate Func 3 (%integer {Enumeration} Enum Par Val)
// 165 {*************************}
// 166 { executed once }
// 167 { Enum Par Val == Ident 3 }
// 168 %integer {Enumeration} Enum Loc
// 169 Enum Loc = Enum Par Val
// 170 %true %if Enum Loc = Ident 3 { then, executed }
// 171 %false { not executed }
// 172 %end { Func 3 }
// 173
// 174 %end %of %file
//
// 94 Statements compiled
struct VAR1FM {
union {
struct {
int ENUMCOMP;
int INTCOMP;
_imp_string30 STRCOMP;
};
};
};
struct VAR2FM {
union {
struct {
int ECOMP2;
_imp_string30 STR2COMP;
};
};
};
struct VAR3FM {
union {
struct {
unsigned char CH1COMP;
unsigned char CH2COMP;
};
};
};
struct VARIANTFM {
union {
struct {
struct VAR1FM VAR1;
};
struct {
struct VAR2FM VAR2;
};
struct {
struct VAR3FM VAR3;
};
};
};
struct RECTYPEFM {
union {
struct {
struct RECTYPEFM *PTRCOMP;
int DISCR;
struct VARIANTFM VARIANT;
};
};
};
extern struct RECTYPEFM RECTYPE;
extern struct RECTYPEFM *RECPOINTER;
extern int INTGLOB;
extern unsigned char CH1GLOB;
void PROC6(int ENUMVALPAR, int *ENUMREFPAR) {
int EV_index;
int EV_line;
char *EV_file;
static const void *EV[5] = {&&case_EV_missing, &&case_EV_missing, &&case_EV_missing, &&case_EV_missing,
&&case_EV_missing};
*ENUMREFPAR = ENUMVALPAR;
if (FUNC3(ENUMVALPAR)) goto L_0001;
*ENUMREFPAR = 3;
L_0001:;
EV_line = __LINE__;
EV_file = __FILE__;
EV_index = ENUMVALPAR;
goto case_EV_dispatch;
case_EV_0:;
*ENUMREFPAR = 0;
goto U_1000;
case_EV_1:;
if (INTGLOB <= 100) goto L_0003;
*ENUMREFPAR = 0;
goto L_0004;
L_0003:;
*ENUMREFPAR = 3;
L_0004:;
goto U_1000;
case_EV_2:;
*ENUMREFPAR = 1;
goto U_1000;
case_EV_3:;
goto U_1000;
case_EV_4:;
*ENUMREFPAR = 2;
goto U_1000;
U_1000:;
return;
case_EV_dispatch:
if (EV_index < 0 || EV_index > 4)
_imp_signalf(6, 3, EV_index, "->EV(%d) out of bounds at %s line %d", EV_index, EV_file, EV_line);
goto *EV[EV_index - 0];
case_EV_missing:
_imp_signalf(8, 2, EV_index, "switch jump to undefined label EV(%d): at %s line %d", EV_index, EV_file, EV_line);
} /* end of PROC6 */
void PROC7(int INT1PARVAL, int INT2PARVAL, int *INTPARREF) {
int INTLOC;
INTLOC = INT1PARVAL + 2;
*INTPARREF = INT2PARVAL + INTLOC;
return;
} /* end of PROC7 */
void PROC8(int *ARR1PARREF, int *ARR2PARREF, int INT1PARVAL, int INT2PARVAL) {
int INTINDEX;
int INTLOC;
INTLOC = INT1PARVAL + 5;
[/*BUG*/ 0] = INT2PARVAL;
[/*BUG*/ 0] = [/*BUG*/ 0];
[/*BUG*/ 0] = INTLOC;
// %for INTINDEX = INTLOC, 1, INTLOC + 1 %cycle
{
int _initial = INTLOC, _final = INTLOC + 1;
if (invalid_for_loop(_initial, 1, _final)) _imp_signal(5, 1, 0, "Illegal cycle INTINDEX = INTLOC, 1, INTLOC + 1");
INTINDEX = _initial - (1);
L_0005:
if (INTINDEX == _final) goto L_0006;
INTINDEX += 1;
[/*BUG*/ 0] = INTLOC;
goto L_0005;
}
L_0006:;
[/*BUG*/ 0] = [/*BUG*/ 0] + 1;
[/*BUG*/ 0] = [/*BUG*/ 0];
INTGLOB = 5;
return;
} /* end of PROC8 */
int FUNC1(int CH1PARVAL, int CH2PARVAL) {
int CH1LOC;
int CH2LOC;
CH1LOC = CH1PARVAL;
CH2LOC = CH1LOC;
if (CH2LOC == CH2PARVAL) goto L_0008;
return 0;
L_0008:;
CH1GLOB = CH1LOC;
return 1;
} /* end of FUNC1 */
int FUNC2(_imp_string30 *STR1PARREF, _imp_string30 *STR2PARREF) {
int INTLOC;
int CHLOC;
INTLOC = 2;
L_0009:;
if (INTLOC > 2) goto L_000A;
if (FUNC1(*_imp_CHARNO((_imp_string255 *)/*p*/ STR1PARREF, INTLOC),
*_imp_CHARNO((_imp_string255 *)/*p*/ STR2PARREF, INTLOC + 1)) != 0)
goto L_000B;
CHLOC = 65;
INTLOC = INTLOC + 1;
L_000B:;
goto L_0009;
L_000A:;
{
// Double-sided test on CHLOC (Part I)
int tmp;
if (87 > (tmp = CHLOC)) goto L_000C;
// Double-sided test on CHLOC (Part II)
if (tmp >= 90) goto L_000C;
}
INTLOC = 7;
L_000C:;
if (CHLOC != 82) goto L_000D;
return 1 /*TRUE*/;
L_000D:;
if (_imp_strcmp((_imp_string *)STR1PARREF, (_imp_string *)STR2PARREF) <= 0) goto L_000E;
INTLOC = INTLOC + 7;
INTGLOB = INTLOC;
return 1 /*TRUE*/;
L_000E:;
return 0 /*FALSE*/;
} /* end of FUNC2 */
int FUNC3(int ENUMPARVAL) {
int ENUMLOC;
ENUMLOC = ENUMPARVAL;
if (ENUMLOC != 2) goto L_000F;
return 1 /*TRUE*/;
L_000F:;
return 0 /*FALSE*/;
} /* end of FUNC3 */