2 *************************************************************************
4 * "DHRYSTONE" Benchmark Program
5 * -----------------------------
7 * Version: C, Version 2.1
9 * File: dhry_2.c (part 3 of 3)
13 * Author: Reinhold P. Weicker
15 *************************************************************************
22 /* REG becomes defined as empty */
23 /* i.e. no register variables */
29 extern char Ch_1_Glob
;
31 void Proc_6 (Enumeration
, Enumeration
*);
32 void Proc_7 (One_Fifty
, One_Fifty
, One_Fifty
*);
33 void Proc_8 (Arr_1_Dim
, Arr_2_Dim
, int, int);
34 Enumeration
Func_1 (Capital_Letter
, Capital_Letter
);
35 Boolean
Func_2 (Str_30
, Str_30
);
36 Boolean
Func_3 (Enumeration
);
39 void Proc_6 (Enumeration Enum_Val_Par
, Enumeration
*Enum_Ref_Par
)
40 /*********************************/
42 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
44 *Enum_Ref_Par
= Enum_Val_Par
;
45 if (! Func_3 (Enum_Val_Par
))
46 /* then, not executed */
47 *Enum_Ref_Par
= Ident_4
;
51 *Enum_Ref_Par
= Ident_1
;
56 *Enum_Ref_Par
= Ident_1
;
57 else *Enum_Ref_Par
= Ident_4
;
59 case Ident_3
: /* executed */
60 *Enum_Ref_Par
= Ident_2
;
64 *Enum_Ref_Par
= Ident_3
;
70 void Proc_7 (One_Fifty Int_1_Par_Val
, One_Fifty Int_2_Par_Val
, One_Fifty
*Int_Par_Ref
)
71 /**********************************************/
72 /* executed three times */
73 /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
74 /* Int_Par_Ref becomes 7 */
75 /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
76 /* Int_Par_Ref becomes 17 */
77 /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
78 /* Int_Par_Ref becomes 18 */
82 Int_Loc
= Int_1_Par_Val
+ 2;
83 *Int_Par_Ref
= Int_2_Par_Val
+ Int_Loc
;
87 void Proc_8 (Arr_1_Dim Arr_1_Par_Ref
, Arr_2_Dim Arr_2_Par_Ref
, int Int_1_Par_Val
, int Int_2_Par_Val
)
88 /*********************************************************************/
90 /* Int_Par_Val_1 == 3 */
91 /* Int_Par_Val_2 == 7 */
93 REG One_Fifty Int_Index
;
94 REG One_Fifty Int_Loc
;
96 Int_Loc
= Int_1_Par_Val
+ 5;
97 Arr_1_Par_Ref
[Int_Loc
] = Int_2_Par_Val
;
98 Arr_1_Par_Ref
[Int_Loc
+1] = Arr_1_Par_Ref
[Int_Loc
];
99 Arr_1_Par_Ref
[Int_Loc
+30] = Int_Loc
;
100 for (Int_Index
= Int_Loc
; Int_Index
<= Int_Loc
+1; ++Int_Index
)
101 Arr_2_Par_Ref
[Int_Loc
] [Int_Index
] = Int_Loc
;
102 Arr_2_Par_Ref
[Int_Loc
] [Int_Loc
-1] += 1;
103 Arr_2_Par_Ref
[Int_Loc
+20] [Int_Loc
] = Arr_1_Par_Ref
[Int_Loc
];
108 Enumeration
Func_1 (Capital_Letter Ch_1_Par_Val
, Capital_Letter Ch_2_Par_Val
)
109 /*************************************************/
110 /* executed three times */
111 /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
112 /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
113 /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
115 Capital_Letter Ch_1_Loc
;
116 Capital_Letter Ch_2_Loc
;
118 Ch_1_Loc
= Ch_1_Par_Val
;
120 if (Ch_2_Loc
!= Ch_2_Par_Val
)
123 else /* not executed */
125 Ch_1_Glob
= Ch_1_Loc
;
131 Boolean
Func_2 (Str_30 Str_1_Par_Ref
, Str_30 Str_2_Par_Ref
)
132 /*************************************************/
134 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
135 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
137 REG One_Thirty Int_Loc
;
138 Capital_Letter Ch_Loc
= 0;
141 while (Int_Loc
<= 2) /* loop body executed once */
142 if (Func_1 (Str_1_Par_Ref
[Int_Loc
],
143 Str_2_Par_Ref
[Int_Loc
+1]) == Ident_1
)
149 if (Ch_Loc
>= 'W' && Ch_Loc
< 'Z')
150 /* then, not executed */
153 /* then, not executed */
157 if (strcmp (Str_1_Par_Ref
, Str_2_Par_Ref
) > 0)
158 /* then, not executed */
170 Boolean
Func_3 (Enumeration Enum_Par_Val
)
171 /***************************/
173 /* Enum_Par_Val == Ident_3 */
175 Enumeration Enum_Loc
;
177 Enum_Loc
= Enum_Par_Val
;
178 if (Enum_Loc
== Ident_3
)
181 else /* not executed */