
public class PacketBuffer extends RS2Buffer {

   ISAACCipher cipher;
   static int[] anIntArray10421 = new int[]{0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, '\uffff', 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, Integer.MAX_VALUE, -1};
   int bitPosition;


   public void method16025(ISAACCipher var1) {
      this.cipher = var1;
   }

   public void method16026() {
      this.position = 1385214721 * ((this.bitPosition * 238943703 + 7) / 8);
   }

   public void method16027(int var1, int var2) {
      this.buffer[(this.position += 1385214721) * -543666943 - 1] = (byte)(var1 + this.cipher.method7319(2018798571));
   }

   public boolean method16028(int var1) {
      int var2 = this.buffer[-543666943 * this.position] - this.cipher.method7318(-1772137852) & 255;
      return var2 >= 128;
   }

   public int readOpcode(int var1) {
      int var2 = this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(636313352) & 255;
      return var2 < 128?var2:(var2 - 128 << 8) + (this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(-1024226698) & 255);
   }

   public void method16030(byte[] var1, int var2, int var3, int var4) {
      for(int var5 = 0; var5 < var3; ++var5) {
         var1[var5 + var2] = (byte)(this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(1406184832));
      }

   }

   public void method16031(int var1) {
      this.bitPosition = this.position * -1601304776;
   }

   public int readBits(int var1, int var2) {
      int var3 = this.bitPosition * 238943703 >> 3;
      int var4 = 8 - (this.bitPosition * 238943703 & 7);
      int var5 = 0;

      for(this.bitPosition += 501433831 * var1; var1 > var4; var4 = 8) {
         var5 += (this.buffer[var3++] & anIntArray10421[var4]) << var1 - var4;
         var1 -= var4;
      }

      if(var1 == var4) {
         var5 += this.buffer[var3] & anIntArray10421[var4];
      } else {
         var5 += this.buffer[var3] >> var4 - var1 & anIntArray10421[var1];
      }

      return var5;
   }

   public void method16033(int var1) {
      this.position = 1385214721 * ((this.bitPosition * 238943703 + 7) / 8);
   }

   public void method16034(ISAACCipher var1) {
      this.cipher = var1;
   }

   public int method16035() {
      int var1 = this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(1766865784) & 255;
      return var1 < 128?var1:(var1 - 128 << 8) + (this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(857036887) & 255);
   }

   public void method16036(byte[] var1, int var2, int var3) {
      for(int var4 = 0; var4 < var3; ++var4) {
         var1[var4 + var2] = (byte)(this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(719606510));
      }

   }

   public void method16037(ISAACCipher var1) {
      this.cipher = var1;
   }

   public void method16038(int var1) {
      this.buffer[(this.position += 1385214721) * -543666943 - 1] = (byte)(var1 + this.cipher.method7319(-2043675913));
   }

   public int method16039(int var1, int var2) {
      return var1 * 8 - 238943703 * this.bitPosition;
   }

   public boolean method16040() {
      int var1 = this.buffer[-543666943 * this.position] - this.cipher.method7318(-1803765387) & 255;
      return var1 >= 128;
   }

   public boolean method16041() {
      int var1 = this.buffer[-543666943 * this.position] - this.cipher.method7318(-1797494750) & 255;
      return var1 >= 128;
   }

   public boolean method16042() {
      int var1 = this.buffer[-543666943 * this.position] - this.cipher.method7318(1171260187) & 255;
      return var1 >= 128;
   }

   public int method16043() {
      int var1 = this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(-1730968059) & 255;
      return var1 < 128?var1:(var1 - 128 << 8) + (this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(-413871362) & 255);
   }

   public int method16044() {
      int var1 = this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(-390462132) & 255;
      return var1 < 128?var1:(var1 - 128 << 8) + (this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(1784137518) & 255);
   }

   public PacketBuffer(int var1) {
      super(var1);
   }

   public void method16045(int var1) {
      this.buffer[(this.position += 1385214721) * -543666943 - 1] = (byte)(var1 + this.cipher.method7319(-214557381));
   }

   public int method16046(int var1) {
      return var1 * 8 - 238943703 * this.bitPosition;
   }

   public void method16047(byte[] var1, int var2, int var3) {
      for(int var4 = 0; var4 < var3; ++var4) {
         var1[var4 + var2] = (byte)(this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(77409399));
      }

   }

   public void method16048() {
      this.bitPosition = this.position * -1601304776;
   }

   public int method16049(int var1) {
      int var2 = this.bitPosition * 238943703 >> 3;
      int var3 = 8 - (this.bitPosition * 238943703 & 7);
      int var4 = 0;

      for(this.bitPosition += 501433831 * var1; var1 > var3; var3 = 8) {
         var4 += (this.buffer[var2++] & anIntArray10421[var3]) << var1 - var3;
         var1 -= var3;
      }

      if(var1 == var3) {
         var4 += this.buffer[var2] & anIntArray10421[var3];
      } else {
         var4 += this.buffer[var2] >> var3 - var1 & anIntArray10421[var1];
      }

      return var4;
   }

   public int method16050(int var1) {
      int var2 = this.bitPosition * 238943703 >> 3;
      int var3 = 8 - (this.bitPosition * 238943703 & 7);
      int var4 = 0;

      for(this.bitPosition += 501433831 * var1; var1 > var3; var3 = 8) {
         var4 += (this.buffer[var2++] & anIntArray10421[var3]) << var1 - var3;
         var1 -= var3;
      }

      if(var1 == var3) {
         var4 += this.buffer[var2] & anIntArray10421[var3];
      } else {
         var4 += this.buffer[var2] >> var3 - var1 & anIntArray10421[var1];
      }

      return var4;
   }

   public int method16051(int var1) {
      int var2 = this.bitPosition * 238943703 >> 3;
      int var3 = 8 - (this.bitPosition * 238943703 & 7);
      int var4 = 0;

      for(this.bitPosition += 501433831 * var1; var1 > var3; var3 = 8) {
         var4 += (this.buffer[var2++] & anIntArray10421[var3]) << var1 - var3;
         var1 -= var3;
      }

      if(var1 == var3) {
         var4 += this.buffer[var2] & anIntArray10421[var3];
      } else {
         var4 += this.buffer[var2] >> var3 - var1 & anIntArray10421[var1];
      }

      return var4;
   }

   public void method16052(ISAACCipher var1, int var2) {
      this.cipher = var1;
   }

   public int method16053(int var1) {
      return var1 * 8 - 238943703 * this.bitPosition;
   }

   public int method16054() {
      int var1 = this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(1390755803) & 255;
      return var1 < 128?var1:(var1 - 128 << 8) + (this.buffer[(this.position += 1385214721) * -543666943 - 1] - this.cipher.method7319(1377714845) & 255);
   }
}
