2 * (C) Copyright 2015 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
6 * Dhrystone is widely available in the public domain. A GPL license is
10 /*****************************************************************************
11 * The BYTE UNIX Benchmarks - Release 3
12 * Module: dhry_2.c SID: 3.4 5/15/91 19:30:22
14 *****************************************************************************
15 * Bug reports, patches, comments, suggestions should be sent to:
17 * Ben Smith, Rick Grehan or Tom Yager
18 * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
20 *****************************************************************************
22 * 10/22/97 - code cleanup to remove ANSI C compiler warnings
23 * Andy Kahn <kahn@zk3.dec.com>
27 * "DHRYSTONE" Benchmark Program
28 * -----------------------------
30 * **** WARNING **** See warning in n.dhry_1.c
32 * Version: C, Version 2.1
34 * File: dhry_2.c (part 3 of 3)
38 * Author: Reinhold P. Weicker
40 ****************************************************************************/
41 /* SCCSid is defined in dhry_1.c */
48 /* REG becomes defined as empty */
49 /* i.e. no register variables */
53 extern char Ch_1_Glob;
55 void Proc_6(Enumeration, Enumeration *);
56 void Proc_7(One_Fifty, One_Fifty, One_Fifty *);
57 void Proc_8(Arr_1_Dim, Arr_2_Dim, int, int);
58 Enumeration Func_1(Capital_Letter, Capital_Letter);
59 Boolean Func_2(Str_30, Str_30);
60 Boolean Func_3(Enumeration);
62 void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
64 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
66 *Enum_Ref_Par = Enum_Val_Par;
67 if (! Func_3 (Enum_Val_Par))
68 /* then, not executed */
69 *Enum_Ref_Par = Ident_4;
73 *Enum_Ref_Par = Ident_1;
78 *Enum_Ref_Par = Ident_1;
79 else *Enum_Ref_Par = Ident_4;
81 case Ident_3: /* executed */
82 *Enum_Ref_Par = Ident_2;
86 *Enum_Ref_Par = Ident_3;
91 void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
92 One_Fifty Int_1_Par_Val;
93 One_Fifty Int_2_Par_Val;
94 One_Fifty *Int_Par_Ref;
95 /**********************************************/
96 /* executed three times */
97 /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
98 /* Int_Par_Ref becomes 7 */
99 /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
100 /* Int_Par_Ref becomes 17 */
101 /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
102 /* Int_Par_Ref becomes 18 */
106 Int_Loc = Int_1_Par_Val + 2;
107 *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
111 void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
112 /*********************************************************************/
114 /* Int_Par_Val_1 == 3 */
115 /* Int_Par_Val_2 == 7 */
116 Arr_1_Dim Arr_1_Par_Ref;
117 Arr_2_Dim Arr_2_Par_Ref;
121 REG One_Fifty Int_Index;
122 REG One_Fifty Int_Loc;
124 Int_Loc = Int_1_Par_Val + 5;
125 Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
126 Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
127 Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
128 for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
129 Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
130 Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
131 Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
136 Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
137 /*************************************************/
138 /* executed three times */
139 /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
140 /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
141 /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
143 Capital_Letter Ch_1_Loc;
144 Capital_Letter Ch_2_Loc;
146 Ch_1_Loc = Ch_1_Par_Val;
148 if (Ch_2_Loc != Ch_2_Par_Val)
151 else /* not executed */
153 Ch_1_Glob = Ch_1_Loc;
160 Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
161 /*************************************************/
163 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
164 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
166 Str_30 Str_1_Par_Ref;
167 Str_30 Str_2_Par_Ref;
169 REG One_Thirty Int_Loc;
170 Capital_Letter Ch_Loc;
174 while (Int_Loc <= 2) /* loop body executed once */
175 if (Func_1 (Str_1_Par_Ref[Int_Loc],
176 Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
182 if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
183 /* then, not executed */
186 /* then, not executed */
190 if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
191 /* then, not executed */
203 Boolean Func_3 (Enum_Par_Val)
204 /***************************/
206 /* Enum_Par_Val == Ident_3 */
207 Enumeration Enum_Par_Val;
209 Enumeration Enum_Loc;
211 Enum_Loc = Enum_Par_Val;
212 if (Enum_Loc == Ident_3)
215 else /* not executed */