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

source code of linux/lib/dhry_2.c