1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
3 ****************************************************************************
5 * "DHRYSTONE" Benchmark Program
6 * -----------------------------
8 * Version: C, Version 2.1
10 * File: dhry_2.c (part 3 of 3)
14 * Author: Reinhold P. Weicker
16 ****************************************************************************
21 #include <linux/string.h>
24 static Boolean
Func_3(Enumeration Enum_Par_Val
)
25 /***************************/
27 /* Enum_Par_Val == Ident_3 */
31 Enum_Loc
= Enum_Par_Val
;
32 if (Enum_Loc
== Ident_3
) {
42 void Proc_6(Enumeration Enum_Val_Par
, Enumeration
*Enum_Ref_Par
)
43 /*********************************/
45 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
47 *Enum_Ref_Par
= Enum_Val_Par
;
48 if (!Func_3(Enum_Val_Par
)) {
49 /* then, not executed */
50 *Enum_Ref_Par
= Ident_4
;
52 switch (Enum_Val_Par
) {
54 *Enum_Ref_Par
= Ident_1
;
59 *Enum_Ref_Par
= Ident_1
;
61 *Enum_Ref_Par
= Ident_4
;
64 case Ident_3
: /* executed */
65 *Enum_Ref_Par
= Ident_2
;
70 *Enum_Ref_Par
= Ident_3
;
76 void 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 */
88 Int_Loc
= Int_1_Par_Val
+ 2;
89 *Int_Par_Ref
= Int_2_Par_Val
+ Int_Loc
;
93 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
)
94 /*********************************************************************/
96 /* Int_Par_Val_1 == 3 */
97 /* Int_Par_Val_2 == 7 */
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
];
114 Enumeration
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' */
121 Capital_Letter Ch_1_Loc
;
122 Capital_Letter Ch_2_Loc
;
124 Ch_1_Loc
= Ch_1_Par_Val
;
126 if (Ch_2_Loc
!= Ch_2_Par_Val
) {
131 Ch_1_Glob
= Ch_1_Loc
;
137 Boolean
Func_2(Str_30 Str_1_Par_Ref
, Str_30 Str_2_Par_Ref
)
138 /*************************************************/
140 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
141 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
144 Capital_Letter Ch_Loc
;
147 while (Int_Loc
<= 2) {
148 /* loop body executed once */
149 if (Func_1(Str_1_Par_Ref
[Int_Loc
],
150 Str_2_Par_Ref
[Int_Loc
+1]) == Ident_1
) {
156 if (Ch_Loc
>= 'W' && Ch_Loc
< 'Z') {
157 /* then, not executed */
161 /* then, not executed */
165 if (strcmp(Str_1_Par_Ref
, Str_2_Par_Ref
) > 0) {
166 /* then, not executed */