package mapped;

import java.math.BigInteger;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.api.RSBuffer;

@ObfuscatedName("uj")
public class Buffer extends Node implements RSBuffer {
   @ObfuscatedName("az")
   static int[] field5138;
   @ObfuscatedName("av")
   static long[] field5140;
   @ObfuscatedName("ac")
   public byte[] array;
   @ObfuscatedName("al")
   @ObfuscatedGetter(
      intValue = 1904364897
   )
   public int offset;

   static {
      field5138 = new int[256];

      int var2;
      for(int var1 = 0; var1 < 256; ++var1) {
         int var0 = var1;

         for(var2 = 0; var2 < 8; ++var2) {
            if((var0 & 1) == 1) {
               var0 = var0 >>> 1 ^ -306674912;
            } else {
               var0 >>>= 1;
            }
         }

         field5138[var1] = var0;
      }

      field5140 = new long[256];

      for(var2 = 0; var2 < 256; ++var2) {
         long var4 = (long)var2;

         for(int var3 = 0; var3 < 8; ++var3) {
            if((var4 & 1L) == 1L) {
               var4 = var4 >>> 1 ^ -3932672073523589310L;
            } else {
               var4 >>>= 1;
            }
         }

         field5140[var2] = var4;
      }

   }

   public Buffer(int var1, boolean var2) {
      this.array = ServerPacket.ByteArrayPool_getArrayBool_base(var1, var2);
   }

   public Buffer(int var1) {
      this.array = class362.ByteArrayPool_getArray_base(var1);
      this.offset = 0;
   }

   public Buffer(byte[] var1) {
      this.array = var1;
      this.offset = 0;
   }

   @ObfuscatedName("bo")
   @ObfuscatedSignature(
      descriptor = "(I)V",
      garbageValue = "37821"
   )
   public void releaseArray_base() {
      if(this.array != null) {
         SwapSongTask.ByteArrayPool_release_base(this.array);
      }

      this.array = null;
   }

   @ObfuscatedName("bt")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "378824417"
   )
   public void writeByte_base(int var1) {
      this.array[++this.offset - 1] = (byte)var1;
   }

   @ObfuscatedName("bu")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "1608381216"
   )
   public void writeShort_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
      this.array[++this.offset - 1] = (byte)var1;
   }

   @ObfuscatedName("by")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "-1102308470"
   )
   public void writeMedium_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 >> 16);
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
      this.array[++this.offset - 1] = (byte)var1;
   }

   @ObfuscatedName("bh")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "-919766587"
   )
   public void writeInt_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 >> 24);
      this.array[++this.offset - 1] = (byte)(var1 >> 16);
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
      this.array[++this.offset - 1] = (byte)var1;
   }

   @ObfuscatedName("bz")
   public void writeLongMedium_base(long var1) {
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 40));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 32));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 24));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 16));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 8));
      this.array[++this.offset - 1] = (byte)((int)var1);
   }

   @ObfuscatedName("bc")
   public void writeLong_base(long var1) {
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 56));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 48));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 40));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 32));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 24));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 16));
      this.array[++this.offset - 1] = (byte)((int)(var1 >> 8));
      this.array[++this.offset - 1] = (byte)((int)var1);
   }

   @ObfuscatedName("bs")
   @ObfuscatedSignature(
      descriptor = "(ZI)V",
      garbageValue = "-1187697267"
   )
   public void writeBoolean_base(boolean var1) {
      this.writeByte_base(var1?1:0);
   }

   @ObfuscatedName("bb")
   @ObfuscatedSignature(
      descriptor = "(Ljava/lang/String;I)V",
      garbageValue = "900280888"
   )
   public void writeStringCp1252NullTerminated_base(String var1) {
      int var2 = var1.indexOf(0);
      if(var2 >= 0) {
         throw new IllegalArgumentException("");
      } else {
         this.offset += NpcOverrides.encodeStringCp1252_base(var1, 0, var1.length(), this.array, this.offset);
         this.array[++this.offset - 1] = 0;
      }
   }

   @ObfuscatedName("bk")
   @ObfuscatedSignature(
      descriptor = "(Ljava/lang/String;I)V",
      garbageValue = "1205300061"
   )
   public void writeStringCp1252NullCircumfixed_base(String var1) {
      int var2 = var1.indexOf(0);
      if(var2 >= 0) {
         throw new IllegalArgumentException("");
      } else {
         this.array[++this.offset - 1] = 0;
         this.offset += NpcOverrides.encodeStringCp1252_base(var1, 0, var1.length(), this.array, this.offset);
         this.array[++this.offset - 1] = 0;
      }
   }

   @ObfuscatedName("br")
   @ObfuscatedSignature(
      descriptor = "(Ljava/lang/CharSequence;I)V",
      garbageValue = "395083018"
   )
   public void writeCESU8_base(CharSequence var1) {
      int var3 = var1.length();
      int var4 = 0;

      for(int var5 = 0; var5 < var3; ++var5) {
         char var6 = var1.charAt(var5);
         if(var6 <= 127) {
            ++var4;
         } else if(var6 <= 2047) {
            var4 += 2;
         } else {
            var4 += 3;
         }
      }

      this.array[++this.offset - 1] = 0;
      this.writeVarInt_base(var4);
      this.offset += class344.method6807_base(this.array, this.offset, var1);
   }

   @ObfuscatedName("bq")
   @ObfuscatedSignature(
      descriptor = "([BIII)V",
      garbageValue = "1351924623"
   )
   public void writeBytes_base(byte[] var1, int var2, int var3) {
      for(int var4 = var2; var4 < var3 + var2; ++var4) {
         this.array[++this.offset - 1] = var1[var4];
      }

   }

   @ObfuscatedName("cf")
   @ObfuscatedSignature(
      descriptor = "(Luj;I)V",
      garbageValue = "-1328772504"
   )
   public void method9373(Buffer var1) {
      this.writeBytes_base(var1.array, 0, var1.offset);
   }

   @ObfuscatedName("cg")
   @ObfuscatedSignature(
      descriptor = "(IB)V",
      garbageValue = "31"
   )
   public void writeLengthInt_base(int var1) {
      if(var1 < 0) {
         throw new IllegalArgumentException();
      } else {
         this.array[this.offset - var1 - 4] = (byte)(var1 >> 24);
         this.array[this.offset - var1 - 3] = (byte)(var1 >> 16);
         this.array[this.offset - var1 - 2] = (byte)(var1 >> 8);
         this.array[this.offset - var1 - 1] = (byte)var1;
      }
   }

   @ObfuscatedName("cv")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "1632479764"
   )
   public void writeLengthShort_base(int var1) {
      if(var1 >= 0 && var1 <= 65535) {
         this.array[this.offset - var1 - 2] = (byte)(var1 >> 8);
         this.array[this.offset - var1 - 1] = (byte)var1;
      } else {
         throw new IllegalArgumentException();
      }
   }

   @ObfuscatedName("cx")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "-579744730"
   )
   public void writeLengthByte_base(int var1) {
      if(var1 >= 0 && var1 <= 255) {
         this.array[this.offset - var1 - 1] = (byte)var1;
      } else {
         throw new IllegalArgumentException();
      }
   }

   @ObfuscatedName("cp")
   @ObfuscatedSignature(
      descriptor = "(IB)V",
      garbageValue = "1"
   )
   public void writeSmartByteShort_base(int var1) {
      if(var1 >= 0 && var1 < 128) {
         this.writeByte_base(var1);
      } else if(var1 >= 0 && var1 < 32768) {
         this.writeShort_base(var1 + 32768);
      } else {
         throw new IllegalArgumentException();
      }
   }

   @ObfuscatedName("ce")
   @ObfuscatedSignature(
      descriptor = "(IB)V",
      garbageValue = "-24"
   )
   public void writeVarInt_base(int var1) {
      if((var1 & -128) != 0) {
         if((var1 & -16384) != 0) {
            if((var1 & -2097152) != 0) {
               if((var1 & -268435456) != 0) {
                  this.writeByte_base(var1 >>> 28 | 128);
               }

               this.writeByte_base(var1 >>> 21 | 128);
            }

            this.writeByte_base(var1 >>> 14 | 128);
         }

         this.writeByte_base(var1 >>> 7 | 128);
      }

      this.writeByte_base(var1 & 127);
   }

   @ObfuscatedName("ci")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-2135345863"
   )
   public int readUnsignedByte_base() {
      return this.array[++this.offset - 1] & 255;
   }

   @ObfuscatedName("ct")
   @ObfuscatedSignature(
      descriptor = "(B)B",
      garbageValue = "-101"
   )
   public byte readByte_base() {
      return this.array[++this.offset - 1];
   }

   @ObfuscatedName("cw")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "100"
   )
   public int readUnsignedShort_base() {
      this.offset += 2;
      return (this.array[this.offset - 1] & 255) + ((this.array[this.offset - 2] & 255) << 8);
   }

   @ObfuscatedName("cq")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "58"
   )
   public int readShort_base() {
      this.offset += 2;
      int var1 = (this.array[this.offset - 1] & 255) + ((this.array[this.offset - 2] & 255) << 8);
      if(var1 > 32767) {
         var1 -= 65536;
      }

      return var1;
   }

   @ObfuscatedName("cl")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "49"
   )
   public int readUnsignedMedium_base() {
      this.offset += 3;
      return ((this.array[this.offset - 3] & 255) << 16) + (this.array[this.offset - 1] & 255) + ((this.array[this.offset - 2] & 255) << 8);
   }

   @ObfuscatedName("cs")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "89"
   )
   public int readMedium_base() {
      this.offset += 3;
      int var1 = ((this.array[this.offset - 3] & 255) << 16) + (this.array[this.offset - 1] & 255) + ((this.array[this.offset - 2] & 255) << 8);
      if(var1 > 8388607) {
         var1 -= 16777216;
      }

      return var1;
   }

   @ObfuscatedName("co")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "-12"
   )
   public int readInt_base() {
      this.offset += 4;
      return ((this.array[this.offset - 3] & 255) << 16) + (this.array[this.offset - 1] & 255) + ((this.array[this.offset - 2] & 255) << 8) + ((this.array[this.offset - 4] & 255) << 24);
   }

   @ObfuscatedName("cm")
   @ObfuscatedSignature(
      descriptor = "(I)J",
      garbageValue = "1536717051"
   )
   public long readLong_base() {
      long var1 = (long)this.readInt_base() & 4294967295L;
      long var3 = (long)this.readInt_base() & 4294967295L;
      return var3 + (var1 << 32);
   }

   @ObfuscatedName("cn")
   @ObfuscatedSignature(
      descriptor = "(I)F",
      garbageValue = "346642387"
   )
   public float method9268_base() {
      return Float.intBitsToFloat(this.readInt_base());
   }

   @ObfuscatedName("cr")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "2040454969"
   )
   public boolean readBoolean_base() {
      return (this.readUnsignedByte_base() & 1) == 1;
   }

   @ObfuscatedName("cj")
   @ObfuscatedSignature(
      descriptor = "(I)Ljava/lang/String;",
      garbageValue = "-1977045355"
   )
   public String readStringCp1252NullTerminatedOrNull_base() {
      if(this.array[this.offset] == 0) {
         ++this.offset;
         return null;
      } else {
         return this.readStringCp1252NullTerminated_base();
      }
   }

   @ObfuscatedName("ca")
   @ObfuscatedSignature(
      descriptor = "(I)Ljava/lang/String;",
      garbageValue = "664919203"
   )
   public String readStringCp1252NullTerminated_base() {
      int var1 = this.offset;

      while(this.array[++this.offset - 1] != 0) {
         ;
      }

      int var2 = this.offset - var1 - 1;
      return var2 == 0?"":World.decodeStringCp1252_base(this.array, var1, var2);
   }

   @ObfuscatedName("cc")
   @ObfuscatedSignature(
      descriptor = "(I)Ljava/lang/String;",
      garbageValue = "-716580944"
   )
   public String readStringCp1252NullCircumfixed_base() {
      byte var1 = this.array[++this.offset - 1];
      if(var1 != 0) {
         throw new IllegalStateException("");
      } else {
         int var2 = this.offset;

         while(this.array[++this.offset - 1] != 0) {
            ;
         }

         int var3 = this.offset - var2 - 1;
         return var3 == 0?"":World.decodeStringCp1252_base(this.array, var2, var3);
      }
   }

   @ObfuscatedName("cu")
   @ObfuscatedSignature(
      descriptor = "(I)Ljava/lang/String;",
      garbageValue = "-780563964"
   )
   public String readCESU8_base() {
      byte var1 = this.array[++this.offset - 1];
      if(var1 != 0) {
         throw new IllegalStateException("");
      } else {
         int var2 = this.readVarInt_base();
         if(var2 + this.offset > this.array.length) {
            throw new IllegalStateException("");
         } else {
            byte[] var4 = this.array;
            int var5 = this.offset;
            char[] var6 = new char[var2];
            int var7 = 0;
            int var8 = var5;

            int var11;
            for(int var9 = var2 + var5; var8 < var9; var6[var7++] = (char)var11) {
               int var10 = var4[var8++] & 255;
               if(var10 < 128) {
                  if(var10 == 0) {
                     var11 = 65533;
                  } else {
                     var11 = var10;
                  }
               } else if(var10 < 192) {
                  var11 = 65533;
               } else if(var10 < 224) {
                  if(var8 < var9 && (var4[var8] & 192) == 128) {
                     var11 = (var10 & 31) << 6 | var4[var8++] & 63;
                     if(var11 < 128) {
                        var11 = 65533;
                     }
                  } else {
                     var11 = 65533;
                  }
               } else if(var10 < 240) {
                  if(var8 + 1 < var9 && (var4[var8] & 192) == 128 && (var4[var8 + 1] & 192) == 128) {
                     var11 = (var10 & 15) << 12 | (var4[var8++] & 63) << 6 | var4[var8++] & 63;
                     if(var11 < 2048) {
                        var11 = 65533;
                     }
                  } else {
                     var11 = 65533;
                  }
               } else if(var10 < 248) {
                  if(var8 + 2 < var9 && (var4[var8] & 192) == 128 && (var4[var8 + 1] & 192) == 128 && (var4[var8 + 2] & 192) == 128) {
                     var11 = (var10 & 7) << 18 | (var4[var8++] & 63) << 12 | (var4[var8++] & 63) << 6 | var4[var8++] & 63;
                     if(var11 >= 65536 && var11 <= 1114111) {
                        var11 = 65533;
                     } else {
                        var11 = 65533;
                     }
                  } else {
                     var11 = 65533;
                  }
               } else {
                  var11 = 65533;
               }
            }

            String var3 = new String(var6, 0, var7);
            this.offset += var2;
            return var3;
         }
      }
   }

   @ObfuscatedName("ch")
   @ObfuscatedSignature(
      descriptor = "([BIII)V",
      garbageValue = "-2014110901"
   )
   public void readBytes_base(byte[] var1, int var2, int var3) {
      for(int var4 = var2; var4 < var3 + var2; ++var4) {
         var1[var4] = this.array[++this.offset - 1];
      }

   }

   @ObfuscatedName("cb")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "875734256"
   )
   public int readShortSmart_base() {
      int var1 = this.array[this.offset] & 255;
      return var1 < 128?this.readUnsignedByte_base() - 64:this.readUnsignedShort_base() - 49152;
   }

   @ObfuscatedName("cz")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "1283658901"
   )
   public int readUShortSmart_base() {
      int var1 = this.array[this.offset] & 255;
      return var1 < 128?this.readUnsignedByte_base():this.readUnsignedShort_base() - 32768;
   }

   @ObfuscatedName("cy")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "1077896012"
   )
   public int readShortSmartSub_base() {
      int var1 = this.array[this.offset] & 255;
      return var1 < 128?this.readUnsignedByte_base() - 1:this.readUnsignedShort_base() - 32769;
   }

   @ObfuscatedName("ck")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "75"
   )
   public int readIncrSmallSmart_base() {
      int var1 = 0;

      int var2;
      for(var2 = this.readUShortSmart_base(); var2 == 32767; var2 = this.readUShortSmart_base()) {
         var1 += 32767;
      }

      var1 += var2;
      return var1;
   }

   @ObfuscatedName("cd")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-2102511661"
   )
   public int readLargeSmart_base() {
      return this.array[this.offset] < 0?this.readInt_base() & Integer.MAX_VALUE:this.readUnsignedShort_base();
   }

   @ObfuscatedName("dt")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "1637265381"
   )
   public int readNullableLargeSmart_base() {
      if(this.array[this.offset] < 0) {
         return this.readInt_base() & Integer.MAX_VALUE;
      } else {
         int var1 = this.readUnsignedShort_base();
         return var1 == 32767?-1:var1;
      }
   }

   @ObfuscatedName("di")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "-29"
   )
   public int readVarInt_base() {
      byte var1 = this.array[++this.offset - 1];

      int var2;
      for(var2 = 0; var1 < 0; var1 = this.array[++this.offset - 1]) {
         var2 = (var2 | var1 & 127) << 7;
      }

      return var2 | var1;
   }

   @ObfuscatedName("dk")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-1675409719"
   )
   public int packBytesToInt_base() {
      int var2 = 0;
      int var3 = 0;

      int var1;
      do {
         var1 = this.readUnsignedByte_base();
         var2 |= (var1 & 127) << var3;
         var3 += 7;
      } while(var1 > 127);

      return var2;
   }

   @ObfuscatedName("dd")
   @ObfuscatedSignature(
      descriptor = "([II)V",
      garbageValue = "2139836666"
   )
   public void xteaEncryptAll_base(int[] var1) {
      int var2 = this.offset / 8;
      this.offset = 0;

      for(int var3 = 0; var3 < var2; ++var3) {
         int var4 = this.readInt_base();
         int var5 = this.readInt_base();
         int var6 = 0;
         int var7 = -1640531527;

         for(int var8 = 32; var8-- > 0; var5 += var4 + (var4 << 4 ^ var4 >>> 5) ^ var1[var6 >>> 11 & 3] + var6) {
            var4 += var5 + (var5 << 4 ^ var5 >>> 5) ^ var6 + var1[var6 & 3];
            var6 += var7;
         }

         this.offset -= 8;
         this.writeInt_base(var4);
         this.writeInt_base(var5);
      }

   }

   @ObfuscatedName("dx")
   @ObfuscatedSignature(
      descriptor = "([II)V",
      garbageValue = "-1034826768"
   )
   public void xteaDecryptAll_base(int[] var1) {
      int var2 = this.offset / 8;
      this.offset = 0;

      for(int var3 = 0; var3 < var2; ++var3) {
         int var4 = this.readInt_base();
         int var5 = this.readInt_base();
         int var6 = -957401312;
         int var7 = -1640531527;

         for(int var8 = 32; var8-- > 0; var4 -= var5 + (var5 << 4 ^ var5 >>> 5) ^ var6 + var1[var6 & 3]) {
            var5 -= var4 + (var4 << 4 ^ var4 >>> 5) ^ var1[var6 >>> 11 & 3] + var6;
            var6 -= var7;
         }

         this.offset -= 8;
         this.writeInt_base(var4);
         this.writeInt_base(var5);
      }

   }

   @ObfuscatedName("dh")
   @ObfuscatedSignature(
      descriptor = "([IIIB)V",
      garbageValue = "-6"
   )
   public void xteaEncrypt_base(int[] var1, int var2, int var3) {
      int var4 = this.offset;
      this.offset = var2;
      int var5 = (var3 - var2) / 8;

      for(int var6 = 0; var6 < var5; ++var6) {
         int var7 = this.readInt_base();
         int var8 = this.readInt_base();
         int var9 = 0;
         int var10 = -1640531527;

         for(int var11 = 32; var11-- > 0; var8 += var7 + (var7 << 4 ^ var7 >>> 5) ^ var1[var9 >>> 11 & 3] + var9) {
            var7 += var8 + (var8 << 4 ^ var8 >>> 5) ^ var9 + var1[var9 & 3];
            var9 += var10;
         }

         this.offset -= 8;
         this.writeInt_base(var7);
         this.writeInt_base(var8);
      }

      this.offset = var4;
   }

   @ObfuscatedName("du")
   @ObfuscatedSignature(
      descriptor = "([IIII)V",
      garbageValue = "1763762234"
   )
   public void xteaDecrypt_base(int[] var1, int var2, int var3) {
      int var4 = this.offset;
      this.offset = var2;
      int var5 = (var3 - var2) / 8;

      for(int var6 = 0; var6 < var5; ++var6) {
         int var7 = this.readInt_base();
         int var8 = this.readInt_base();
         int var9 = -957401312;
         int var10 = -1640531527;

         for(int var11 = 32; var11-- > 0; var7 -= var8 + (var8 << 4 ^ var8 >>> 5) ^ var9 + var1[var9 & 3]) {
            var8 -= var7 + (var7 << 4 ^ var7 >>> 5) ^ var1[var9 >>> 11 & 3] + var9;
            var9 -= var10;
         }

         this.offset -= 8;
         this.writeInt_base(var7);
         this.writeInt_base(var8);
      }

      this.offset = var4;
   }

   @ObfuscatedName("dg")
   @ObfuscatedSignature(
      descriptor = "(Ljava/math/BigInteger;Ljava/math/BigInteger;I)V",
      garbageValue = "-2126574510"
   )
   public void encryptRsa_base(BigInteger var1, BigInteger var2) {
      if(Client.modulus != null) {
         var2 = Client.modulus;
      }

      this.copy$encryptRsa(var1, var2, -2126574510);
   }

   @ObfuscatedName("dc")
   @ObfuscatedSignature(
      descriptor = "(IB)I",
      garbageValue = "36"
   )
   public int writeCrc_base(int var1) {
      int var2 = class174.method3540_base(this.array, var1, this.offset);
      this.writeInt_base(var2);
      return var2;
   }

   @ObfuscatedName("do")
   @ObfuscatedSignature(
      descriptor = "(I)Z",
      garbageValue = "-1490830987"
   )
   public boolean checkCrc_base() {
      this.offset -= 4;
      int var1 = class174.method3540_base(this.array, 0, this.offset);
      int var2 = this.readInt_base();
      return var2 == var1;
   }

   @ObfuscatedName("db")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "1106007511"
   )
   public void writeByteAdd_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 + 128);
   }

   @ObfuscatedName("dm")
   @ObfuscatedSignature(
      descriptor = "(IB)V",
      garbageValue = "97"
   )
   public void writeByteNeg_base(int var1) {
      this.array[++this.offset - 1] = (byte)(0 - var1);
   }

   @ObfuscatedName("dr")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "209372991"
   )
   public void writeByteSub_base(int var1) {
      this.array[++this.offset - 1] = (byte)(128 - var1);
   }

   @ObfuscatedName("ds")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-756845354"
   )
   public int readUnsignedByteAdd_base() {
      return this.array[++this.offset - 1] - 128 & 255;
   }

   @ObfuscatedName("da")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-2085859197"
   )
   public int readUnsignedByteNeg_base() {
      return 0 - this.array[++this.offset - 1] & 255;
   }

   @ObfuscatedName("dw")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-2004918107"
   )
   public int readUnsignedByteSub_base() {
      return 128 - this.array[++this.offset - 1] & 255;
   }

   @ObfuscatedName("dp")
   @ObfuscatedSignature(
      descriptor = "(I)B",
      garbageValue = "21885876"
   )
   public byte readByteAdd_base() {
      return (byte)(this.array[++this.offset - 1] - 128);
   }

   @ObfuscatedName("df")
   @ObfuscatedSignature(
      descriptor = "(B)B",
      garbageValue = "101"
   )
   public byte readByteNeg_base() {
      return (byte)(0 - this.array[++this.offset - 1]);
   }

   @ObfuscatedName("dv")
   @ObfuscatedSignature(
      descriptor = "(I)B",
      garbageValue = "1189405453"
   )
   public byte readByteSub_base() {
      return (byte)(128 - this.array[++this.offset - 1]);
   }

   @ObfuscatedName("dz")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "1799135132"
   )
   public void writeShortLE_base(int var1) {
      this.array[++this.offset - 1] = (byte)var1;
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
   }

   @ObfuscatedName("dl")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "-1890787841"
   )
   public void writeShortAdd_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
      this.array[++this.offset - 1] = (byte)(var1 + 128);
   }

   @ObfuscatedName("de")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "-1160073219"
   )
   public void writeShortAddLE_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 + 128);
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
   }

   @ObfuscatedName("dn")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "113"
   )
   public int readUnsignedShortLE_base() {
      this.offset += 2;
      return ((this.array[this.offset - 1] & 255) << 8) + (this.array[this.offset - 2] & 255);
   }

   @ObfuscatedName("dq")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "201481069"
   )
   public int readUnsignedShortAdd_base() {
      this.offset += 2;
      return (this.array[this.offset - 1] - 128 & 255) + ((this.array[this.offset - 2] & 255) << 8);
   }

   @ObfuscatedName("dj")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "1"
   )
   public int readUnsignedShortAddLE_base() {
      this.offset += 2;
      return ((this.array[this.offset - 1] & 255) << 8) + (this.array[this.offset - 2] - 128 & 255);
   }

   @ObfuscatedName("dy")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "88"
   )
   public int readShortLE_base() {
      this.offset += 2;
      int var1 = ((this.array[this.offset - 1] & 255) << 8) + (this.array[this.offset - 2] & 255);
      if(var1 > 32767) {
         var1 -= 65536;
      }

      return var1;
   }

   @ObfuscatedName("ec")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-1774495709"
   )
   public int readShortAdd_base() {
      this.offset += 2;
      int var1 = (this.array[this.offset - 1] - 128 & 255) + ((this.array[this.offset - 2] & 255) << 8);
      if(var1 > 32767) {
         var1 -= 65536;
      }

      return var1;
   }

   @ObfuscatedName("ew")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "-1535378058"
   )
   public int readShortLEAdd_base() {
      this.offset += 2;
      int var1 = ((this.array[this.offset - 1] & 255) << 8) + (this.array[this.offset - 2] - 128 & 255);
      if(var1 > 32767) {
         var1 -= 65536;
      }

      return var1;
   }

   @ObfuscatedName("ex")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "228979090"
   )
   public void writeMediumLE_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
      this.array[++this.offset - 1] = (byte)(var1 >> 16);
      this.array[++this.offset - 1] = (byte)var1;
   }

   @ObfuscatedName("ev")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "6"
   )
   public int method9418_base() {
      this.offset += 3;
      return (this.array[this.offset - 3] & 255) + ((this.array[this.offset - 2] & 255) << 8) + ((this.array[this.offset - 1] & 255) << 16);
   }

   @ObfuscatedName("ek")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "104"
   )
   public int method9310_base() {
      this.offset += 3;
      return ((this.array[this.offset - 1] & 255) << 8) + ((this.array[this.offset - 3] & 255) << 16) + (this.array[this.offset - 2] & 255);
   }

   @ObfuscatedName("em")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "-46"
   )
   public int method9249_base() {
      this.offset += 3;
      int var1 = (this.array[this.offset - 3] & 255) + ((this.array[this.offset - 2] & 255) << 8) + ((this.array[this.offset - 1] & 255) << 16);
      if(var1 > 8388607) {
         var1 -= 16777216;
      }

      return var1;
   }

   @ObfuscatedName("eo")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "71"
   )
   public int readMedium_alt1_base() {
      this.offset += 3;
      int var1 = ((this.array[this.offset - 1] & 255) << 8) + ((this.array[this.offset - 3] & 255) << 16) + (this.array[this.offset - 2] & 255);
      if(var1 > 8388607) {
         var1 -= 16777216;
      }

      return var1;
   }

   @ObfuscatedName("ef")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "55"
   )
   public int method9313_base() {
      this.offset += 3;
      int var1 = (this.array[this.offset - 1] & 255) + ((this.array[this.offset - 3] & 255) << 8) + ((this.array[this.offset - 2] & 255) << 16);
      if(var1 > 8388607) {
         var1 -= 16777216;
      }

      return var1;
   }

   @ObfuscatedName("el")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "392771780"
   )
   public void writeIntLE_base(int var1) {
      this.array[++this.offset - 1] = (byte)var1;
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
      this.array[++this.offset - 1] = (byte)(var1 >> 16);
      this.array[++this.offset - 1] = (byte)(var1 >> 24);
   }

   @ObfuscatedName("es")
   @ObfuscatedSignature(
      descriptor = "(IB)V",
      garbageValue = "86"
   )
   public void writeIntME_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
      this.array[++this.offset - 1] = (byte)var1;
      this.array[++this.offset - 1] = (byte)(var1 >> 24);
      this.array[++this.offset - 1] = (byte)(var1 >> 16);
   }

   @ObfuscatedName("ea")
   @ObfuscatedSignature(
      descriptor = "(II)V",
      garbageValue = "258786321"
   )
   public void writeIntIME_base(int var1) {
      this.array[++this.offset - 1] = (byte)(var1 >> 16);
      this.array[++this.offset - 1] = (byte)(var1 >> 24);
      this.array[++this.offset - 1] = (byte)var1;
      this.array[++this.offset - 1] = (byte)(var1 >> 8);
   }

   @ObfuscatedName("en")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "1727101871"
   )
   public int readUnsignedIntLE_base() {
      this.offset += 4;
      return (this.array[this.offset - 4] & 255) + ((this.array[this.offset - 3] & 255) << 8) + ((this.array[this.offset - 2] & 255) << 16) + ((this.array[this.offset - 1] & 255) << 24);
   }

   @ObfuscatedName("eh")
   @ObfuscatedSignature(
      descriptor = "(B)I",
      garbageValue = "126"
   )
   public int readUnsignedIntIME_base() {
      this.offset += 4;
      return ((this.array[this.offset - 2] & 255) << 24) + ((this.array[this.offset - 4] & 255) << 8) + (this.array[this.offset - 3] & 255) + ((this.array[this.offset - 1] & 255) << 16);
   }

   @ObfuscatedName("ei")
   @ObfuscatedSignature(
      descriptor = "(I)I",
      garbageValue = "1456274575"
   )
   public int readUnsignedIntME_base() {
      this.offset += 4;
      return ((this.array[this.offset - 1] & 255) << 8) + ((this.array[this.offset - 4] & 255) << 16) + (this.array[this.offset - 2] & 255) + ((this.array[this.offset - 3] & 255) << 24);
   }

   @ObfuscatedName("et")
   @ObfuscatedSignature(
      descriptor = "([BIII)V",
      garbageValue = "1299498311"
   )
   public void method9375_base(byte[] var1, int var2, int var3) {
      for(int var4 = var3 + var2 - 1; var4 >= var2; --var4) {
         var1[var4] = this.array[++this.offset - 1];
      }

   }

   @ObfuscatedName("er")
   @ObfuscatedSignature(
      descriptor = "([BIIB)V",
      garbageValue = "22"
   )
   public void method9321_base(byte[] var1, int var2, int var3) {
      for(int var4 = var2; var4 < var3 + var2; ++var4) {
         var1[var4] = (byte)(this.array[++this.offset - 1] - 128);
      }

   }

   @ObfuscatedSignature(
      descriptor = "(Ljava/math/BigInteger;Ljava/math/BigInteger;I)V",
      garbageValue = "-2126574510"
   )
   public void copy$encryptRsa(BigInteger var1, BigInteger var2, int var3) {
      int var4 = this.offset;
      this.offset = 0;
      byte[] var5 = new byte[var4];
      this.readBytes_base(var5, 0, var4);
      BigInteger var6 = new BigInteger(var5);
      BigInteger var7 = var6.modPow(var1, var2);
      byte[] var8 = var7.toByteArray();
      this.offset = 0;
      this.writeShort_base(var8.length);
      this.writeBytes_base(var8, 0, var8.length);
   }

   public byte[] getPayload() {
      return this.array;
   }

   public int getOffset() {
      return this.offset;
   }

   public void setOffset(int var1) {
      this.offset = var1;
   }

   public void releaseArray() {
      this.releaseArray_base();
   }

   public void writeByte(int var1) {
      this.writeByte_base(var1);
   }

   public void writeShort(int var1) {
      this.writeShort_base(var1);
   }

   public void writeMedium(int var1) {
      this.writeMedium_base(var1);
   }

   public void writeInt(int var1) {
      this.writeInt_base(var1);
   }

   public void writeLongMedium(long var1) {
      this.writeLongMedium_base(var1);
   }

   public void writeLong(long var1) {
      this.writeLong_base(var1);
   }

   public void writeBoolean(boolean var1) {
      this.writeBoolean_base(var1);
   }

   public void writeStringCp1252NullTerminated(String var1) {
      this.writeStringCp1252NullTerminated_base(var1);
   }

   public void writeStringCp1252NullCircumfixed(String var1) {
      this.writeStringCp1252NullCircumfixed_base(var1);
   }

   public void writeCESU8(CharSequence var1) {
      this.writeCESU8_base(var1);
   }

   public void writeBytes(byte[] var1, int var2, int var3) {
      this.writeBytes_base(var1, var2, var3);
   }

   public void writeBuffer(net.runelite.api.Buffer var1) {
      this.method9373((Buffer)var1);
   }

   public void writeLengthInt(int var1) {
      this.writeLengthInt_base(var1);
   }

   public void writeLengthShort(int var1) {
      this.writeLengthShort_base(var1);
   }

   public void writeLengthByte(int var1) {
      this.writeLengthByte_base(var1);
   }

   public void writeSmartByteShort(int var1) {
      this.writeSmartByteShort_base(var1);
   }

   public void writeVarInt(int var1) {
      this.writeVarInt_base(var1);
   }

   public int readUnsignedByte() {
      return this.readUnsignedByte_base();
   }

   public byte readByte() {
      return this.readByte_base();
   }

   public int readUnsignedShort() {
      return this.readUnsignedShort_base();
   }

   public int readShort() {
      return this.readShort_base();
   }

   public int readMedium() {
      return this.readMedium_base();
   }

   public int readInt() {
      return this.readInt_base();
   }

   public long readLong() {
      return this.readLong_base();
   }

   public boolean readBoolean() {
      return this.readBoolean_base();
   }

   public String readStringCp1252NullTerminatedOrNull() {
      return this.readStringCp1252NullTerminatedOrNull_base();
   }

   public String readStringCp1252NullTerminated() {
      return this.readStringCp1252NullTerminated_base();
   }

   public String readStringCp1252NullCircumfixed() {
      return this.readStringCp1252NullCircumfixed_base();
   }

   public String readCESU8() {
      return this.readCESU8_base();
   }

   public void readBytes(byte[] var1, int var2, int var3) {
      this.readBytes_base(var1, var2, var3);
   }

   public int readUShortSmart() {
      return this.readUShortSmart_base();
   }

   public int readShortSmartSub() {
      return this.readShortSmartSub_base();
   }

   public int readIncrSmallSmart() {
      return this.readIncrSmallSmart_base();
   }

   public int readLargeSmart() {
      return this.readLargeSmart_base();
   }

   public int readNullableLargeSmart() {
      return this.readNullableLargeSmart_base();
   }

   public int readVarInt() {
      return this.readVarInt_base();
   }

   public int packBytesToInt() {
      return this.packBytesToInt_base();
   }

   public void xteaEncryptAll(int[] var1) {
      this.xteaEncryptAll_base(var1);
   }

   public void xteaDecryptAll(int[] var1) {
      this.xteaDecryptAll_base(var1);
   }

   public void xteaEncrypt(int[] var1, int var2, int var3) {
      this.xteaEncrypt_base(var1, var2, var3);
   }

   public void xteaDecrypt(int[] var1, int var2, int var3) {
      this.xteaDecrypt_base(var1, var2, var3);
   }

   public void encryptRsa(BigInteger var1, BigInteger var2) {
      this.encryptRsa_base(var1, var2);
   }

   public int writeCrc(int var1) {
      return this.writeCrc_base(var1);
   }

   public boolean checkCrc() {
      return this.checkCrc_base();
   }

   public void writeByteAdd(int var1) {
      this.writeByteAdd_base(var1);
   }

   public void writeByteNeg(int var1) {
      this.writeByteNeg_base(var1);
   }

   public void writeByteSub(int var1) {
      this.writeByteSub_base(var1);
   }

   public int readUnsignedByteAdd() {
      return this.readUnsignedByteAdd_base();
   }

   public int readUnsignedByteNeg() {
      return this.readUnsignedByteNeg_base();
   }

   public int readUnsignedByteSub() {
      return this.readUnsignedByteSub_base();
   }

   public byte readByteAdd() {
      return this.readByteAdd_base();
   }

   public byte readByteNeg() {
      return this.readByteNeg_base();
   }

   public byte readByteSub() {
      return this.readByteSub_base();
   }

   public void writeShortLE(int var1) {
      this.writeShortLE_base(var1);
   }

   public void writeShortAddLE(int var1) {
      this.writeShortAdd_base(var1);
   }

   public void writeShortAdd(int var1) {
      this.writeShortAddLE_base(var1);
   }

   public int readUnsignedShortLE() {
      return this.readUnsignedShortLE_base();
   }

   public int readUnsignedShortAdd() {
      return this.readUnsignedShortAdd_base();
   }

   public int readUnsignedShortAddLE() {
      return this.readUnsignedShortAddLE_base();
   }

   public int readShortLE() {
      return this.readShortLE_base();
   }

   public void writeIntLE(int var1) {
      this.writeIntLE_base(var1);
   }

   public void writeIntME(int var1) {
      this.writeIntME_base(var1);
   }

   public void writeIntIME(int var1) {
      this.writeIntIME_base(var1);
   }

   public int readUnsignedIntLE() {
      return this.readUnsignedIntLE_base();
   }

   public int readUnsignedIntIME() {
      return this.readUnsignedIntIME_base();
   }

   public int readUnsignedIntME() {
      return this.readUnsignedIntME_base();
   }

   @Override
   public int readShortSmartSub64() {
      return 0;
   }

   @Override
   public int readUnsignedMediumLME() {
      return 0;
   }

   @Override
   public int readUnsignedMediumRME() {
      return 0;
   }

   @Override
   public int readShortAdd() {
      return this.readShortAdd_base();
   }

   @Override
   public int readShortAddLE() {
      return this.readShortLEAdd_base();
   }
}
