// Decompiled with JetBrains decompiler
// Type: .
// Assembly: WindowsBC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9909ee17073e3364
// MVID: 658BFC85-36E1-493D-98E6-AE9127D73D60
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare.00004-msil\Trojan-Downloader.MSIL.BitCoinMiner.c-64f742a0b28b2c3d2a62ef6607fcfd5fa55b793a1aff3a6c11e014e3b119149e.exe

using \u000E;
using \u000E\u0002;
using \u0017\u0002;
using ICSharpCode.SharpZipLib;
using System;
using System.Runtime.InteropServices;

namespace \u0017\u0002
{
  internal sealed class \u0016
  {
    private short[] \u0001;
    public static \u0016 \u0002;
    public static \u0016 \u0003;

    static \u0016()
    {
      try
      {
        byte[] numArray1 = new byte[288];
        int num1 = 0;
        while (num1 < 144)
          numArray1[num1++] = (byte) 8;
        while (num1 < 256)
          numArray1[num1++] = (byte) 9;
        while (num1 < 280)
          numArray1[num1++] = (byte) 7;
        while (num1 < 288)
          numArray1[num1++] = (byte) 8;
        \u0016.\u0002 = new \u0016(numArray1);
        byte[] numArray2 = new byte[32];
        int num2 = 0;
        while (num2 < 32)
          numArray2[num2++] = (byte) 5;
        \u0016.\u0003 = new \u0016(numArray2);
      }
      catch (Exception ex)
      {
        throw new SharpZipBaseException(\u0008.\u000E\u0003(3688));
      }
    }

    public \u0016([In] byte[] obj0) => this.\u0080\u0003(obj0);

    private void \u0080\u0003([In] byte[] obj0)
    {
      int[] numArray1 = new int[16];
      int[] numArray2 = new int[16];
      for (int index1 = 0; index1 < obj0.Length; ++index1)
      {
        int index2 = (int) obj0[index1];
        if (index2 > 0)
          ++numArray1[index2];
      }
      int num1 = 0;
      int length = 512;
      for (int index = 1; index <= 15; ++index)
      {
        numArray2[index] = num1;
        num1 += numArray1[index] << 16 - index;
        if (index >= 10)
        {
          int num2 = numArray2[index] & 130944;
          int num3 = num1 & 130944;
          length += num3 - num2 >> 16 - index;
        }
      }
      this.\u0001 = new short[length];
      int num4 = 512;
      for (int index3 = 15; index3 >= 10; --index3)
      {
        int num5 = num1 & 130944;
        num1 -= numArray1[index3] << 16 - index3;
        for (int index4 = num1 & 130944; index4 < num5; index4 += 128)
        {
          this.\u0001[(int) \u0018.\u0084\u0003(index4)] = (short) (-num4 << 4 | index3);
          num4 += 1 << index3 - 9;
        }
      }
      for (int index5 = 0; index5 < obj0.Length; ++index5)
      {
        int index6 = (int) obj0[index5];
        if (index6 != 0)
        {
          int num6 = numArray2[index6];
          int index7 = (int) \u0018.\u0084\u0003(num6);
          if (index6 <= 9)
          {
            do
            {
              this.\u0001[index7] = (short) (index5 << 4 | index6);
              index7 += 1 << index6;
            }
            while (index7 < 512);
          }
          else
          {
            int num7 = (int) this.\u0001[index7 & 511];
            int num8 = 1 << (num7 & 15);
            int num9 = -(num7 >> 4);
            do
            {
              this.\u0001[num9 | index7 >> 9] = (short) (index5 << 4 | index6);
              index7 += 1 << index6;
            }
            while (index7 < num8);
          }
          numArray2[index6] = num6 + (1 << 16 - index6);
        }
      }
    }

    public int \u0081\u0003([In] \u0014 obj0)
    {
      int index;
      if ((index = obj0.\u0013\u0003(9)) >= 0)
      {
        int num1;
        if ((num1 = (int) this.\u0001[index]) >= 0)
        {
          obj0.\u0014\u0003(num1 & 15);
          return num1 >> 4;
        }
        int num2 = -(num1 >> 4);
        int num3 = num1 & 15;
        int num4;
        if ((num4 = obj0.\u0013\u0003(num3)) >= 0)
        {
          int num5 = (int) this.\u0001[num2 | num4 >> 9];
          obj0.\u0014\u0003(num5 & 15);
          return num5 >> 4;
        }
        int num6 = obj0.\u0015\u0003();
        int num7 = obj0.\u0013\u0003(num6);
        int num8 = (int) this.\u0001[num2 | num7 >> 9];
        if ((num8 & 15) > num6)
          return -1;
        obj0.\u0014\u0003(num8 & 15);
        return num8 >> 4;
      }
      int num9 = obj0.\u0015\u0003();
      int num10 = (int) this.\u0001[obj0.\u0013\u0003(num9)];
      if (num10 < 0 || (num10 & 15) > num9)
        return -1;
      obj0.\u0014\u0003(num10 & 15);
      return num10 >> 4;
    }
  }
}
