
public class Class136 {

   Class162_Sub2 aClass162_Sub2_1592;
   boolean aBool1593 = true;
   Class545_Sub1 aClass545_Sub1_1594;
   Class147_Sub4 aClass147_Sub4_1595;
   int anInt1596;
   int anInt1597;
   Interface15 anInterface15_1598;
   int anInt1599 = -1;
   int anInt1600;
   static final int anInt1601 = 7;
   Class155 aClass155_1602;
   static final int anInt1603 = 128;


   void method2605(byte[] var1, int var2) {
      this.aClass162_Sub2_1592.method74(5123, var1, var2 * 2);
      this.method2608(this.aClass162_Sub2_1592, var2);
   }

   void method2606() {
      if(this.aBool1593) {
         this.aBool1593 = false;
         byte[] var1 = this.aClass155_1602.aByteArray1939;
         byte[] var2 = this.aClass545_Sub1_1594.aByteArray9298;
         int var3 = 0;
         int var4 = this.aClass155_1602.anInt1937;
         int var5 = this.anInt1596 + this.anInt1597 * this.aClass155_1602.anInt1937;

         int var6;
         int var7;
         for(var6 = -128; var6 < 0; ++var6) {
            var3 = (var3 << 8) - var3;

            for(var7 = -128; var7 < 0; ++var7) {
               if(var1[var5++] != 0) {
                  ++var3;
               }
            }

            var5 += var4 - 128;
         }

         if(this.aClass147_Sub4_1595 != null && this.anInt1599 == var3) {
            this.aBool1593 = false;
         } else {
            this.anInt1599 = var3;
            var6 = 0;
            var5 = this.anInt1596 + this.anInt1597 * var4;

            for(var7 = -128; var7 < 0; ++var7) {
               for(int var8 = -128; var8 < 0; ++var8) {
                  if(var1[var5] != 0) {
                     var2[var6++] = 68;
                  } else {
                     int var9 = 0;
                     if(var1[var5 - 1] != 0) {
                        ++var9;
                     }

                     if(var1[var5 + 1] != 0) {
                        ++var9;
                     }

                     if(var1[var5 - var4] != 0) {
                        ++var9;
                     }

                     if(var1[var5 + var4] != 0) {
                        ++var9;
                     }

                     var2[var6++] = (byte)(17 * var9);
                  }

                  ++var5;
               }

               var5 += this.aClass155_1602.anInt1937 - 128;
            }

            if(this.aClass147_Sub4_1595 == null) {
               this.aClass147_Sub4_1595 = new Class147_Sub4(this.aClass545_Sub1_1594, 3553, Class98.aClass98_987, Class91.aClass91_897, 128, 128, false, this.aClass545_Sub1_1594.aByteArray9298, Class98.aClass98_987, false);
               this.aClass147_Sub4_1595.method15463(false, false);
               this.aClass147_Sub4_1595.method2694(true);
            } else {
               this.aClass147_Sub4_1595.method15461(0, 0, 128, 128, this.aClass545_Sub1_1594.aByteArray9298, Class98.aClass98_987, 0, 0, false);
            }

         }
      }
   }

   void method2607(Interface15 var1, int var2) {
      if(var2 != 0) {
         this.method2609();
         this.aClass545_Sub1_1594.method14725(this.aClass147_Sub4_1595);
         this.aClass545_Sub1_1594.method14610(var1, 4, 0, var2);
      }
   }

   void method2608(Interface15 var1, int var2) {
      if(var2 != 0) {
         this.method2609();
         this.aClass545_Sub1_1594.method14725(this.aClass147_Sub4_1595);
         this.aClass545_Sub1_1594.method14610(var1, 4, 0, var2);
      }
   }

   void method2609() {
      if(this.aBool1593) {
         this.aBool1593 = false;
         byte[] var1 = this.aClass155_1602.aByteArray1939;
         byte[] var2 = this.aClass545_Sub1_1594.aByteArray9298;
         int var3 = 0;
         int var4 = this.aClass155_1602.anInt1937;
         int var5 = this.anInt1596 + this.anInt1597 * this.aClass155_1602.anInt1937;

         int var6;
         int var7;
         for(var6 = -128; var6 < 0; ++var6) {
            var3 = (var3 << 8) - var3;

            for(var7 = -128; var7 < 0; ++var7) {
               if(var1[var5++] != 0) {
                  ++var3;
               }
            }

            var5 += var4 - 128;
         }

         if(this.aClass147_Sub4_1595 != null && this.anInt1599 == var3) {
            this.aBool1593 = false;
         } else {
            this.anInt1599 = var3;
            var6 = 0;
            var5 = this.anInt1596 + this.anInt1597 * var4;

            for(var7 = -128; var7 < 0; ++var7) {
               for(int var8 = -128; var8 < 0; ++var8) {
                  if(var1[var5] != 0) {
                     var2[var6++] = 68;
                  } else {
                     int var9 = 0;
                     if(var1[var5 - 1] != 0) {
                        ++var9;
                     }

                     if(var1[var5 + 1] != 0) {
                        ++var9;
                     }

                     if(var1[var5 - var4] != 0) {
                        ++var9;
                     }

                     if(var1[var5 + var4] != 0) {
                        ++var9;
                     }

                     var2[var6++] = (byte)(17 * var9);
                  }

                  ++var5;
               }

               var5 += this.aClass155_1602.anInt1937 - 128;
            }

            if(this.aClass147_Sub4_1595 == null) {
               this.aClass147_Sub4_1595 = new Class147_Sub4(this.aClass545_Sub1_1594, 3553, Class98.aClass98_987, Class91.aClass91_897, 128, 128, false, this.aClass545_Sub1_1594.aByteArray9298, Class98.aClass98_987, false);
               this.aClass147_Sub4_1595.method15463(false, false);
               this.aClass147_Sub4_1595.method2694(true);
            } else {
               this.aClass147_Sub4_1595.method15461(0, 0, 128, 128, this.aClass545_Sub1_1594.aByteArray9298, Class98.aClass98_987, 0, 0, false);
            }

         }
      }
   }

   void method2610() {
      this.method2608(this.anInterface15_1598, this.anInt1600);
   }

   void method2611() {
      this.method2608(this.anInterface15_1598, this.anInt1600);
   }

   void method2612() {
      this.method2608(this.anInterface15_1598, this.anInt1600);
   }

   void method2613(byte[] var1, int var2) {
      this.aClass162_Sub2_1592.method74(5123, var1, var2 * 2);
      this.method2608(this.aClass162_Sub2_1592, var2);
   }

   void method2614(byte[] var1, int var2) {
      this.aClass162_Sub2_1592.method74(5123, var1, var2 * 2);
      this.method2608(this.aClass162_Sub2_1592, var2);
   }

   void method2615(Interface15 var1, int var2) {
      if(var2 != 0) {
         this.method2609();
         this.aClass545_Sub1_1594.method14725(this.aClass147_Sub4_1595);
         this.aClass545_Sub1_1594.method14610(var1, 4, 0, var2);
      }
   }

   void method2616(Interface15 var1, int var2) {
      if(var2 != 0) {
         this.method2609();
         this.aClass545_Sub1_1594.method14725(this.aClass147_Sub4_1595);
         this.aClass545_Sub1_1594.method14610(var1, 4, 0, var2);
      }
   }

   Class136(Class545_Sub1 var1, Class155 var2, Class400_Sub3 var3, int var4, int var5, int var6, int var7, int var8) {
      this.aClass545_Sub1_1594 = var1;
      this.aClass155_1602 = var2;
      this.anInt1596 = var7;
      this.anInt1597 = var8;
      int var9 = 1 << var6;
      int var10 = 0;
      int var11 = var4 << var6;
      int var12 = var5 << var6;

      int var14;
      int var15;
      for(int var13 = 0; var13 < var9; ++var13) {
         var14 = (var12 + var13) * var3.anInt4911 * 1724373523 + var11;

         for(var15 = 0; var15 < var9; ++var15) {
            short[] var16 = var3.aShortArrayArray9566[var14++];
            if(var16 != null) {
               var10 += var16.length;
            }
         }
      }

      this.anInt1600 = var10;
      if(var10 > 0) {
         RS2Buffer var19 = new RS2Buffer(var10 * 2);
         short[] var17;
         int var18;
         int var20;
         if(this.aClass545_Sub1_1594.aBool9257) {
            for(var14 = 0; var14 < var9; ++var14) {
               var15 = (var12 + var14) * var3.anInt4911 * 1724373523 + var11;

               for(var20 = 0; var20 < var9; ++var20) {
                  var17 = var3.aShortArrayArray9566[var15++];
                  if(var17 != null) {
                     for(var18 = 0; var18 < var17.length; ++var18) {
                        var19.writeShort(var17[var18] & '\uffff', 537492154);
                     }
                  }
               }
            }
         } else {
            for(var14 = 0; var14 < var9; ++var14) {
               var15 = (var12 + var14) * var3.anInt4911 * 1724373523 + var11;

               for(var20 = 0; var20 < var9; ++var20) {
                  var17 = var3.aShortArrayArray9566[var15++];
                  if(var17 != null) {
                     for(var18 = 0; var18 < var17.length; ++var18) {
                        var19.method13704(var17[var18] & '\uffff', 1094649230);
                     }
                  }
               }
            }
         }

         this.anInterface15_1598 = this.aClass545_Sub1_1594.method14581(5123, var19.buffer, var19.position * -543666943, false);
         this.aClass162_Sub2_1592 = new Class162_Sub2(this.aClass545_Sub1_1594, 5123, (byte[])null, 1);
      } else {
         this.aClass147_Sub4_1595 = null;
      }

   }

   void method2617() {
      if(this.aBool1593) {
         this.aBool1593 = false;
         byte[] var1 = this.aClass155_1602.aByteArray1939;
         byte[] var2 = this.aClass545_Sub1_1594.aByteArray9298;
         int var3 = 0;
         int var4 = this.aClass155_1602.anInt1937;
         int var5 = this.anInt1596 + this.anInt1597 * this.aClass155_1602.anInt1937;

         int var6;
         int var7;
         for(var6 = -128; var6 < 0; ++var6) {
            var3 = (var3 << 8) - var3;

            for(var7 = -128; var7 < 0; ++var7) {
               if(var1[var5++] != 0) {
                  ++var3;
               }
            }

            var5 += var4 - 128;
         }

         if(this.aClass147_Sub4_1595 != null && this.anInt1599 == var3) {
            this.aBool1593 = false;
         } else {
            this.anInt1599 = var3;
            var6 = 0;
            var5 = this.anInt1596 + this.anInt1597 * var4;

            for(var7 = -128; var7 < 0; ++var7) {
               for(int var8 = -128; var8 < 0; ++var8) {
                  if(var1[var5] != 0) {
                     var2[var6++] = 68;
                  } else {
                     int var9 = 0;
                     if(var1[var5 - 1] != 0) {
                        ++var9;
                     }

                     if(var1[var5 + 1] != 0) {
                        ++var9;
                     }

                     if(var1[var5 - var4] != 0) {
                        ++var9;
                     }

                     if(var1[var5 + var4] != 0) {
                        ++var9;
                     }

                     var2[var6++] = (byte)(17 * var9);
                  }

                  ++var5;
               }

               var5 += this.aClass155_1602.anInt1937 - 128;
            }

            if(this.aClass147_Sub4_1595 == null) {
               this.aClass147_Sub4_1595 = new Class147_Sub4(this.aClass545_Sub1_1594, 3553, Class98.aClass98_987, Class91.aClass91_897, 128, 128, false, this.aClass545_Sub1_1594.aByteArray9298, Class98.aClass98_987, false);
               this.aClass147_Sub4_1595.method15463(false, false);
               this.aClass147_Sub4_1595.method2694(true);
            } else {
               this.aClass147_Sub4_1595.method15461(0, 0, 128, 128, this.aClass545_Sub1_1594.aByteArray9298, Class98.aClass98_987, 0, 0, false);
            }

         }
      }
   }

   void method2618(byte[] var1, int var2) {
      this.aClass162_Sub2_1592.method74(5123, var1, var2 * 2);
      this.method2608(this.aClass162_Sub2_1592, var2);
   }
}
