modified makefile to allow easier adjustment of build options for different targets...
[AROS-Contrib.git] / Misc / Bench / Dhrystone / dhry21b.c
blob53939be2057cf194e5efdbf9692b13d61d8f2424
1 /*
2 *************************************************************************
4 * "DHRYSTONE" Benchmark Program
5 * -----------------------------
7 * Version: C, Version 2.1
9 * File: dhry_2.c (part 3 of 3)
11 * Date: May 25, 1988
13 * Author: Reinhold P. Weicker
15 *************************************************************************
18 #include "dhry.h"
20 #ifndef REG
21 #define REG
22 /* REG becomes defined as empty */
23 /* i.e. no register variables */
24 #else
25 #define REG register
26 #endif
28 extern int Int_Glob;
29 extern char Ch_1_Glob;
31 void Proc_6 (Enumeration, Enumeration *);
32 void Proc_7 (One_Fifty, One_Fifty, One_Fifty *);
33 void Proc_8 (Arr_1_Dim, Arr_2_Dim, int, int);
34 Enumeration Func_1 (Capital_Letter, Capital_Letter);
35 Boolean Func_2 (Str_30, Str_30);
36 Boolean Func_3 (Enumeration);
39 void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
40 /*********************************/
41 /* executed once */
42 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
44 *Enum_Ref_Par = Enum_Val_Par;
45 if (! Func_3 (Enum_Val_Par))
46 /* then, not executed */
47 *Enum_Ref_Par = Ident_4;
48 switch (Enum_Val_Par)
50 case Ident_1:
51 *Enum_Ref_Par = Ident_1;
52 break;
53 case Ident_2:
54 if (Int_Glob > 100)
55 /* then */
56 *Enum_Ref_Par = Ident_1;
57 else *Enum_Ref_Par = Ident_4;
58 break;
59 case Ident_3: /* executed */
60 *Enum_Ref_Par = Ident_2;
61 break;
62 case Ident_4: break;
63 case Ident_5:
64 *Enum_Ref_Par = Ident_3;
65 break;
66 } /* switch */
67 } /* Proc_6 */
70 void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
71 /**********************************************/
72 /* executed three times */
73 /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
74 /* Int_Par_Ref becomes 7 */
75 /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
76 /* Int_Par_Ref becomes 17 */
77 /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
78 /* Int_Par_Ref becomes 18 */
80 One_Fifty Int_Loc;
82 Int_Loc = Int_1_Par_Val + 2;
83 *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
84 } /* Proc_7 */
87 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)
88 /*********************************************************************/
89 /* executed once */
90 /* Int_Par_Val_1 == 3 */
91 /* Int_Par_Val_2 == 7 */
93 REG One_Fifty Int_Index;
94 REG One_Fifty Int_Loc;
96 Int_Loc = Int_1_Par_Val + 5;
97 Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
98 Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
99 Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
100 for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
101 Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
102 Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
103 Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
104 Int_Glob = 5;
105 } /* Proc_8 */
108 Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
109 /*************************************************/
110 /* executed three times */
111 /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
112 /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
113 /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
115 Capital_Letter Ch_1_Loc;
116 Capital_Letter Ch_2_Loc;
118 Ch_1_Loc = Ch_1_Par_Val;
119 Ch_2_Loc = Ch_1_Loc;
120 if (Ch_2_Loc != Ch_2_Par_Val)
121 /* then, executed */
122 return (Ident_1);
123 else /* not executed */
125 Ch_1_Glob = Ch_1_Loc;
126 return (Ident_2);
128 } /* Func_1 */
131 Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref)
132 /*************************************************/
133 /* executed once */
134 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
135 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
137 REG One_Thirty Int_Loc;
138 Capital_Letter Ch_Loc = 0;
140 Int_Loc = 2;
141 while (Int_Loc <= 2) /* loop body executed once */
142 if (Func_1 (Str_1_Par_Ref[Int_Loc],
143 Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
144 /* then, executed */
146 Ch_Loc = 'A';
147 Int_Loc += 1;
148 } /* if, while */
149 if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
150 /* then, not executed */
151 Int_Loc = 7;
152 if (Ch_Loc == 'R')
153 /* then, not executed */
154 return (true);
155 else /* executed */
157 if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
158 /* then, not executed */
160 Int_Loc += 7;
161 Int_Glob = Int_Loc;
162 return (true);
164 else /* executed */
165 return (false);
166 } /* if Ch_Loc */
167 } /* Func_2 */
170 Boolean Func_3 (Enumeration Enum_Par_Val)
171 /***************************/
172 /* executed once */
173 /* Enum_Par_Val == Ident_3 */
175 Enumeration Enum_Loc;
177 Enum_Loc = Enum_Par_Val;
178 if (Enum_Loc == Ident_3)
179 /* then, executed */
180 return (true);
181 else /* not executed */
182 return (false);
183 } /* Func_3 */