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