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