1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /**
18  * AOSP JFuzz Tester.
19  * Automatically generated program.
20  * jfuzz -s 3674365851 -d 1 -l 8 -i 2 -n 3 (version 1.3)
21  */
22 
23 import java.util.Arrays;
24 
25 @SuppressWarnings("deprecation")
26 public class Test {
27 
28   private interface X {
x()29     int x();
30   }
31 
32   private class A {
a()33     public int a() {
34       return (mI--);
35     }
36   }
37 
38   private class B extends A implements X {
a()39     public int a() {
40       return super.a() + ((235022827 >> mI) & 574409782);
41     }
x()42     public int x() {
43       return ((mZ) ? mI : ((Math.addExact(852067216, 246625693)) % mI));
44     }
45   }
46 
47   private static class C implements X {
s()48     public static int s() {
49       return 1878004320;
50     }
c()51     public int c() {
52       return -618864356;
53     }
x()54     public int x() {
55       return -556993081;
56     }
57   }
58 
59   private A mA  = new B();
60   private B mB  = new B();
61   private X mBX = new B();
62   private C mC  = new C();
63   private X mCX = new C();
64 
65   private boolean mZ = false;
66   private int     mI = 0;
67   private long    mJ = 0;
68   private float   mF = 0;
69   private double  mD = 0;
70 
71   private float[][][][][][][] mArray = new float[2][2][2][2][2][2][2];
72 
Test()73   private Test() {
74     float a = -774156645.0f;
75     for (int i0 = 0; i0 < 2; i0++) {
76       for (int i1 = 0; i1 < 2; i1++) {
77         for (int i2 = 0; i2 < 2; i2++) {
78           for (int i3 = 0; i3 < 2; i3++) {
79             for (int i4 = 0; i4 < 2; i4++) {
80               for (int i5 = 0; i5 < 2; i5++) {
81                 for (int i6 = 0; i6 < 2; i6++) {
82                   mArray[i0][i1][i2][i3][i4][i5][i6] = a;
83                   a++;
84                 }
85               }
86             }
87           }
88         }
89       }
90     }
91   }
92 
testMethod()93   private float testMethod() {
94     {
95       long lJ0 = (Long.MIN_VALUE);
96       if (((boolean) new Boolean(mZ))) {
97         lJ0 |= ((-609721394L | -601487228L) + (--mJ));
98         for (int i0 = mArray.length - 1; i0 >= 0; i0--) {
99           mF = ((float) new Float(921021787.0f));
100           mZ ^= ((mZ ? (mZ) : (Boolean.logicalXor((Boolean.logicalAnd(mZ, mZ)), mZ))) ^ true);
101           for (int i1 = 2 - 1; i1 >= 0; i1--) {
102             {
103               int i2 = -1;              while (++i2 < mArray.length) {
104                 mI = ((int) new Integer(((int) mD)));
105                 mI <<= (mI++);
106                 mZ = ((boolean) new Boolean(true));
107                 mJ >>= (- (~ (lJ0++)));
108               }
109             }
110           }
111           mI >>= (Integer.MIN_VALUE);
112         }
113         mD *= (mC.x());
114         mI *= (Math.multiplyExact(61363273, (-1448306837 | mI)));
115       } else {
116         mZ = (mZ);
117         for (int i0 = 0; i0 < 2; i0++) {
118           for (int i1 = 2 - 1; i1 >= 0; i1--) {
119             mArray[i0][i1][mArray.length - 1][i0][i1][1][i1] *= ((! mZ) ? -1041059197.0f : (mF / -1370212878.0f));
120             lJ0 += (~ mJ);
121             for (int i2 = 2 - 1; i2 >= 0; i2--) {
122               {
123                 int i3 = -1;                while (++i3 < 2) {
124                   return ((mZ) ? ((float) new Float((--mF))) : (++mF));
125                 }
126               }
127               mI = (--mI);
128             }
129             mJ &= (--lJ0);
130           }
131           if (((mZ) ^ false)) {
132             mI >>>= (mC.c());
133           } else {
134             if (((+ (Long.reverseBytes(mJ))) >= 1517367973L)) {
135               mI <<= (mI--);
136             } else {
137               {
138                 int i1 = 0;                do {
139                   mZ |= (true && true);
140                   if ((Boolean.logicalAnd(mZ, (! true)))) {
141                     mI %= ((mI ^ mI) ^ mI);
142                   } else {
143                     mI = (mI << mI);
144                   }
145                 } while (++i1 < 2);
146               }
147             }
148           }
149         }
150         switch (mArray.length - 1) {
151           case 1: {
152             mF *= (-1336843462.0f - ((804606312.0f * 1709271074.0f) - (Float.MIN_NORMAL)));
153             break;
154           }
155           default: {
156             mF /= (mF--);
157             break;
158           }
159         }
160       }
161       lJ0 >>>= (lJ0 | mJ);
162     }
163     mJ %= ( (-1288553765 ^ mI));
164     return (--mArray[1][0][1][1][0][1][0]);
165   }
166 
main(String[] args)167   public static void main(String[] args) {
168     Test t = new Test();
169     float r = -985685074.0f;
170     try {
171       r = t.testMethod();
172     } catch (Exception e) {
173       // Arithmetic, null pointer, index out of bounds, etc.
174       System.out.println("An exception was caught.");
175     }
176     System.out.println("r  = " + r);
177     System.out.println("mZ = " + t.mZ);
178     System.out.println("mI = " + t.mI);
179     System.out.println("mJ = " + t.mJ);
180     System.out.println("mF = " + t.mF);
181     System.out.println("mD = " + t.mD);
182     System.out.println("mArray = " + Arrays.deepToString(t.mArray));
183   }
184 }
185 
186