1 /*
2 ****************************************************************************
3 *
4 * "DHRYSTONE" Benchmark Program
5 * -----------------------------
6 *
7 * Version: C, Version 2.1
8 *
9 * File: dhry_2.c (part 3 of 3)
10 *
11 * Date: May 17, 1988
12 *
13 * Author: Reinhold P. Weicker
14 *
15 ****************************************************************************
16 */
17
18 #include "dhry.h"
19
20 #ifndef REG
21 #define REG
22 /* REG becomes defined as empty */
23 /* i.e. no register variables */
24 #endif
25
26 extern int Int_Glob;
27 extern char Ch_1_Glob;
28
29
Proc_6(Enum_Val_Par,Enum_Ref_Par)30 Proc_6 (Enum_Val_Par, Enum_Ref_Par)
31 /*********************************/
32 /* executed once */
33 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
34
35 Enumeration Enum_Val_Par;
36 Enumeration *Enum_Ref_Par;
37 {
38 *Enum_Ref_Par = Enum_Val_Par;
39 if (! Func_3 (Enum_Val_Par))
40 /* then, not executed */
41 *Enum_Ref_Par = Ident_4;
42 switch (Enum_Val_Par)
43 {
44 case Ident_1:
45 *Enum_Ref_Par = Ident_1;
46 break;
47 case Ident_2:
48 if (Int_Glob > 100)
49 /* then */
50 *Enum_Ref_Par = Ident_1;
51 else *Enum_Ref_Par = Ident_4;
52 break;
53 case Ident_3: /* executed */
54 *Enum_Ref_Par = Ident_2;
55 break;
56 case Ident_4: break;
57 case Ident_5:
58 *Enum_Ref_Par = Ident_3;
59 break;
60 } /* switch */
61 return 0; } /* Proc_6 */
62
63
Proc_7(Int_1_Par_Val,Int_2_Par_Val,Int_Par_Ref)64 Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
65 /**********************************************/
66 /* executed three times */
67 /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
68 /* Int_Par_Ref becomes 7 */
69 /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
70 /* Int_Par_Ref becomes 17 */
71 /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
72 /* Int_Par_Ref becomes 18 */
73 One_Fifty Int_1_Par_Val;
74 One_Fifty Int_2_Par_Val;
75 One_Fifty *Int_Par_Ref;
76 {
77 One_Fifty Int_Loc;
78
79 Int_Loc = Int_1_Par_Val + 2;
80 *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
81 return 0; } /* Proc_7 */
82
83
Proc_8(Arr_1_Par_Ref,Arr_2_Par_Ref,Int_1_Par_Val,Int_2_Par_Val)84 Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
85 /*********************************************************************/
86 /* executed once */
87 /* Int_Par_Val_1 == 3 */
88 /* Int_Par_Val_2 == 7 */
89 Arr_1_Dim Arr_1_Par_Ref;
90 Arr_2_Dim Arr_2_Par_Ref;
91 int Int_1_Par_Val;
92 int Int_2_Par_Val;
93 {
94 REG One_Fifty Int_Index;
95 REG One_Fifty Int_Loc;
96
97 Int_Loc = Int_1_Par_Val + 5;
98 Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
99 Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
100 Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
101 for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
102 Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
103 Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
104 Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
105 Int_Glob = 5;
106 return 0; } /* Proc_8 */
107
108
Func_1(Ch_1_Par_Val,Ch_2_Par_Val)109 Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val)
110 /*************************************************/
111 /* executed three times */
112 /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
113 /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
114 /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
115
116 Capital_Letter Ch_1_Par_Val;
117 Capital_Letter Ch_2_Par_Val;
118 {
119 Capital_Letter Ch_1_Loc;
120 Capital_Letter Ch_2_Loc;
121
122 Ch_1_Loc = Ch_1_Par_Val;
123 Ch_2_Loc = Ch_1_Loc;
124 if (Ch_2_Loc != Ch_2_Par_Val)
125 /* then, executed */
126 return (Ident_1);
127 else /* not executed */
128 {
129 Ch_1_Glob = Ch_1_Loc;
130 return (Ident_2);
131 }
132 } /* Func_1 */
133
134
Func_2(Str_1_Par_Ref,Str_2_Par_Ref)135 Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
136 /*************************************************/
137 /* executed once */
138 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
139 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
140
141 Str_30 Str_1_Par_Ref;
142 Str_30 Str_2_Par_Ref;
143 {
144 REG One_Thirty Int_Loc;
145 Capital_Letter Ch_Loc;
146
147 Int_Loc = 2;
148 while (Int_Loc <= 2) /* loop body executed once */
149 if (Func_1 (Str_1_Par_Ref[Int_Loc],
150 Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
151 /* then, executed */
152 {
153 Ch_Loc = 'A';
154 Int_Loc += 1;
155 } /* if, while */
156 if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
157 /* then, not executed */
158 Int_Loc = 7;
159 if (Ch_Loc == 'R')
160 /* then, not executed */
161 return (true);
162 else /* executed */
163 {
164 if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
165 /* then, not executed */
166 {
167 Int_Loc += 7;
168 Int_Glob = Int_Loc;
169 return (true);
170 }
171 else /* executed */
172 return (false);
173 } /* if Ch_Loc */
174 } /* Func_2 */
175
176
Func_3(Enum_Par_Val)177 Boolean Func_3 (Enum_Par_Val)
178 /***************************/
179 /* executed once */
180 /* Enum_Par_Val == Ident_3 */
181 Enumeration Enum_Par_Val;
182 {
183 Enumeration Enum_Loc;
184
185 Enum_Loc = Enum_Par_Val;
186 if (Enum_Loc == Ident_3)
187 /* then, executed */
188 return (true);
189 else /* not executed */
190 return (false);
191 } /* Func_3 */
192
193