import java.nio.ByteBuffer;

public class Class59 {

   int anInt541;
   int anInt542;
   Class545_Sub2 aClass545_Sub2_543;
   static final int anInt544 = 128;
   int anInt545;
   int[] anIntArray546;
   boolean aBool547 = true;
   Class343 aClass343_548;
   int anInt549;
   Interface40 anInterface40_550;
   Interface33 anInterface33_551;
   int anInt552;
   static final int anInt553 = 7;
   byte[] aByteArray554;
   int anInt555 = -1;


   void method1281(Class68 var1, Interface40 var2, int var3, int var4) {
      if(var4 > 0) {
         this.method1284();
         this.aClass545_Sub2_543.method15079(var2);
         var1.anInterface33_645 = this.anInterface33_551;
         var1.anInt660 = this.anInt541;
         var1.anInt650 = this.anInt542 - this.anInt541 + 1;
         var1.anInt662 = var3;
         var1.anInt663 = var4;
         var1.method1442(false);
      }

   }

   void method1282(Class68 var1) {
      this.method1283(var1, this.anInterface40_550, 0, this.anInt549);
   }

   void method1283(Class68 var1, Interface40 var2, int var3, int var4) {
      if(var4 > 0) {
         this.method1284();
         this.aClass545_Sub2_543.method15079(var2);
         var1.anInterface33_645 = this.anInterface33_551;
         var1.anInt660 = this.anInt541;
         var1.anInt650 = this.anInt542 - this.anInt541 + 1;
         var1.anInt662 = var3;
         var1.anInt663 = var4;
         var1.method1442(false);
      }

   }

   void method1284() {
      if(this.aBool547) {
         this.aBool547 = false;
         byte[] var1 = this.aClass343_548.aByteArray4380;
         int var2 = 0;
         int var3 = this.aClass343_548.anInt4378;
         int var4 = this.anInt545 + this.anInt552 * this.aClass343_548.anInt4378;

         int var5;
         for(var5 = -128; var5 < 0; ++var5) {
            var2 = (var2 << 8) - var2;

            for(int var6 = -128; var6 < 0; ++var6) {
               if(var1[var4++] != 0) {
                  ++var2;
               }
            }

            var4 += var3 - 128;
         }

         if(this.anInterface33_551 != null && this.anInt555 == var2) {
            this.aBool547 = false;
         } else {
            this.anInt555 = var2;
            var5 = 0;
            var4 = this.anInt545 + this.anInt552 * var3;
            int var7;
            int var8;
            int var9;
            if(this.aClass545_Sub2_543.method15038(Class98.aClass98_987, Class91.aClass91_897)) {
               if(this.aByteArray554 == null) {
                  this.aByteArray554 = new byte[16384];
               }

               byte[] var10 = this.aByteArray554;

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

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

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

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

                        var10[var5++] = (byte)(17 * var9);
                     }

                     ++var4;
                  }

                  var4 += this.aClass343_548.anInt4378 - 128;
               }

               if(this.anInterface33_551 == null) {
                  this.anInterface33_551 = this.aClass545_Sub2_543.method15041(Class98.aClass98_987, 128, 128, false, this.aByteArray554);
                  this.anInterface33_551.method187(false, false);
               } else {
                  this.anInterface33_551.method205(0, 0, 128, 128, this.aByteArray554, Class98.aClass98_987, 0, 128);
               }
            } else {
               if(this.anIntArray546 == null) {
                  this.anIntArray546 = new int[16384];
               }

               int[] var11 = this.anIntArray546;

               for(var7 = -128; var7 < 0; ++var7) {
                  for(var8 = -128; var8 < 0; ++var8) {
                     if(var1[var4] != 0) {
                        var11[var5++] = 1140850688;
                     } else {
                        var9 = 0;
                        if(var1[var4 - 1] != 0) {
                           ++var9;
                        }

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

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

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

                        var11[var5++] = 17 * var9 << 24;
                     }

                     ++var4;
                  }

                  var4 += this.aClass343_548.anInt4378 - 128;
               }

               if(this.anInterface33_551 == null) {
                  this.anInterface33_551 = this.aClass545_Sub2_543.method15040(128, 128, false, this.anIntArray546);
                  this.anInterface33_551.method187(false, false);
               } else {
                  this.anInterface33_551.method200(0, 0, 128, 128, this.anIntArray546, 0, 128);
               }
            }

         }
      }
   }

   Class59(Class545_Sub2 var1, Class343 var2, Class400_Sub2 var3, int var4, int var5, int var6, int var7, int var8) {
      this.aClass545_Sub2_543 = var1;
      this.aClass343_548 = var2;
      this.anInt545 = var7;
      this.anInt552 = 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.aShortArrayArray9431[var14++];
            if(var16 != null) {
               var10 += var16.length;
            }
         }
      }

      if(var10 > 0) {
         this.anInt542 = Integer.MIN_VALUE;
         this.anInt541 = Integer.MAX_VALUE;
         this.anInterface40_550 = this.aClass545_Sub2_543.method15075(false);
         this.anInterface40_550.method232(var10);
         ByteBuffer var20 = this.aClass545_Sub2_543.aByteBuffer9763;
         var20.clear();

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

            for(int var21 = 0; var21 < var9; ++var21) {
               short[] var17 = var3.aShortArrayArray9431[var15++];
               if(var17 != null) {
                  for(int var18 = 0; var18 < var17.length; ++var18) {
                     int var19 = var17[var18] & '\uffff';
                     if(var19 < this.anInt541) {
                        this.anInt541 = var19;
                     }

                     if(var19 > this.anInt542) {
                        this.anInt542 = var19;
                     }

                     var20.putShort((short)var19);
                  }
               }
            }
         }

         this.anInterface40_550.method217(0, var20.position(), this.aClass545_Sub2_543.aLong9730);
         this.anInt549 = var10 / 3;
      } else {
         this.anInt549 = 0;
         this.anInterface33_551 = null;
      }

   }

   void method1285(Class68 var1, Interface40 var2, int var3, int var4) {
      if(var4 > 0) {
         this.method1284();
         this.aClass545_Sub2_543.method15079(var2);
         var1.anInterface33_645 = this.anInterface33_551;
         var1.anInt660 = this.anInt541;
         var1.anInt650 = this.anInt542 - this.anInt541 + 1;
         var1.anInt662 = var3;
         var1.anInt663 = var4;
         var1.method1442(false);
      }

   }

   void method1286(Class68 var1, Interface40 var2, int var3, int var4) {
      if(var4 > 0) {
         this.method1284();
         this.aClass545_Sub2_543.method15079(var2);
         var1.anInterface33_645 = this.anInterface33_551;
         var1.anInt660 = this.anInt541;
         var1.anInt650 = this.anInt542 - this.anInt541 + 1;
         var1.anInt662 = var3;
         var1.anInt663 = var4;
         var1.method1442(false);
      }

   }

   void method1287() {
      if(this.aBool547) {
         this.aBool547 = false;
         byte[] var1 = this.aClass343_548.aByteArray4380;
         int var2 = 0;
         int var3 = this.aClass343_548.anInt4378;
         int var4 = this.anInt545 + this.anInt552 * this.aClass343_548.anInt4378;

         int var5;
         for(var5 = -128; var5 < 0; ++var5) {
            var2 = (var2 << 8) - var2;

            for(int var6 = -128; var6 < 0; ++var6) {
               if(var1[var4++] != 0) {
                  ++var2;
               }
            }

            var4 += var3 - 128;
         }

         if(this.anInterface33_551 != null && this.anInt555 == var2) {
            this.aBool547 = false;
         } else {
            this.anInt555 = var2;
            var5 = 0;
            var4 = this.anInt545 + this.anInt552 * var3;
            int var7;
            int var8;
            int var9;
            if(this.aClass545_Sub2_543.method15038(Class98.aClass98_987, Class91.aClass91_897)) {
               if(this.aByteArray554 == null) {
                  this.aByteArray554 = new byte[16384];
               }

               byte[] var10 = this.aByteArray554;

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

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

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

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

                        var10[var5++] = (byte)(17 * var9);
                     }

                     ++var4;
                  }

                  var4 += this.aClass343_548.anInt4378 - 128;
               }

               if(this.anInterface33_551 == null) {
                  this.anInterface33_551 = this.aClass545_Sub2_543.method15041(Class98.aClass98_987, 128, 128, false, this.aByteArray554);
                  this.anInterface33_551.method187(false, false);
               } else {
                  this.anInterface33_551.method205(0, 0, 128, 128, this.aByteArray554, Class98.aClass98_987, 0, 128);
               }
            } else {
               if(this.anIntArray546 == null) {
                  this.anIntArray546 = new int[16384];
               }

               int[] var11 = this.anIntArray546;

               for(var7 = -128; var7 < 0; ++var7) {
                  for(var8 = -128; var8 < 0; ++var8) {
                     if(var1[var4] != 0) {
                        var11[var5++] = 1140850688;
                     } else {
                        var9 = 0;
                        if(var1[var4 - 1] != 0) {
                           ++var9;
                        }

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

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

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

                        var11[var5++] = 17 * var9 << 24;
                     }

                     ++var4;
                  }

                  var4 += this.aClass343_548.anInt4378 - 128;
               }

               if(this.anInterface33_551 == null) {
                  this.anInterface33_551 = this.aClass545_Sub2_543.method15040(128, 128, false, this.anIntArray546);
                  this.anInterface33_551.method187(false, false);
               } else {
                  this.anInterface33_551.method200(0, 0, 128, 128, this.anIntArray546, 0, 128);
               }
            }

         }
      }
   }

   void method1288() {
      if(this.aBool547) {
         this.aBool547 = false;
         byte[] var1 = this.aClass343_548.aByteArray4380;
         int var2 = 0;
         int var3 = this.aClass343_548.anInt4378;
         int var4 = this.anInt545 + this.anInt552 * this.aClass343_548.anInt4378;

         int var5;
         for(var5 = -128; var5 < 0; ++var5) {
            var2 = (var2 << 8) - var2;

            for(int var6 = -128; var6 < 0; ++var6) {
               if(var1[var4++] != 0) {
                  ++var2;
               }
            }

            var4 += var3 - 128;
         }

         if(this.anInterface33_551 != null && this.anInt555 == var2) {
            this.aBool547 = false;
         } else {
            this.anInt555 = var2;
            var5 = 0;
            var4 = this.anInt545 + this.anInt552 * var3;
            int var7;
            int var8;
            int var9;
            if(this.aClass545_Sub2_543.method15038(Class98.aClass98_987, Class91.aClass91_897)) {
               if(this.aByteArray554 == null) {
                  this.aByteArray554 = new byte[16384];
               }

               byte[] var10 = this.aByteArray554;

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

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

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

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

                        var10[var5++] = (byte)(17 * var9);
                     }

                     ++var4;
                  }

                  var4 += this.aClass343_548.anInt4378 - 128;
               }

               if(this.anInterface33_551 == null) {
                  this.anInterface33_551 = this.aClass545_Sub2_543.method15041(Class98.aClass98_987, 128, 128, false, this.aByteArray554);
                  this.anInterface33_551.method187(false, false);
               } else {
                  this.anInterface33_551.method205(0, 0, 128, 128, this.aByteArray554, Class98.aClass98_987, 0, 128);
               }
            } else {
               if(this.anIntArray546 == null) {
                  this.anIntArray546 = new int[16384];
               }

               int[] var11 = this.anIntArray546;

               for(var7 = -128; var7 < 0; ++var7) {
                  for(var8 = -128; var8 < 0; ++var8) {
                     if(var1[var4] != 0) {
                        var11[var5++] = 1140850688;
                     } else {
                        var9 = 0;
                        if(var1[var4 - 1] != 0) {
                           ++var9;
                        }

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

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

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

                        var11[var5++] = 17 * var9 << 24;
                     }

                     ++var4;
                  }

                  var4 += this.aClass343_548.anInt4378 - 128;
               }

               if(this.anInterface33_551 == null) {
                  this.anInterface33_551 = this.aClass545_Sub2_543.method15040(128, 128, false, this.anIntArray546);
                  this.anInterface33_551.method187(false, false);
               } else {
                  this.anInterface33_551.method200(0, 0, 128, 128, this.anIntArray546, 0, 128);
               }
            }

         }
      }
   }
}
