import java.io.IOException;

public class Class221_Sub1 extends Class221 {

   int anInt8323;
   byte[][] aByteArrayArray8324 = new byte[10][];
   int[] anIntArray8325;
   int anInt8326;
   Class253 aClass253_8327;
   RS2Buffer aClass225_Sub23_8328 = new RS2Buffer((byte[])null);
   RS2Buffer aClass225_Sub23_8329 = new RS2Buffer((byte[])null);
   static final int anInt8330 = 10;


   int method3804(byte[] var1, byte var2) throws IOException {
      int var4;
      int var5;
      if(null == this.anIntArray8325) {
         if(!this.aClass253_8327.method4506(this.anInt8326 * 1618511831, 0, (byte)29)) {
            return 0;
         }

         byte[] var3 = this.aClass253_8327.method4547(1618511831 * this.anInt8326, 0, (byte)-27);
         if(null == var3) {
            throw new IllegalStateException("");
         }

         this.aClass225_Sub23_8328.buffer = var3;
         this.aClass225_Sub23_8328.position = 0;
         var4 = var3.length >> 1;
         this.anIntArray8325 = new int[var4];

         for(var5 = 0; var5 < var4; ++var5) {
            this.anIntArray8325[var5] = this.aClass225_Sub23_8328.readUnsignedShort(-937710807);
         }
      }

      if(468704015 * this.anInt8323 >= this.anIntArray8325.length) {
         return -1;
      } else {
         this.method13234(-503593642);
         this.aClass225_Sub23_8328.buffer = var1;
         this.aClass225_Sub23_8328.position = 0;

         do {
            if(this.aClass225_Sub23_8328.position * -543666943 >= this.aClass225_Sub23_8328.buffer.length) {
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            if(null == this.aClass225_Sub23_8329.buffer) {
               if(this.aByteArrayArray8324[0] == null) {
                  this.aClass225_Sub23_8328.buffer = null;
                  return -543666943 * this.aClass225_Sub23_8328.position;
               }

               this.aClass225_Sub23_8329.buffer = this.aByteArrayArray8324[0];
            }

            int var6 = this.aClass225_Sub23_8328.buffer.length - this.aClass225_Sub23_8328.position * -543666943;
            var4 = this.aClass225_Sub23_8329.buffer.length - -543666943 * this.aClass225_Sub23_8329.position;
            if(var6 < var4) {
               this.aClass225_Sub23_8329.method13737(this.aClass225_Sub23_8328.buffer, -543666943 * this.aClass225_Sub23_8328.position, var6, 1385214721);
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            this.aClass225_Sub23_8328.method13714(this.aClass225_Sub23_8329.buffer, this.aClass225_Sub23_8329.position * -543666943, var4, -1750622136);
            this.aClass225_Sub23_8329.buffer = null;
            this.aClass225_Sub23_8329.position = 0;
            this.anInt8323 += -391531537;

            for(var5 = 0; var5 < 9; ++var5) {
               this.aByteArrayArray8324[var5] = this.aByteArrayArray8324[var5 + 1];
            }

            this.aByteArrayArray8324[9] = null;
         } while(468704015 * this.anInt8323 < this.anIntArray8325.length);

         this.aClass225_Sub23_8328.buffer = null;
         return -543666943 * this.aClass225_Sub23_8328.position;
      }
   }

   public Class221_Sub1(int var1, Class253 var2, int var3) {
      super(var1);
      this.aClass253_8327 = var2;
      this.anInt8326 = 237788135 * var3;
   }

   public void method13234(int var1) {
      if(null != this.anIntArray8325) {
         for(int var2 = 0; var2 < 10 && var2 + this.anInt8323 * 468704015 < this.anIntArray8325.length; ++var2) {
            if(null == this.aByteArrayArray8324[var2] && this.aClass253_8327.method4506(this.anIntArray8325[var2 + this.anInt8323 * 468704015], 0, (byte)-64)) {
               this.aByteArrayArray8324[var2] = this.aClass253_8327.method4547(this.anIntArray8325[468704015 * this.anInt8323 + var2], 0, (byte)-5);
            }
         }

      }
   }

   int method3809(byte[] var1) throws IOException {
      int var3;
      int var4;
      if(null == this.anIntArray8325) {
         if(!this.aClass253_8327.method4506(this.anInt8326 * 1618511831, 0, (byte)-42)) {
            return 0;
         }

         byte[] var2 = this.aClass253_8327.method4547(1618511831 * this.anInt8326, 0, (byte)6);
         if(null == var2) {
            throw new IllegalStateException("");
         }

         this.aClass225_Sub23_8328.buffer = var2;
         this.aClass225_Sub23_8328.position = 0;
         var3 = var2.length >> 1;
         this.anIntArray8325 = new int[var3];

         for(var4 = 0; var4 < var3; ++var4) {
            this.anIntArray8325[var4] = this.aClass225_Sub23_8328.readUnsignedShort(-937710807);
         }
      }

      if(468704015 * this.anInt8323 >= this.anIntArray8325.length) {
         return -1;
      } else {
         this.method13234(-2094919573);
         this.aClass225_Sub23_8328.buffer = var1;
         this.aClass225_Sub23_8328.position = 0;

         do {
            if(this.aClass225_Sub23_8328.position * -543666943 >= this.aClass225_Sub23_8328.buffer.length) {
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            if(null == this.aClass225_Sub23_8329.buffer) {
               if(this.aByteArrayArray8324[0] == null) {
                  this.aClass225_Sub23_8328.buffer = null;
                  return -543666943 * this.aClass225_Sub23_8328.position;
               }

               this.aClass225_Sub23_8329.buffer = this.aByteArrayArray8324[0];
            }

            int var5 = this.aClass225_Sub23_8328.buffer.length - this.aClass225_Sub23_8328.position * -543666943;
            var3 = this.aClass225_Sub23_8329.buffer.length - -543666943 * this.aClass225_Sub23_8329.position;
            if(var5 < var3) {
               this.aClass225_Sub23_8329.method13737(this.aClass225_Sub23_8328.buffer, -543666943 * this.aClass225_Sub23_8328.position, var5, 1385214721);
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            this.aClass225_Sub23_8328.method13714(this.aClass225_Sub23_8329.buffer, this.aClass225_Sub23_8329.position * -543666943, var3, -378324468);
            this.aClass225_Sub23_8329.buffer = null;
            this.aClass225_Sub23_8329.position = 0;
            this.anInt8323 += -391531537;

            for(var4 = 0; var4 < 9; ++var4) {
               this.aByteArrayArray8324[var4] = this.aByteArrayArray8324[var4 + 1];
            }

            this.aByteArrayArray8324[9] = null;
         } while(468704015 * this.anInt8323 < this.anIntArray8325.length);

         this.aClass225_Sub23_8328.buffer = null;
         return -543666943 * this.aClass225_Sub23_8328.position;
      }
   }

   int method3801(byte[] var1) throws IOException {
      int var3;
      int var4;
      if(null == this.anIntArray8325) {
         if(!this.aClass253_8327.method4506(this.anInt8326 * 1618511831, 0, (byte)44)) {
            return 0;
         }

         byte[] var2 = this.aClass253_8327.method4547(1618511831 * this.anInt8326, 0, (byte)-73);
         if(null == var2) {
            throw new IllegalStateException("");
         }

         this.aClass225_Sub23_8328.buffer = var2;
         this.aClass225_Sub23_8328.position = 0;
         var3 = var2.length >> 1;
         this.anIntArray8325 = new int[var3];

         for(var4 = 0; var4 < var3; ++var4) {
            this.anIntArray8325[var4] = this.aClass225_Sub23_8328.readUnsignedShort(-937710807);
         }
      }

      if(468704015 * this.anInt8323 >= this.anIntArray8325.length) {
         return -1;
      } else {
         this.method13234(-1755104617);
         this.aClass225_Sub23_8328.buffer = var1;
         this.aClass225_Sub23_8328.position = 0;

         do {
            if(this.aClass225_Sub23_8328.position * -543666943 >= this.aClass225_Sub23_8328.buffer.length) {
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            if(null == this.aClass225_Sub23_8329.buffer) {
               if(this.aByteArrayArray8324[0] == null) {
                  this.aClass225_Sub23_8328.buffer = null;
                  return -543666943 * this.aClass225_Sub23_8328.position;
               }

               this.aClass225_Sub23_8329.buffer = this.aByteArrayArray8324[0];
            }

            int var5 = this.aClass225_Sub23_8328.buffer.length - this.aClass225_Sub23_8328.position * -543666943;
            var3 = this.aClass225_Sub23_8329.buffer.length - -543666943 * this.aClass225_Sub23_8329.position;
            if(var5 < var3) {
               this.aClass225_Sub23_8329.method13737(this.aClass225_Sub23_8328.buffer, -543666943 * this.aClass225_Sub23_8328.position, var5, 1385214721);
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            this.aClass225_Sub23_8328.method13714(this.aClass225_Sub23_8329.buffer, this.aClass225_Sub23_8329.position * -543666943, var3, -1422451114);
            this.aClass225_Sub23_8329.buffer = null;
            this.aClass225_Sub23_8329.position = 0;
            this.anInt8323 += -391531537;

            for(var4 = 0; var4 < 9; ++var4) {
               this.aByteArrayArray8324[var4] = this.aByteArrayArray8324[var4 + 1];
            }

            this.aByteArrayArray8324[9] = null;
         } while(468704015 * this.anInt8323 < this.anIntArray8325.length);

         this.aClass225_Sub23_8328.buffer = null;
         return -543666943 * this.aClass225_Sub23_8328.position;
      }
   }

   int method3802(byte[] var1) throws IOException {
      int var3;
      int var4;
      if(null == this.anIntArray8325) {
         if(!this.aClass253_8327.method4506(this.anInt8326 * 1618511831, 0, (byte)-41)) {
            return 0;
         }

         byte[] var2 = this.aClass253_8327.method4547(1618511831 * this.anInt8326, 0, (byte)-13);
         if(null == var2) {
            throw new IllegalStateException("");
         }

         this.aClass225_Sub23_8328.buffer = var2;
         this.aClass225_Sub23_8328.position = 0;
         var3 = var2.length >> 1;
         this.anIntArray8325 = new int[var3];

         for(var4 = 0; var4 < var3; ++var4) {
            this.anIntArray8325[var4] = this.aClass225_Sub23_8328.readUnsignedShort(-937710807);
         }
      }

      if(468704015 * this.anInt8323 >= this.anIntArray8325.length) {
         return -1;
      } else {
         this.method13234(-825632038);
         this.aClass225_Sub23_8328.buffer = var1;
         this.aClass225_Sub23_8328.position = 0;

         do {
            if(this.aClass225_Sub23_8328.position * -543666943 >= this.aClass225_Sub23_8328.buffer.length) {
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            if(null == this.aClass225_Sub23_8329.buffer) {
               if(this.aByteArrayArray8324[0] == null) {
                  this.aClass225_Sub23_8328.buffer = null;
                  return -543666943 * this.aClass225_Sub23_8328.position;
               }

               this.aClass225_Sub23_8329.buffer = this.aByteArrayArray8324[0];
            }

            int var5 = this.aClass225_Sub23_8328.buffer.length - this.aClass225_Sub23_8328.position * -543666943;
            var3 = this.aClass225_Sub23_8329.buffer.length - -543666943 * this.aClass225_Sub23_8329.position;
            if(var5 < var3) {
               this.aClass225_Sub23_8329.method13737(this.aClass225_Sub23_8328.buffer, -543666943 * this.aClass225_Sub23_8328.position, var5, 1385214721);
               this.aClass225_Sub23_8328.buffer = null;
               return var1.length;
            }

            this.aClass225_Sub23_8328.method13714(this.aClass225_Sub23_8329.buffer, this.aClass225_Sub23_8329.position * -543666943, var3, -438767261);
            this.aClass225_Sub23_8329.buffer = null;
            this.aClass225_Sub23_8329.position = 0;
            this.anInt8323 += -391531537;

            for(var4 = 0; var4 < 9; ++var4) {
               this.aByteArrayArray8324[var4] = this.aByteArrayArray8324[var4 + 1];
            }

            this.aByteArrayArray8324[9] = null;
         } while(468704015 * this.anInt8323 < this.anIntArray8325.length);

         this.aClass225_Sub23_8328.buffer = null;
         return -543666943 * this.aClass225_Sub23_8328.position;
      }
   }

   public void method13235() {
      if(null != this.anIntArray8325) {
         for(int var1 = 0; var1 < 10 && var1 + this.anInt8323 * 468704015 < this.anIntArray8325.length; ++var1) {
            if(null == this.aByteArrayArray8324[var1] && this.aClass253_8327.method4506(this.anIntArray8325[var1 + this.anInt8323 * 468704015], 0, (byte)23)) {
               this.aByteArrayArray8324[var1] = this.aClass253_8327.method4547(this.anIntArray8325[468704015 * this.anInt8323 + var1], 0, (byte)-94);
            }
         }

      }
   }

   static Class554 method13236(RS2Buffer var0, int var1) {
      int var2 = var0.readUnsignedByte(-700559597);
      int var3 = var0.readUnsignedByte(-700559597);
      int var4 = var0.readUnsignedByte(-700559597);
      int[] var5 = new int[var4];

      for(int var6 = 0; var6 < var4; ++var6) {
         var5[var6] = var0.readUnsignedByte(-700559597);
      }

      return new Class554(var2, var3, var5);
   }

   static final void method13237(Class508 var0, byte var1) {
      var0.anInt6007 -= 907612006;
      if(var0.aLongArray6008[993230715 * var0.anInt6007] <= var0.aLongArray6008[1 + 993230715 * var0.anInt6007]) {
         var0.anInt6025 += 2029505775 * var0.anIntArray6023[1651565071 * var0.anInt6025];
      }

   }

   static final void method13238(Class508 var0, Class515_Sub1_Sub4_Sub4 var1, int var2) {
      var0.anInt6003 -= 688187311;
      int var3 = var0.anIntArray6027[var0.anInt6003 * -937710807];
      int var4 = var0.anIntArray6027[1 + -937710807 * var0.anInt6003];
      int var5 = var0.anIntArray6027[-937710807 * var0.anInt6003 + 2];
      int var6 = var0.anIntArray6027[-937710807 * var0.anInt6003 + 3];
      int var7 = var0.anIntArray6027[4 + -937710807 * var0.anInt6003];
      boolean var8 = var0.anIntArray6027[5 + var0.anInt6003 * -937710807] == 1;
      int var9 = var0.anIntArray6027[var0.anInt6003 * -937710807 + 6];
      if(Class336.aClass35_Sub1_4206.method914(2118259712) != Class106.aClass106_1034) {
         throw new RuntimeException();
      } else {
         Class66_Sub2 var10 = (Class66_Sub2)Class336.aClass35_Sub1_4206.method953(185919941);
         Class321 var11 = new Class321();
         Class321 var12 = new Class321();
         var11.method5784(0.0F, 1.0F, 0.0F, (float)(2.0D * 3.141592653589793D * (double)var7 / 16384.0D));
         Class326 var13 = new Class326(1.0F, 0.0F, 0.0F);
         var13.method5871(var11);
         var13.method5877();
         var12.method5783(var13, (float)(2.0D * 3.141592653589793D * (double)var6 / 16384.0D));
         var11.method5795(var12);
         if(var1 != null) {
            var10.method13073(var1, new Class326((float)var3, (float)var4, (float)var5), var11, var8, var9, client.aClass279_7807.method4920(-117136075 * Class181.anInt2197, 918224736), client.aClass279_7807.method5051(702826507).anIntArrayArrayArray4102, -544518159);
         }

      }
   }
}
