import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Stack;

public class Class212 implements Runnable {

   int anInt2491;
   Thread aThread2492;
   InputStream anInputStream2493;
   byte[] aByteArray2494;
   int anInt2495 = 0;
   int anInt2496 = 0;
   IOException anIOException2497;


   public void run() {
      while(true) {
         int var2;
         synchronized(this) {
            while(true) {
               if(this.anIOException2497 != null) {
                  return;
               }

               if(0 == -521099933 * this.anInt2495) {
                  var2 = -339764179 * this.anInt2491 - this.anInt2496 * 1191990521 - 1;
               } else if(-521099933 * this.anInt2495 <= 1191990521 * this.anInt2496) {
                  var2 = this.anInt2491 * -339764179 - this.anInt2496 * 1191990521;
               } else {
                  var2 = -521099933 * this.anInt2495 - 1191990521 * this.anInt2496 - 1;
               }

               if(var2 > 0) {
                  break;
               }

               try {
                  this.wait();
               } catch (InterruptedException var9) {
                  ;
               }
            }
         }

         int var1;
         try {
            var1 = this.anInputStream2493.read(this.aByteArray2494, this.anInt2496 * 1191990521, var2);
            if(-1 == var1) {
               throw new EOFException();
            }
         } catch (IOException var10) {
            IOException var3 = var10;
            synchronized(this) {
               this.anIOException2497 = var3;
               return;
            }
         }

         synchronized(this) {
            this.anInt2496 = (var1 + 1191990521 * this.anInt2496) % (-339764179 * this.anInt2491) * 1709976905;
         }
      }
   }

   void method3623() {
      synchronized(this) {
         if(this.anIOException2497 == null) {
            this.anIOException2497 = new IOException("");
         }

         this.notifyAll();
      }

      try {
         this.aThread2492.join();
      } catch (InterruptedException var3) {
         ;
      }

   }

   boolean method3624(int var1, int var2) throws IOException {
      if(var1 > 0 && var1 < this.anInt2491 * -339764179) {
         synchronized(this) {
            int var4;
            if(this.anInt2495 * -521099933 <= this.anInt2496 * 1191990521) {
               var4 = this.anInt2496 * 1191990521 - -521099933 * this.anInt2495;
            } else {
               var4 = -339764179 * this.anInt2491 - this.anInt2495 * -521099933 + 1191990521 * this.anInt2496;
            }

            if(var4 < var1) {
               if(this.anIOException2497 != null) {
                  throw new IOException(this.anIOException2497.toString());
               } else {
                  this.notifyAll();
                  return false;
               }
            } else {
               return true;
            }
         }
      } else {
         throw new IOException();
      }
   }

   void method3625() {
      synchronized(this) {
         if(this.anIOException2497 == null) {
            this.anIOException2497 = new IOException("");
         }

         this.notifyAll();
      }

      try {
         this.aThread2492.join();
      } catch (InterruptedException var3) {
         ;
      }

   }

   int method3626(byte[] var1, int var2, int var3) throws IOException {
      if(var3 >= 0 && var2 >= 0 && var2 + var3 <= var1.length) {
         synchronized(this) {
            int var5;
            if(-521099933 * this.anInt2495 <= this.anInt2496 * 1191990521) {
               var5 = this.anInt2496 * 1191990521 - -521099933 * this.anInt2495;
            } else {
               var5 = 1191990521 * this.anInt2496 + (-339764179 * this.anInt2491 - this.anInt2495 * -521099933);
            }

            if(var3 > var5) {
               var3 = var5;
            }

            if(var3 == 0 && null != this.anIOException2497) {
               throw new IOException(this.anIOException2497.toString());
            } else {
               if(var3 + this.anInt2495 * -521099933 <= this.anInt2491 * -339764179) {
                  System.arraycopy(this.aByteArray2494, -521099933 * this.anInt2495, var1, var2, var3);
               } else {
                  int var6 = this.anInt2491 * -339764179 - this.anInt2495 * -521099933;
                  System.arraycopy(this.aByteArray2494, this.anInt2495 * -521099933, var1, var2, var6);
                  System.arraycopy(this.aByteArray2494, 0, var1, var6 + var2, var3 - var6);
               }

               this.anInt2495 = (-521099933 * this.anInt2495 + var3) % (this.anInt2491 * -339764179) * 512623691;
               this.notifyAll();
               return var3;
            }
         }
      } else {
         throw new IOException();
      }
   }

   void method3627(int var1) {
      synchronized(this) {
         if(this.anIOException2497 == null) {
            this.anIOException2497 = new IOException("");
         }

         this.notifyAll();
      }

      try {
         this.aThread2492.join();
      } catch (InterruptedException var4) {
         ;
      }

   }

   public void method3628() {
      while(true) {
         int var2;
         synchronized(this) {
            while(true) {
               if(this.anIOException2497 != null) {
                  return;
               }

               if(0 == -521099933 * this.anInt2495) {
                  var2 = -339764179 * this.anInt2491 - this.anInt2496 * 1191990521 - 1;
               } else if(-521099933 * this.anInt2495 <= 1191990521 * this.anInt2496) {
                  var2 = this.anInt2491 * -339764179 - this.anInt2496 * 1191990521;
               } else {
                  var2 = -521099933 * this.anInt2495 - 1191990521 * this.anInt2496 - 1;
               }

               if(var2 > 0) {
                  break;
               }

               try {
                  this.wait();
               } catch (InterruptedException var9) {
                  ;
               }
            }
         }

         int var1;
         try {
            var1 = this.anInputStream2493.read(this.aByteArray2494, this.anInt2496 * 1191990521, var2);
            if(-1 == var1) {
               throw new EOFException();
            }
         } catch (IOException var10) {
            IOException var3 = var10;
            synchronized(this) {
               this.anIOException2497 = var3;
               return;
            }
         }

         synchronized(this) {
            this.anInt2496 = (var1 + 1191990521 * this.anInt2496) % (-339764179 * this.anInt2491) * 1709976905;
         }
      }
   }

   public void method3629() {
      while(true) {
         int var2;
         synchronized(this) {
            while(true) {
               if(this.anIOException2497 != null) {
                  return;
               }

               if(0 == -521099933 * this.anInt2495) {
                  var2 = -339764179 * this.anInt2491 - this.anInt2496 * 1191990521 - 1;
               } else if(-521099933 * this.anInt2495 <= 1191990521 * this.anInt2496) {
                  var2 = this.anInt2491 * -339764179 - this.anInt2496 * 1191990521;
               } else {
                  var2 = -521099933 * this.anInt2495 - 1191990521 * this.anInt2496 - 1;
               }

               if(var2 > 0) {
                  break;
               }

               try {
                  this.wait();
               } catch (InterruptedException var9) {
                  ;
               }
            }
         }

         int var1;
         try {
            var1 = this.anInputStream2493.read(this.aByteArray2494, this.anInt2496 * 1191990521, var2);
            if(-1 == var1) {
               throw new EOFException();
            }
         } catch (IOException var10) {
            IOException var3 = var10;
            synchronized(this) {
               this.anIOException2497 = var3;
               return;
            }
         }

         synchronized(this) {
            this.anInt2496 = (var1 + 1191990521 * this.anInt2496) % (-339764179 * this.anInt2491) * 1709976905;
         }
      }
   }

   boolean method3630(int var1) throws IOException {
      if(var1 > 0 && var1 < this.anInt2491 * -339764179) {
         synchronized(this) {
            int var3;
            if(this.anInt2495 * -521099933 <= this.anInt2496 * 1191990521) {
               var3 = this.anInt2496 * 1191990521 - -521099933 * this.anInt2495;
            } else {
               var3 = -339764179 * this.anInt2491 - this.anInt2495 * -521099933 + 1191990521 * this.anInt2496;
            }

            if(var3 < var1) {
               if(this.anIOException2497 != null) {
                  throw new IOException(this.anIOException2497.toString());
               } else {
                  this.notifyAll();
                  return false;
               }
            } else {
               return true;
            }
         }
      } else {
         throw new IOException();
      }
   }

   public void method3631() {
      while(true) {
         int var2;
         synchronized(this) {
            while(true) {
               if(this.anIOException2497 != null) {
                  return;
               }

               if(0 == -521099933 * this.anInt2495) {
                  var2 = -339764179 * this.anInt2491 - this.anInt2496 * 1191990521 - 1;
               } else if(-521099933 * this.anInt2495 <= 1191990521 * this.anInt2496) {
                  var2 = this.anInt2491 * -339764179 - this.anInt2496 * 1191990521;
               } else {
                  var2 = -521099933 * this.anInt2495 - 1191990521 * this.anInt2496 - 1;
               }

               if(var2 > 0) {
                  break;
               }

               try {
                  this.wait();
               } catch (InterruptedException var9) {
                  ;
               }
            }
         }

         int var1;
         try {
            var1 = this.anInputStream2493.read(this.aByteArray2494, this.anInt2496 * 1191990521, var2);
            if(-1 == var1) {
               throw new EOFException();
            }
         } catch (IOException var10) {
            IOException var3 = var10;
            synchronized(this) {
               this.anIOException2497 = var3;
               return;
            }
         }

         synchronized(this) {
            this.anInt2496 = (var1 + 1191990521 * this.anInt2496) % (-339764179 * this.anInt2491) * 1709976905;
         }
      }
   }

   boolean method3632(int var1) throws IOException {
      if(var1 > 0 && var1 < this.anInt2491 * -339764179) {
         synchronized(this) {
            int var3;
            if(this.anInt2495 * -521099933 <= this.anInt2496 * 1191990521) {
               var3 = this.anInt2496 * 1191990521 - -521099933 * this.anInt2495;
            } else {
               var3 = -339764179 * this.anInt2491 - this.anInt2495 * -521099933 + 1191990521 * this.anInt2496;
            }

            if(var3 < var1) {
               if(this.anIOException2497 != null) {
                  throw new IOException(this.anIOException2497.toString());
               } else {
                  this.notifyAll();
                  return false;
               }
            } else {
               return true;
            }
         }
      } else {
         throw new IOException();
      }
   }

   int method3633(int var1) throws IOException {
      synchronized(this) {
         int var3;
         if(-521099933 * this.anInt2495 <= this.anInt2496 * 1191990521) {
            var3 = this.anInt2496 * 1191990521 - -521099933 * this.anInt2495;
         } else {
            var3 = this.anInt2491 * -339764179 - this.anInt2495 * -521099933 + 1191990521 * this.anInt2496;
         }

         if(this.anIOException2497 != null) {
            throw new IOException(this.anIOException2497.toString());
         } else {
            this.notifyAll();
            return var3;
         }
      }
   }

   int method3634() throws IOException {
      synchronized(this) {
         int var2;
         if(-521099933 * this.anInt2495 <= this.anInt2496 * 1191990521) {
            var2 = this.anInt2496 * 1191990521 - -521099933 * this.anInt2495;
         } else {
            var2 = this.anInt2491 * -339764179 - this.anInt2495 * -521099933 + 1191990521 * this.anInt2496;
         }

         if(this.anIOException2497 != null) {
            throw new IOException(this.anIOException2497.toString());
         } else {
            this.notifyAll();
            return var2;
         }
      }
   }

   int method3635(byte[] var1, int var2, int var3, int var4) throws IOException {
      if(var3 >= 0 && var2 >= 0 && var2 + var3 <= var1.length) {
         synchronized(this) {
            int var6;
            if(-521099933 * this.anInt2495 <= this.anInt2496 * 1191990521) {
               var6 = this.anInt2496 * 1191990521 - -521099933 * this.anInt2495;
            } else {
               var6 = 1191990521 * this.anInt2496 + (-339764179 * this.anInt2491 - this.anInt2495 * -521099933);
            }

            if(var3 > var6) {
               var3 = var6;
            }

            if(var3 == 0 && null != this.anIOException2497) {
               throw new IOException(this.anIOException2497.toString());
            } else {
               if(var3 + this.anInt2495 * -521099933 <= this.anInt2491 * -339764179) {
                  System.arraycopy(this.aByteArray2494, -521099933 * this.anInt2495, var1, var2, var3);
               } else {
                  int var7 = this.anInt2491 * -339764179 - this.anInt2495 * -521099933;
                  System.arraycopy(this.aByteArray2494, this.anInt2495 * -521099933, var1, var2, var7);
                  System.arraycopy(this.aByteArray2494, 0, var1, var7 + var2, var3 - var7);
               }

               this.anInt2495 = (-521099933 * this.anInt2495 + var3) % (this.anInt2491 * -339764179) * 512623691;
               this.notifyAll();
               return var3;
            }
         }
      } else {
         throw new IOException();
      }
   }

   void method3636(byte var1) {
      this.anInputStream2493 = new InputStream_Sub1();
   }

   Class212(InputStream var1, int var2) {
      this.anInputStream2493 = var1;
      this.anInt2491 = -2060643419 * (var2 + 1);
      this.aByteArray2494 = new byte[this.anInt2491 * -339764179];
      this.aThread2492 = new Thread(this);
      this.aThread2492.setDaemon(true);
      this.aThread2492.start();
   }

   void method3637() {
      this.anInputStream2493 = new InputStream_Sub1();
   }

   void method3638() {
      this.anInputStream2493 = new InputStream_Sub1();
   }

   void method3639() {
      this.anInputStream2493 = new InputStream_Sub1();
   }

   public static Class579 method3640(boolean var0, byte var1) {
      Stack var2 = Class579.aStack7620;
      synchronized(var2) {
         Class579 var3;
         if(Class579.aStack7620.isEmpty()) {
            var3 = new Class579();
         } else {
            var3 = (Class579)Class579.aStack7620.pop();
         }

         var3.aBool7619 = var0;
         return var3;
      }
   }

   static final void method3641(Class508 var0, byte var1) {
      Class505 var2 = var0.aBool6014?var0.aClass505_6011:var0.aClass505_6010;
      Class124 var3 = var2.aClass124_5977;
      Class121 var4 = var2.aClass121_5978;
      Class214.method3659(var3, var4, var0, (short)3261);
   }

   static final void method3642(Class508 var0, byte var1) {
      int var2 = var0.anIntArray6027[(var0.anInt6003 -= 98312473) * -937710807];
      Class124 var3 = Class97.method1903(var2, 1857915284);
      Class121 var4 = Class18.aClass121Array188[var2 >> 16];
      Class382.method6605(var3, var4, var0, -1985144993);
   }

   static final void method3643(Class508 var0, int var1) {
      Class225_Sub18.method13625(-1100589232);
   }
}
