// 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 System;
using System.Runtime.InteropServices;

namespace \u000E\u0002
{
  internal sealed class \u0015
  {
    private byte[] \u0001 = new byte[32768];
    private int \u0002;
    private int \u0003;

    public void Write([In] int obj0)
    {
      \u0015 obj = this;
      int num1;
      int num2 = num1 = obj.\u0003;
      obj.\u0003 = num1 + 1;
      if (num2 == 32768)
        throw new InvalidOperationException(\u0008.\u000E\u0003(3139));
      this.\u0001[this.\u0002++] = (byte) obj0;
      this.\u0002 &= (int) short.MaxValue;
    }

    private void \u001B\u0003([In] int obj0, [In] int obj1, [In] int obj2)
    {
      while (obj1-- > 0)
      {
        byte[] numArray = this.\u0001;
        \u0015 obj = this;
        int num1;
        int num2 = num1 = obj.\u0002;
        obj.\u0002 = num1 + 1;
        int index = num2;
        int num3 = (int) this.\u0001[obj0++];
        numArray[index] = (byte) num3;
        this.\u0002 &= (int) short.MaxValue;
        obj0 &= (int) short.MaxValue;
      }
    }

    public void \u001C\u0003([In] int obj0, [In] int obj1)
    {
      if ((this.\u0003 += obj0) > 32768)
        throw new InvalidOperationException(\u0008.\u000E\u0003(3139));
      int num1 = this.\u0002 - obj1 & (int) short.MaxValue;
      int num2 = 32768 - obj0;
      if (num1 <= num2 && this.\u0002 < num2)
      {
        if (obj0 <= obj1)
        {
          \u008F\u0003.\u0098((Array) this.\u0001, num1, (Array) this.\u0001, this.\u0002, obj0);
          this.\u0002 += obj0;
        }
        else
        {
          while (obj0-- > 0)
            this.\u0001[this.\u0002++] = this.\u0001[num1++];
        }
      }
      else
        this.\u001B\u0003(num1, obj0, obj1);
    }

    public int \u001D\u0003([In] \u0014 obj0, [In] int obj1)
    {
      obj1 = \u0013\u0005.\u0087\u0003(\u0013\u0005.\u0087\u0003(obj1, 32768 - this.\u0003), obj0.\u0016\u0003());
      int num1 = 32768 - this.\u0002;
      int num2;
      if (obj1 > num1)
      {
        num2 = obj0.\u0019\u0003(this.\u0001, this.\u0002, num1);
        if (num2 == num1)
          num2 += obj0.\u0019\u0003(this.\u0001, 0, obj1 - num1);
      }
      else
        num2 = obj0.\u0019\u0003(this.\u0001, this.\u0002, obj1);
      this.\u0002 = this.\u0002 + num2 & (int) short.MaxValue;
      this.\u0003 += num2;
      return num2;
    }

    public int \u001E\u0003() => 32768 - this.\u0003;

    public int \u001F\u0003() => this.\u0003;

    public int \u007F\u0003([In] byte[] obj0, [In] int obj1, [In] int obj2)
    {
      int num1 = this.\u0002;
      if (obj2 > this.\u0003)
        obj2 = this.\u0003;
      else
        num1 = this.\u0002 - this.\u0003 + obj2 & (int) short.MaxValue;
      int num2 = obj2;
      int num3 = obj2 - num1;
      if (num3 > 0)
      {
        \u008F\u0003.\u0098((Array) this.\u0001, 32768 - num3, (Array) obj0, obj1, num3);
        obj1 += num3;
        obj2 = num1;
      }
      \u008F\u0003.\u0098((Array) this.\u0001, num1 - obj2, (Array) obj0, obj1, obj2);
      this.\u0003 -= num2;
      if (this.\u0003 < 0)
        throw new InvalidOperationException();
      return num2;
    }
  }
}
