1 /* PR tree-optimization/79389  */
2 /* { dg-do compile } */
3 /* { dg-options "-O3 -fdump-tree-split-paths-details" } */
4 
5 typedef struct
6 {
7   int m[17];
8   int seed;
9   int i;
10   int j;
11   int haveRange;
12   double left;
13   double right;
14   double width;
15 }
16 Random_struct, *Random;
17 
18 Random new_Random_seed(int seed);
19 double Random_nextDouble(Random R);
20 void Random_delete(Random R);
21 
22 static const int SEED = 113;
23 
MonteCarlo_integrate(int Num_samples)24 double MonteCarlo_integrate(int Num_samples)
25 {
26 
27 
28   Random R = new_Random_seed(SEED);
29 
30 
31   int under_curve = 0;
32   int count;
33 
34   for (count=0; count<Num_samples; count++)
35     {
36       double x= Random_nextDouble(R);
37       double y= Random_nextDouble(R);
38 
39       if ( x*x + y*y <= 1.0)
40 	under_curve ++;
41 
42     }
43 
44   Random_delete(R);
45 
46   return ((double) under_curve / Num_samples) * 4.0;
47 }
48 
49 /* { dg-final { scan-tree-dump-times "Duplicating join block" 0 "split-paths" } } */
50