package jaclib.memory;

import jaclib.memory.Buffer;

public final class Stream {

   private Buffer aBuffer2071;
   private int anInt2072;
   private int anInt2073;
   private int anInt2074;
   private byte[] aByteArray2075;
   private static boolean aBool2076 = getLSB(-65536) == -1;


   public Stream() {
      this(4096);
   }

   private Stream(int var1) {
      this.aByteArray2075 = new byte[var1];
   }

   public Stream(Buffer var1) {
      this(var1, 0, var1.method30());
   }

   private Stream(Buffer var1, int var2, int var3) {
      this(var1.method30() < 4096?var1.method30():4096);
      this.method3015(var1, var2, var3);
   }

   private void method3015(Buffer var1, int var2, int var3) {
      this.method3021();
      this.aBuffer2071 = var1;
      this.anInt2073 = var2 * -650996365;
      this.anInt2072 = -769129389 * (var3 + var2);
      if(this.anInt2072 * -1275011109 > var1.method30()) {
         throw new RuntimeException();
      }
   }

   public int method3016() {
      return 1344487417 * this.anInt2074 + this.anInt2073 * -1929209925;
   }

   public void method3017(int var1) {
      this.method3021();
      this.anInt2073 = var1 * -650996365;
   }

   public void method3018(int var1) {
      if(1344487417 * this.anInt2074 >= this.aByteArray2075.length) {
         this.method3021();
      }

      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var1;
   }

   public void method3019(float var1) {
      if(1344487417 * this.anInt2074 + 3 >= this.aByteArray2075.length) {
         this.method3021();
      }

      int var2 = floatToRawIntBits(var1);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 24);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 16);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 8);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var2;
   }

   public void method3020(float var1) {
      if(1344487417 * this.anInt2074 + 3 >= this.aByteArray2075.length) {
         this.method3021();
      }

      int var2 = floatToRawIntBits(var1);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var2;
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 8);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 16);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 24);
   }

   public void method3021() {
      if(1344487417 * this.anInt2074 > 0) {
         if(1344487417 * this.anInt2074 + -1929209925 * this.anInt2073 > -1275011109 * this.anInt2072) {
            throw new RuntimeException();
         }

         this.aBuffer2071.method79(this.aByteArray2075, 0, this.anInt2073 * -1929209925, this.anInt2074 * 1344487417);
         this.anInt2073 += 330541531 * this.anInt2074;
         this.anInt2074 = 0;
      }

   }

   public static final boolean method3022() {
      return aBool2076;
   }

   public static native int floatToRawIntBits(float var0);

   private static final native byte getLSB(int var0);

   private void method3023(Buffer var1, int var2, int var3) {
      this.method3021();
      this.aBuffer2071 = var1;
      this.anInt2073 = var2 * -650996365;
      this.anInt2072 = -769129389 * (var3 + var2);
      if(this.anInt2072 * -1275011109 > var1.method30()) {
         throw new RuntimeException();
      }
   }

   private void method3024(Buffer var1, int var2, int var3) {
      this.method3021();
      this.aBuffer2071 = var1;
      this.anInt2073 = var2 * -650996365;
      this.anInt2072 = -769129389 * (var3 + var2);
      if(this.anInt2072 * -1275011109 > var1.method30()) {
         throw new RuntimeException();
      }
   }

   private void method3025(Buffer var1, int var2, int var3) {
      this.method3021();
      this.aBuffer2071 = var1;
      this.anInt2073 = var2 * -650996365;
      this.anInt2072 = -769129389 * (var3 + var2);
      if(this.anInt2072 * -1275011109 > var1.method30()) {
         throw new RuntimeException();
      }
   }

   private void method3026(Buffer var1, int var2, int var3) {
      this.method3021();
      this.aBuffer2071 = var1;
      this.anInt2073 = var2 * -650996365;
      this.anInt2072 = -769129389 * (var3 + var2);
      if(this.anInt2072 * -1275011109 > var1.method30()) {
         throw new RuntimeException();
      }
   }

   public int method3027() {
      return 1344487417 * this.anInt2074 + this.anInt2073 * -1929209925;
   }

   public void method3028(int var1) {
      this.method3021();
      this.anInt2073 = var1 * -650996365;
   }

   public void method3029(int var1) {
      this.method3021();
      this.anInt2073 = var1 * -650996365;
   }

   public void method3030(int var1) {
      this.method3021();
      this.anInt2073 = var1 * -650996365;
   }

   public void method3031(int var1) {
      this.method3021();
      this.anInt2073 = var1 * -650996365;
   }

   public void method3032(int var1) {
      if(1344487417 * this.anInt2074 >= this.aByteArray2075.length) {
         this.method3021();
      }

      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var1;
   }

   public void method3033(int var1) {
      if(1344487417 * this.anInt2074 >= this.aByteArray2075.length) {
         this.method3021();
      }

      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var1;
   }

   public void method3034(float var1) {
      if(1344487417 * this.anInt2074 + 3 >= this.aByteArray2075.length) {
         this.method3021();
      }

      int var2 = floatToRawIntBits(var1);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 24);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 16);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 8);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var2;
   }

   public void method3035(float var1) {
      if(1344487417 * this.anInt2074 + 3 >= this.aByteArray2075.length) {
         this.method3021();
      }

      int var2 = floatToRawIntBits(var1);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 24);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 16);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 8);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var2;
   }

   public void method3036(float var1) {
      if(1344487417 * this.anInt2074 + 3 >= this.aByteArray2075.length) {
         this.method3021();
      }

      int var2 = floatToRawIntBits(var1);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var2;
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 8);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 16);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 24);
   }

   public void method3037(float var1) {
      if(1344487417 * this.anInt2074 + 3 >= this.aByteArray2075.length) {
         this.method3021();
      }

      int var2 = floatToRawIntBits(var1);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var2;
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 8);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 16);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 24);
   }

   public void method3038(float var1) {
      if(1344487417 * this.anInt2074 + 3 >= this.aByteArray2075.length) {
         this.method3021();
      }

      int var2 = floatToRawIntBits(var1);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)var2;
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 8);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 16);
      this.aByteArray2075[(this.anInt2074 += 240996937) * 1344487417 - 1] = (byte)(var2 >> 24);
   }

   public void method3039() {
      if(1344487417 * this.anInt2074 > 0) {
         if(1344487417 * this.anInt2074 + -1929209925 * this.anInt2073 > -1275011109 * this.anInt2072) {
            throw new RuntimeException();
         }

         this.aBuffer2071.method79(this.aByteArray2075, 0, this.anInt2073 * -1929209925, this.anInt2074 * 1344487417);
         this.anInt2073 += 330541531 * this.anInt2074;
         this.anInt2074 = 0;
      }

   }

   public void method3040() {
      if(1344487417 * this.anInt2074 > 0) {
         if(1344487417 * this.anInt2074 + -1929209925 * this.anInt2073 > -1275011109 * this.anInt2072) {
            throw new RuntimeException();
         }

         this.aBuffer2071.method79(this.aByteArray2075, 0, this.anInt2073 * -1929209925, this.anInt2074 * 1344487417);
         this.anInt2073 += 330541531 * this.anInt2074;
         this.anInt2074 = 0;
      }

   }

   public static final boolean method3041() {
      return aBool2076;
   }

   public static final boolean method3042() {
      return aBool2076;
   }

   public static final boolean method3043() {
      return aBool2076;
   }

   public static final boolean method3044() {
      return aBool2076;
   }

   public static final boolean method3045() {
      return aBool2076;
   }
}
