ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid)
{
  void * D.16802;
  void * handle;

  handle = OpenProcess (2035711, 1, pid);
  if (handle == 0B) goto <D.16800>; else goto <D.16801>;
  <D.16800>:
  D.16802 = 0B;
  return D.16802;
  <D.16801>:
  D.16802 = handle;
  return D.16802;
}


ves_icall_System_Diagnostics_Process_GetPid_internal ()
{
  guint32 D.16804;

  D.16804 = GetCurrentProcessId ();
  return D.16804;
}


ves_icall_System_Diagnostics_Process_Process_free_internal (struct MonoObject * this, void * process)
{
  CloseProcess (process);
}


ves_icall_System_Diagnostics_Process_GetModules_internal (struct MonoObject * this, void * process)
{
  struct MonoImage * system_assembly.0;
  struct MonoVTable * D.16809;
  struct MonoClass * D.16810;
  struct MonoImage * system_assembly.1;
  int D.16812;
  unsigned int needed.2;
  long unsigned int D.16816;
  struct MonoClass * D.16817;
  struct MonoDomain * D.16818;
  void * D.16819;
  unsigned int D.16820;
  unsigned int D.16823;
  unsigned int num_added.3;
  long unsigned int D.16827;
  long unsigned int D.16831;
  struct MonoClass * D.16832;
  struct MonoDomain * D.16833;
  long unsigned int D.16834;
  char * D.16835;
  struct MonoObject * D.16836;
  struct MonoArray * D.16837;
  struct MonoArray * temp_arr;
  struct MonoArray * arr;
  void * mods[1024];
  gunichar2 filename[260];
  gunichar2 modname[260];
  DWORD needed;
  guint32 count;
  guint32 i;
  guint32 num_added;

  try
    {
      temp_arr = 0B;
      count = 0;
      num_added = 0;
      system_assembly.0 = system_assembly;
      if (system_assembly.0 == 0B) goto <D.16807>; else goto <D.16808>;
      <D.16807>:
      D.16809 = this->vtable;
      D.16810 = D.16809->klass;
      system_assembly.1 = D.16810->image;
      system_assembly = system_assembly.1;
      <D.16808>:
      D.16812 = EnumProcessModules (process, &mods, 8192, &needed);
      if (D.16812 != 0) goto <D.16813>; else goto <D.16814>;
      <D.16813>:
      needed.2 = needed;
      count = needed.2 / 8;
      D.16816 = (long unsigned int) count;
      D.16817 = mono_get_object_class ();
      D.16818 = mono_domain_get ();
      temp_arr = mono_array_new (D.16818, D.16817, D.16816);
      i = 0;
      goto <D.16630>;
      <D.16629>:
      D.16819 = mods[i];
      D.16820 = GetModuleBaseName (process, D.16819, &modname, 260);
      if (D.16820 != 0) goto <D.16821>; else goto <D.16822>;
      <D.16821>:
      D.16819 = mods[i];
      D.16823 = GetModuleFileNameEx (process, D.16819, &filename, 260);
      if (D.16823 != 0) goto <D.16824>; else goto <D.16825>;
      <D.16824>:
      {
        struct MonoObject * module;

        D.16819 = mods[i];
        module = process_add_module (process, D.16819, &filename, &modname);
        {
          void * * __p;

          num_added.3 = num_added;
          num_added = num_added.3 + 1;
          D.16827 = (long unsigned int) num_added.3;
          __p = mono_array_addr_with_size (temp_arr, 8, D.16827);
          mono_gc_wbarrier_set_arrayref (temp_arr, __p, module);
        }
      }
      <D.16825>:
      <D.16822>:
      i = i + 1;
      <D.16630>:
      if (i < count) goto <D.16629>; else goto <D.16631>;
      <D.16631>:
      <D.16814>:
      if (count == num_added) goto <D.16828>; else goto <D.16829>;
      <D.16828>:
      arr = temp_arr;
      goto <D.16830>;
      <D.16829>:
      D.16831 = (long unsigned int) num_added;
      D.16832 = mono_get_object_class ();
      D.16833 = mono_domain_get ();
      arr = mono_array_new (D.16833, D.16832, D.16831);
      i = 0;
      goto <D.16634>;
      <D.16633>:
      {
        void * * __p;

        D.16834 = (long unsigned int) i;
        __p = mono_array_addr_with_size (arr, 8, D.16834);
        D.16834 = (long unsigned int) i;
        D.16835 = mono_array_addr_with_size (temp_arr, 8, D.16834);
        D.16836 = MEM[(struct MonoObject * *)D.16835];
        mono_gc_wbarrier_set_arrayref (arr, __p, D.16836);
      }
      i = i + 1;
      <D.16634>:
      if (i < num_added) goto <D.16633>; else goto <D.16635>;
      <D.16635>:
      <D.16830>:
      D.16837 = arr;
      return D.16837;
    }
  finally
    {
      mods = {CLOBBER};
      filename = {CLOBBER};
      modname = {CLOBBER};
      needed = {CLOBBER};
    }
}


process_add_module (void * process, void * mod, gunichar2 * filename, gunichar2 * modulename)
{
  struct MonoImage * system_assembly.4;
  unsigned int D.16841;
  void * D.16844;
  void * D.16845;
  unsigned int D.16846;
  unsigned int D.16847;
  unsigned int D.16848;
  struct MonoObject * D.16849;
  struct MonoClass * proc_class;
  struct MonoClass * filever_class;
  struct MonoObject * item;
  struct MonoObject * filever;
  struct MonoDomain * domain;
  struct MODULEINFO modinfo;
  BOOL ok;

  try
    {
      domain = mono_domain_get ();
      system_assembly.4 = system_assembly;
      proc_class = mono_class_from_name (system_assembly.4, "System.Diagnostics", "ProcessModule");
      item = mono_object_new (domain, proc_class);
      system_assembly.4 = system_assembly;
      filever_class = mono_class_from_name (system_assembly.4, "System.Diagnostics", "FileVersionInfo");
      filever = mono_object_new (domain, filever_class);
      process_get_fileversion (filever, filename);
      D.16841 = unicode_chars (filename);
      process_set_field_string (filever, "filename", filename, D.16841);
      ok = GetModuleInformation (process, mod, &modinfo, 24);
      if (ok != 0) goto <D.16842>; else goto <D.16843>;
      <D.16842>:
      D.16844 = modinfo.lpBaseOfDll;
      process_set_field_intptr (item, "baseaddr", D.16844);
      D.16845 = modinfo.EntryPoint;
      process_set_field_intptr (item, "entryaddr", D.16845);
      D.16846 = modinfo.SizeOfImage;
      process_set_field_int (item, "memory_size", D.16846);
      <D.16843>:
      D.16847 = unicode_chars (filename);
      process_set_field_string (item, "filename", filename, D.16847);
      D.16848 = unicode_chars (modulename);
      process_set_field_string (item, "modulename", modulename, D.16848);
      process_set_field_object (item, "version_info", filever);
      D.16849 = item;
      return D.16849;
    }
  finally
    {
      modinfo = {CLOBBER};
    }
}


process_get_fileversion (struct MonoObject * filever, gunichar2 * filename)
{
  long unsigned int D.16854;
  unsigned int verinfohandle.5;
  int D.16860;
  struct VS_FIXEDFILEINFO * ffi.6;
  unsigned int D.16864;
  unsigned int D.16865;
  short unsigned int D.16866;
  unsigned int D.16867;
  short unsigned int D.16868;
  unsigned int D.16869;
  unsigned int D.16870;
  unsigned int D.16871;
  short unsigned int D.16872;
  unsigned int D.16873;
  short unsigned int D.16874;
  unsigned int D.16875;
  unsigned int D.16876;
  unsigned int D.16877;
  short unsigned int D.16878;
  unsigned int D.16879;
  short unsigned int D.16880;
  unsigned int D.16881;
  unsigned int D.16882;
  unsigned int D.16883;
  short unsigned int D.16884;
  unsigned int D.16885;
  short unsigned int D.16886;
  unsigned int D.16887;
  unsigned int D.16888;
  unsigned int D.16889;
  unsigned int D.16890;
  int D.16891;
  int D.16892;
  int D.16893;
  int D.16894;
  int D.16895;
  int D.16896;
  int D.16899;
  unsigned int trans_size.7;
  guchar * trans_data.8;
  unsigned char D.16906;
  int D.16907;
  guchar * D.16908;
  unsigned char D.16909;
  int D.16910;
  int D.16911;
  int D.16912;
  guchar * D.16913;
  unsigned char D.16914;
  int D.16915;
  int D.16916;
  int D.16917;
  guchar * D.16918;
  unsigned char D.16919;
  int D.16920;
  int D.16921;
  int D.16922;
  unsigned int D.16923;
  DWORD verinfohandle;
  struct VS_FIXEDFILEINFO * ffi;
  void * data;
  DWORD datalen;
  guchar * trans_data;
  gunichar2 * query;
  UINT ffi_size;
  UINT trans_size;
  BOOL ok;
  gunichar2 lang_buf[128];
  guint32 lang;
  guint32 lang_count;

  try
    {
      datalen = GetFileVersionInfoSize (filename, &verinfohandle);
      if (datalen != 0) goto <D.16852>; else goto <D.16853>;
      <D.16852>:
      D.16854 = (long unsigned int) datalen;
      data = monoeg_malloc0 (D.16854);
      verinfohandle.5 = verinfohandle;
      ok = GetFileVersionInfo (filename, verinfohandle.5, datalen, data);
      if (ok != 0) goto <D.16856>; else goto <D.16857>;
      <D.16856>:
      query = monoeg_g_utf8_to_utf16 ("\\", -1, 0B, 0B, 0B);
      if (query == 0B) goto <D.16858>; else goto <D.16859>;
      <D.16858>:
      monoeg_g_free (data);
      return;
      <D.16859>:
      D.16860 = VerQueryValue (data, query, &ffi, &ffi_size);
      if (D.16860 != 0) goto <D.16861>; else goto <D.16862>;
      <D.16861>:
      ffi.6 = ffi;
      D.16864 = ffi.6->dwFileVersionMS;
      D.16865 = D.16864 >> 16;
      D.16866 = (short unsigned int) D.16865;
      D.16867 = (unsigned int) D.16866;
      process_set_field_int (filever, "filemajorpart", D.16867);
      ffi.6 = ffi;
      D.16864 = ffi.6->dwFileVersionMS;
      D.16868 = (short unsigned int) D.16864;
      D.16869 = (unsigned int) D.16868;
      process_set_field_int (filever, "fileminorpart", D.16869);
      ffi.6 = ffi;
      D.16870 = ffi.6->dwFileVersionLS;
      D.16871 = D.16870 >> 16;
      D.16872 = (short unsigned int) D.16871;
      D.16873 = (unsigned int) D.16872;
      process_set_field_int (filever, "filebuildpart", D.16873);
      ffi.6 = ffi;
      D.16870 = ffi.6->dwFileVersionLS;
      D.16874 = (short unsigned int) D.16870;
      D.16875 = (unsigned int) D.16874;
      process_set_field_int (filever, "fileprivatepart", D.16875);
      ffi.6 = ffi;
      D.16876 = ffi.6->dwProductVersionMS;
      D.16877 = D.16876 >> 16;
      D.16878 = (short unsigned int) D.16877;
      D.16879 = (unsigned int) D.16878;
      process_set_field_int (filever, "productmajorpart", D.16879);
      ffi.6 = ffi;
      D.16876 = ffi.6->dwProductVersionMS;
      D.16880 = (short unsigned int) D.16876;
      D.16881 = (unsigned int) D.16880;
      process_set_field_int (filever, "productminorpart", D.16881);
      ffi.6 = ffi;
      D.16882 = ffi.6->dwProductVersionLS;
      D.16883 = D.16882 >> 16;
      D.16884 = (short unsigned int) D.16883;
      D.16885 = (unsigned int) D.16884;
      process_set_field_int (filever, "productbuildpart", D.16885);
      ffi.6 = ffi;
      D.16882 = ffi.6->dwProductVersionLS;
      D.16886 = (short unsigned int) D.16882;
      D.16887 = (unsigned int) D.16886;
      process_set_field_int (filever, "productprivatepart", D.16887);
      ffi.6 = ffi;
      D.16888 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.16889 = ffi.6->dwFileFlagsMask;
      D.16890 = D.16888 & D.16889;
      D.16891 = (int) D.16890;
      D.16892 = D.16891 & 1;
      process_set_field_bool (filever, "isdebug", D.16892);
      ffi.6 = ffi;
      D.16888 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.16889 = ffi.6->dwFileFlagsMask;
      D.16890 = D.16888 & D.16889;
      D.16891 = (int) D.16890;
      D.16893 = D.16891 & 2;
      process_set_field_bool (filever, "isprerelease", D.16893);
      ffi.6 = ffi;
      D.16888 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.16889 = ffi.6->dwFileFlagsMask;
      D.16890 = D.16888 & D.16889;
      D.16891 = (int) D.16890;
      D.16894 = D.16891 & 4;
      process_set_field_bool (filever, "ispatched", D.16894);
      ffi.6 = ffi;
      D.16888 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.16889 = ffi.6->dwFileFlagsMask;
      D.16890 = D.16888 & D.16889;
      D.16891 = (int) D.16890;
      D.16895 = D.16891 & 8;
      process_set_field_bool (filever, "isprivatebuild", D.16895);
      ffi.6 = ffi;
      D.16888 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.16889 = ffi.6->dwFileFlagsMask;
      D.16890 = D.16888 & D.16889;
      D.16891 = (int) D.16890;
      D.16896 = D.16891 & 32;
      process_set_field_bool (filever, "isspecialbuild", D.16896);
      <D.16862>:
      monoeg_g_free (query);
      query = monoeg_g_utf8_to_utf16 ("\\VarFileInfo\\Translation", -1, 0B, 0B, 0B);
      if (query == 0B) goto <D.16897>; else goto <D.16898>;
      <D.16897>:
      monoeg_g_free (data);
      return;
      <D.16898>:
      D.16899 = VerQueryValue (data, query, &trans_data, &trans_size);
      if (D.16899 != 0) goto <D.16900>; else goto <D.16901>;
      <D.16900>:
      trans_size.7 = trans_size;
      if (trans_size.7 > 3) goto <D.16903>; else goto <D.16904>;
      <D.16903>:
      trans_data.8 = trans_data;
      D.16906 = *trans_data.8;
      D.16907 = (int) D.16906;
      trans_data.8 = trans_data;
      D.16908 = trans_data.8 + 1;
      D.16909 = *D.16908;
      D.16910 = (int) D.16909;
      D.16911 = D.16910 << 8;
      D.16912 = D.16907 | D.16911;
      trans_data.8 = trans_data;
      D.16913 = trans_data.8 + 2;
      D.16914 = *D.16913;
      D.16915 = (int) D.16914;
      D.16916 = D.16915 << 16;
      D.16917 = D.16912 | D.16916;
      trans_data.8 = trans_data;
      D.16918 = trans_data.8 + 3;
      D.16919 = *D.16918;
      D.16920 = (int) D.16919;
      D.16921 = D.16920 << 24;
      D.16922 = D.16917 | D.16921;
      lang = (guint32) D.16922;
      D.16923 = lang & 65535;
      lang_count = VerLanguageName (D.16923, &lang_buf, 128);
      if (lang_count != 0) goto <D.16924>; else goto <D.16925>;
      <D.16924>:
      process_set_field_string (filever, "language", &lang_buf, lang_count);
      <D.16925>:
      trans_data.8 = trans_data;
      D.16908 = trans_data.8 + 1;
      D.16909 = *D.16908;
      D.16910 = (int) D.16909;
      trans_data.8 = trans_data;
      D.16906 = *trans_data.8;
      D.16907 = (int) D.16906;
      process_module_stringtable (filever, data, D.16907, D.16910);
      <D.16904>:
      goto <D.16926>;
      <D.16901>:
      process_set_field_string (filever, "comments", "", 0);
      process_set_field_string (filever, "companyname", "", 0);
      process_set_field_string (filever, "filedescription", "", 0);
      process_set_field_string (filever, "fileversion", "", 0);
      process_set_field_string (filever, "internalname", "", 0);
      process_set_field_string (filever, "legalcopyright", "", 0);
      process_set_field_string (filever, "legaltrademarks", "", 0);
      process_set_field_string (filever, "originalfilename", "", 0);
      process_set_field_string (filever, "privatebuild", "", 0);
      process_set_field_string (filever, "productname", "", 0);
      process_set_field_string (filever, "productversion", "", 0);
      process_set_field_string (filever, "specialbuild", "", 0);
      lang_count = VerLanguageName (1033, &lang_buf, 128);
      if (lang_count != 0) goto <D.16927>; else goto <D.16928>;
      <D.16927>:
      process_set_field_string (filever, "language", &lang_buf, lang_count);
      <D.16928>:
      <D.16926>:
      monoeg_g_free (query);
      <D.16857>:
      monoeg_g_free (data);
      <D.16853>:
    }
  finally
    {
      verinfohandle = {CLOBBER};
      ffi = {CLOBBER};
      trans_data = {CLOBBER};
      ffi_size = {CLOBBER};
      trans_size = {CLOBBER};
      lang_buf = {CLOBBER};
    }
}


process_set_field_bool (struct MonoObject * obj, const gchar * fieldname, gboolean val)
{
  struct MonoVTable * D.16932;
  struct MonoClass * D.16933;
  int D.16934;
  sizetype D.16935;
  guint8 * D.16936;
  unsigned char D.16937;
  struct MonoClassField * field;

  D.16932 = obj->vtable;
  D.16933 = D.16932->klass;
  field = mono_class_get_field_from_name (D.16933, fieldname);
  D.16934 = field->offset;
  D.16935 = (sizetype) D.16934;
  D.16936 = obj + D.16935;
  D.16937 = (unsigned char) val;
  *D.16936 = D.16937;
}


process_module_stringtable (struct MonoObject * filever, void * data, guchar lang_hi, guchar lang_lo)
{
  int D.16938;
  int D.16939;

  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "comments", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\Comments");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "companyname", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "filedescription", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\FileDescription");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "fileversion", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\FileVersion");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "internalname", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\InternalName");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "legalcopyright", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\LegalCopyright");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "legaltrademarks", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\LegalTrademarks");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "originalfilename", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\OriginalFilename");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "privatebuild", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\PrivateBuild");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "productname", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\ProductName");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "productversion", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\ProductVersion");
  D.16938 = (int) lang_lo;
  D.16939 = (int) lang_hi;
  process_module_string_read (filever, data, "specialbuild", D.16939, D.16938, "\\StringFileInfo\\%02X%02X%02X%02X\\SpecialBuild");
}


process_module_string_read (struct MonoObject * filever, void * data, const gchar * fieldname, guchar lang_hi, guchar lang_lo, const gchar * key)
{
  int D.16940;
  int D.16941;
  int D.16944;
  unsigned int chars.9;
  unsigned int D.16948;
  gunichar2 * buffer.10;
  gchar * lang_key_utf8;
  gunichar2 * lang_key;
  gunichar2 * buffer;
  UINT chars;

  try
    {
      D.16940 = (int) lang_hi;
      D.16941 = (int) lang_lo;
      lang_key_utf8 = monoeg_g_strdup_printf (key, D.16941, D.16940, 4, 176);
      lang_key = monoeg_g_utf8_to_utf16 (lang_key_utf8, -1, 0B, 0B, 0B);
      D.16944 = VerQueryValue (data, lang_key, &buffer, &chars);
      if (D.16944 != 0) goto <D.16945>; else goto <D.16942>;
      <D.16945>:
      chars.9 = chars;
      if (chars.9 != 0) goto <D.16947>; else goto <D.16942>;
      <D.16947>:
      chars.9 = chars;
      D.16948 = chars.9 + 4294967295;
      buffer.10 = buffer;
      process_set_field_string (filever, fieldname, buffer.10, D.16948);
      goto <D.16943>;
      <D.16942>:
      process_set_field_string (filever, fieldname, "", 0);
      <D.16943>:
      monoeg_g_free (lang_key);
      monoeg_g_free (lang_key_utf8);
    }
  finally
    {
      buffer = {CLOBBER};
      chars = {CLOBBER};
    }
}


process_set_field_intptr (struct MonoObject * obj, const gchar * fieldname, void * val)
{
  struct MonoVTable * D.16950;
  struct MonoClass * D.16951;
  int D.16952;
  sizetype D.16953;
  void * * D.16954;
  struct MonoClassField * field;

  D.16950 = obj->vtable;
  D.16951 = D.16950->klass;
  field = mono_class_get_field_from_name (D.16951, fieldname);
  D.16952 = field->offset;
  D.16953 = (sizetype) D.16952;
  D.16954 = obj + D.16953;
  *D.16954 = val;
}


process_set_field_int (struct MonoObject * obj, const gchar * fieldname, guint32 val)
{
  struct MonoVTable * D.16955;
  struct MonoClass * D.16956;
  int D.16957;
  sizetype D.16958;
  guint32 * D.16959;
  struct MonoClassField * field;

  D.16955 = obj->vtable;
  D.16956 = D.16955->klass;
  field = mono_class_get_field_from_name (D.16956, fieldname);
  D.16957 = field->offset;
  D.16958 = (sizetype) D.16957;
  D.16959 = obj + D.16958;
  *D.16959 = val;
}


unicode_chars (const gunichar2 * str)
{
  long unsigned int D.16960;
  long unsigned int D.16961;
  const gunichar2 * D.16962;
  short unsigned int D.16963;
  guint32 D.16966;
  guint32 len;

  len = 0;
  <D.16534>:
  D.16960 = (long unsigned int) len;
  D.16961 = D.16960 * 2;
  D.16962 = str + D.16961;
  D.16963 = *D.16962;
  if (D.16963 == 0) goto <D.16964>; else goto <D.16965>;
  <D.16964>:
  D.16966 = len;
  return D.16966;
  <D.16965>:
  len = len + 1;
  goto <D.16534>;
}


process_set_field_string (struct MonoObject * obj, const gchar * fieldname, const gunichar2 * val, guint32 len)
{
  int len.11;
  struct MonoVTable * D.16969;
  struct MonoDomain * D.16970;
  struct MonoClass * D.16971;
  int D.16972;
  sizetype D.16973;
  void * D.16974;
  struct MonoClassField * field;
  struct MonoString * string;

  len.11 = (int) len;
  D.16969 = obj->vtable;
  D.16970 = D.16969->domain;
  string = mono_string_new_utf16 (D.16970, val, len.11);
  D.16969 = obj->vtable;
  D.16971 = D.16969->klass;
  field = mono_class_get_field_from_name (D.16971, fieldname);
  D.16972 = field->offset;
  D.16973 = (sizetype) D.16972;
  D.16974 = obj + D.16973;
  mono_gc_wbarrier_generic_store (D.16974, string);
}


process_set_field_object (struct MonoObject * obj, const gchar * fieldname, struct MonoObject * data)
{
  struct MonoVTable * D.16975;
  struct MonoClass * D.16976;
  int D.16977;
  sizetype D.16978;
  void * D.16979;
  struct MonoClassField * field;

  D.16975 = obj->vtable;
  D.16976 = D.16975->klass;
  field = mono_class_get_field_from_name (D.16976, fieldname);
  D.16977 = field->offset;
  D.16978 = (sizetype) D.16977;
  D.16979 = obj + D.16978;
  mono_gc_wbarrier_generic_store (D.16979, data);
}


ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (struct MonoObject * this, struct MonoString * filename)
{
  struct MonoImage * system_assembly.12;
  struct MonoVTable * D.16983;
  struct MonoClass * D.16984;
  struct MonoImage * system_assembly.13;
  mono_unichar2 * D.16986;
  int D.16987;
  unsigned int D.16988;
  mono_unichar2 * D.16989;

  system_assembly.12 = system_assembly;
  if (system_assembly.12 == 0B) goto <D.16981>; else goto <D.16982>;
  <D.16981>:
  D.16983 = this->vtable;
  D.16984 = D.16983->klass;
  system_assembly.13 = D.16984->image;
  system_assembly = system_assembly.13;
  <D.16982>:
  D.16986 = mono_string_chars (filename);
  process_get_fileversion (this, D.16986);
  D.16987 = mono_string_length (filename);
  D.16988 = (unsigned int) D.16987;
  D.16989 = mono_string_chars (filename);
  process_set_field_string (this, "filename", D.16989, D.16988);
}


ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (struct MonoProcessStartInfo * proc_start_info, struct MonoProcInfo * process_info)
{
  unsigned int D.16990;
  WapiShellExecuteShowFlags iftmp.14;
  <unnamed type> D.16992;
  WapiShellExecuteShowFlags iftmp.15;
  struct MonoString * D.17000;
  mono_unichar2 * D.17003;
  struct MonoString * D.17004;
  mono_unichar2 * D.17007;
  struct MonoString * D.17008;
  int D.17011;
  mono_unichar2 * D.17014;
  struct MonoString * D.17015;
  int D.17018;
  mono_unichar2 * D.17021;
  unsigned char D.17022;
  void * D.17025;
  <unnamed type> D.17027;
  unsigned int D.17028;
  unsigned int D.17031;
  unsigned int D.17032;
  void * D.17034;
  unsigned int D.17035;
  MonoBoolean D.17036;
  struct SHELLEXECUTEINFO shellex;
  gboolean ret;

  try
    {
      shellex = {};
      shellex.cbSize = 112;
      shellex.fMask = 65856;
      D.16990 = proc_start_info->window_style;
      shellex.nShow = D.16990;
      D.16992 = shellex.nShow;
      if (D.16992 != 0) goto <D.16993>; else goto <D.16994>;
      <D.16993>:
      D.16992 = shellex.nShow;
      if (D.16992 != 1) goto <D.16996>; else goto <D.16997>;
      <D.16996>:
      iftmp.15 = shellex.nShow;
      goto <D.16998>;
      <D.16997>:
      iftmp.15 = 0;
      <D.16998>:
      iftmp.14 = iftmp.15;
      goto <D.16999>;
      <D.16994>:
      iftmp.14 = 1;
      <D.16999>:
      shellex.nShow = iftmp.14;
      D.17000 = proc_start_info->filename;
      if (D.17000 != 0B) goto <D.17001>; else goto <D.17002>;
      <D.17001>:
      D.17000 = proc_start_info->filename;
      D.17003 = mono_string_chars (D.17000);
      shellex.lpFile = D.17003;
      <D.17002>:
      D.17004 = proc_start_info->arguments;
      if (D.17004 != 0B) goto <D.17005>; else goto <D.17006>;
      <D.17005>:
      D.17004 = proc_start_info->arguments;
      D.17007 = mono_string_chars (D.17004);
      shellex.lpParameters = D.17007;
      <D.17006>:
      D.17008 = proc_start_info->verb;
      if (D.17008 != 0B) goto <D.17009>; else goto <D.17010>;
      <D.17009>:
      D.17008 = proc_start_info->verb;
      D.17011 = mono_string_length (D.17008);
      if (D.17011 != 0) goto <D.17012>; else goto <D.17013>;
      <D.17012>:
      D.17008 = proc_start_info->verb;
      D.17014 = mono_string_chars (D.17008);
      shellex.lpVerb = D.17014;
      <D.17013>:
      <D.17010>:
      D.17015 = proc_start_info->working_directory;
      if (D.17015 != 0B) goto <D.17016>; else goto <D.17017>;
      <D.17016>:
      D.17015 = proc_start_info->working_directory;
      D.17018 = mono_string_length (D.17015);
      if (D.17018 != 0) goto <D.17019>; else goto <D.17020>;
      <D.17019>:
      D.17015 = proc_start_info->working_directory;
      D.17021 = mono_string_chars (D.17015);
      shellex.lpDirectory = D.17021;
      <D.17020>:
      <D.17017>:
      D.17022 = proc_start_info->error_dialog;
      if (D.17022 != 0) goto <D.17023>; else goto <D.17024>;
      <D.17023>:
      D.17025 = proc_start_info->error_dialog_parent_handle;
      shellex.hwnd = D.17025;
      goto <D.17026>;
      <D.17024>:
      D.17027 = shellex.fMask;
      D.17028 = D.17027 | 1024;
      shellex.fMask = D.17028;
      <D.17026>:
      ret = ShellExecuteEx (&shellex);
      if (ret == 0) goto <D.17029>; else goto <D.17030>;
      <D.17029>:
      D.17031 = GetLastError ();
      D.17032 = -D.17031;
      process_info->pid = D.17032;
      goto <D.17033>;
      <D.17030>:
      D.17034 = shellex.hProcess;
      process_info->process_handle = D.17034;
      process_info->thread_handle = 0B;
      D.17034 = shellex.hProcess;
      D.17035 = GetProcessId (D.17034);
      process_info->pid = D.17035;
      process_info->tid = 0;
      <D.17033>:
      D.17036 = (MonoBoolean) ret;
      return D.17036;
    }
  finally
    {
      shellex = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_CreateProcess_internal (struct MonoProcessStartInfo * proc_start_info, void * stdin_handle, void * stdout_handle, void * stderr_handle, struct MonoProcInfo * process_info)
{
  unsigned char D.17039;
  struct MonoString * D.17042;
  gchar * spath.16;
  MonoBoolean D.17046;
  struct MonoArray * D.17047;
  long unsigned int D.17050;
  struct MonoArray * D.17051;
  char * D.17052;
  int D.17055;
  long unsigned int D.17056;
  long unsigned int D.17057;
  unsigned int D.17058;
  unsigned int len.17;
  unsigned int D.17060;
  char * D.17061;
  int D.17062;
  long unsigned int D.17063;
  long unsigned int D.17064;
  unsigned int D.17065;
  unsigned int D.17066;
  unsigned int D.17067;
  long unsigned int D.17068;
  int D.17069;
  long unsigned int D.17070;
  long unsigned int D.17071;
  char * D.17072;
  char * D.17075;
  int D.17076;
  long unsigned int D.17077;
  long unsigned int D.17078;
  mono_unichar2 * D.17079;
  int D.17080;
  long unsigned int D.17081;
  long unsigned int D.17082;
  int D.17083;
  long unsigned int D.17084;
  long unsigned int D.17085;
  mono_unichar2 * D.17086;
  int D.17087;
  long unsigned int D.17088;
  long unsigned int D.17089;
  long unsigned int D.17090;
  struct MonoString * D.17094;
  int D.17096;
  struct MonoString * D.17097;
  unsigned char D.17100;
  _Bool D.17101;
  const gunichar2 * iftmp.18;
  void * D.17106;
  const gunichar2 * iftmp.19;
  struct MonoString * D.17108;
  mono_unichar2 * D.17112;
  const gunichar2 * iftmp.20;
  void * D.17122;
  void * D.17123;
  void * D.17124;
  unsigned int D.17127;
  unsigned int D.17128;
  unsigned int D.17130;
  unsigned int D.17131;
  gboolean ret;
  gunichar2 * dir;
  struct STARTUPINFO startinfo;
  struct PROCESS_INFORMATION procinfo;
  gunichar2 * shell_path;
  gchar * env_vars;
  gboolean free_shell_path;
  gchar * spath;
  struct MonoString * cmd;
  guint32 creation_flags;
  guint32 logon_flags;

  try
    {
      startinfo = {};
      shell_path = 0B;
      env_vars = 0B;
      free_shell_path = 1;
      spath = 0B;
      cmd = proc_start_info->arguments;
      startinfo.cb = 104;
      startinfo.dwFlags = 256;
      startinfo.hStdInput = stdin_handle;
      startinfo.hStdOutput = stdout_handle;
      startinfo.hStdError = stderr_handle;
      creation_flags = 1024;
      D.17039 = proc_start_info->create_no_window;
      if (D.17039 != 0) goto <D.17040>; else goto <D.17041>;
      <D.17040>:
      creation_flags = creation_flags | 134217728;
      <D.17041>:
      D.17042 = proc_start_info->filename;
      shell_path = mono_string_chars (D.17042);
      complete_path (shell_path, &spath);
      spath.16 = spath;
      if (spath.16 == 0B) goto <D.17044>; else goto <D.17045>;
      <D.17044>:
      process_info->pid = 4294967294;
      D.17046 = 0;
      return D.17046;
      <D.17045>:
      spath.16 = spath;
      shell_path = monoeg_g_utf8_to_utf16 (spath.16, -1, 0B, 0B, 0B);
      spath.16 = spath;
      monoeg_g_free (spath.16);
      D.17047 = process_info->env_keys;
      if (D.17047 != 0B) goto <D.17048>; else goto <D.17049>;
      <D.17048>:
      {
        gint i;
        gint len;
        struct MonoString * ms;
        struct MonoString * key;
        struct MonoString * value;
        gunichar2 * str;
        gunichar2 * ptr;
        gunichar2 * equals16;

        len = 0;
        i = 0;
        goto <D.16685>;
        <D.16684>:
        D.17050 = (long unsigned int) i;
        D.17051 = process_info->env_values;
        D.17052 = mono_array_addr_with_size (D.17051, 8, D.17050);
        ms = MEM[(struct MonoString * *)D.17052];
        if (ms == 0B) goto <D.17053>; else goto <D.17054>;
        <D.17053>:
        // predicted unlikely by continue predictor.
        goto <D.16683>;
        <D.17054>:
        D.17055 = mono_string_length (ms);
        D.17056 = (long unsigned int) D.17055;
        D.17057 = D.17056 * 2;
        D.17058 = (unsigned int) D.17057;
        len.17 = (unsigned int) len;
        D.17060 = D.17058 + len.17;
        len = (gint) D.17060;
        D.17050 = (long unsigned int) i;
        D.17047 = process_info->env_keys;
        D.17061 = mono_array_addr_with_size (D.17047, 8, D.17050);
        ms = MEM[(struct MonoString * *)D.17061];
        D.17062 = mono_string_length (ms);
        D.17063 = (long unsigned int) D.17062;
        D.17064 = D.17063 * 2;
        D.17065 = (unsigned int) D.17064;
        len.17 = (unsigned int) len;
        D.17066 = D.17065 + len.17;
        len = (gint) D.17066;
        len.17 = (unsigned int) len;
        D.17067 = len.17 + 4;
        len = (gint) D.17067;
        <D.16683>:
        i = i + 1;
        <D.16685>:
        D.17050 = (long unsigned int) i;
        D.17047 = process_info->env_keys;
        D.17068 = mono_array_length (D.17047);
        if (D.17050 < D.17068) goto <D.16684>; else goto <D.16686>;
        <D.16686>:
        equals16 = monoeg_g_utf8_to_utf16 ("=", 1, 0B, 0B, 0B);
        D.17069 = len + 1;
        D.17070 = (long unsigned int) D.17069;
        D.17071 = D.17070 * 2;
        str = monoeg_malloc0 (D.17071);
        ptr = str;
        i = 0;
        goto <D.16689>;
        <D.16688>:
        D.17050 = (long unsigned int) i;
        D.17051 = process_info->env_values;
        D.17072 = mono_array_addr_with_size (D.17051, 8, D.17050);
        value = MEM[(struct MonoString * *)D.17072];
        if (value == 0B) goto <D.17073>; else goto <D.17074>;
        <D.17073>:
        // predicted unlikely by continue predictor.
        goto <D.16687>;
        <D.17074>:
        D.17050 = (long unsigned int) i;
        D.17047 = process_info->env_keys;
        D.17075 = mono_array_addr_with_size (D.17047, 8, D.17050);
        key = MEM[(struct MonoString * *)D.17075];
        D.17076 = mono_string_length (key);
        D.17077 = (long unsigned int) D.17076;
        D.17078 = D.17077 * 2;
        D.17079 = mono_string_chars (key);
        memcpy (ptr, D.17079, D.17078);
        D.17080 = mono_string_length (key);
        D.17081 = (long unsigned int) D.17080;
        D.17082 = D.17081 * 2;
        ptr = ptr + D.17082;
        memcpy (ptr, equals16, 2);
        ptr = ptr + 2;
        D.17083 = mono_string_length (value);
        D.17084 = (long unsigned int) D.17083;
        D.17085 = D.17084 * 2;
        D.17086 = mono_string_chars (value);
        memcpy (ptr, D.17086, D.17085);
        D.17087 = mono_string_length (value);
        D.17088 = (long unsigned int) D.17087;
        D.17089 = D.17088 * 2;
        ptr = ptr + D.17089;
        ptr = ptr + 2;
        <D.16687>:
        i = i + 1;
        <D.16689>:
        D.17050 = (long unsigned int) i;
        D.17047 = process_info->env_keys;
        D.17090 = mono_array_length (D.17047);
        if (D.17050 < D.17090) goto <D.16688>; else goto <D.16690>;
        <D.16690>:
        monoeg_g_free (equals16);
        env_vars = str;
      }
      <D.17049>:
      D.17094 = proc_start_info->working_directory;
      if (D.17094 == 0B) goto <D.17091>; else goto <D.17095>;
      <D.17095>:
      D.17094 = proc_start_info->working_directory;
      D.17096 = mono_string_length (D.17094);
      if (D.17096 == 0) goto <D.17091>; else goto <D.17092>;
      <D.17091>:
      dir = 0B;
      goto <D.17093>;
      <D.17092>:
      D.17094 = proc_start_info->working_directory;
      dir = mono_string_chars (D.17094);
      <D.17093>:
      D.17097 = process_info->username;
      if (D.17097 != 0B) goto <D.17098>; else goto <D.17099>;
      <D.17098>:
      D.17100 = process_info->load_user_profile;
      D.17101 = D.17100 != 0;
      logon_flags = (guint32) D.17101;
      if (cmd != 0B) goto <D.17103>; else goto <D.17104>;
      <D.17103>:
      iftmp.18 = mono_string_chars (cmd);
      goto <D.17105>;
      <D.17104>:
      iftmp.18 = 0B;
      <D.17105>:
      D.17106 = process_info->password;
      D.17108 = process_info->domain;
      if (D.17108 != 0B) goto <D.17109>; else goto <D.17110>;
      <D.17109>:
      D.17108 = process_info->domain;
      iftmp.19 = mono_string_chars (D.17108);
      goto <D.17111>;
      <D.17110>:
      iftmp.19 = 0B;
      <D.17111>:
      D.17097 = process_info->username;
      D.17112 = mono_string_chars (D.17097);
      ret = CreateProcessWithLogonW (D.17112, iftmp.19, D.17106, logon_flags, shell_path, iftmp.18, creation_flags, env_vars, dir, &startinfo, &procinfo);
      goto <D.17113>;
      <D.17099>:
      if (cmd != 0B) goto <D.17115>; else goto <D.17116>;
      <D.17115>:
      iftmp.20 = mono_string_chars (cmd);
      goto <D.17117>;
      <D.17116>:
      iftmp.20 = 0B;
      <D.17117>:
      ret = CreateProcess (shell_path, iftmp.20, 0B, 0B, 1, creation_flags, env_vars, dir, &startinfo, &procinfo);
      <D.17113>:
      monoeg_g_free (env_vars);
      if (free_shell_path != 0) goto <D.17118>; else goto <D.17119>;
      <D.17118>:
      monoeg_g_free (shell_path);
      <D.17119>:
      if (ret != 0) goto <D.17120>; else goto <D.17121>;
      <D.17120>:
      D.17122 = procinfo.hProcess;
      process_info->process_handle = D.17122;
      process_info->thread_handle = 0B;
      D.17123 = procinfo.hThread;
      D.17124 = D.17123 + 18446744073709551615;
      if (D.17124 <= -3B) goto <D.17125>; else goto <D.17126>;
      <D.17125>:
      D.17123 = procinfo.hThread;
      CloseHandle (D.17123);
      <D.17126>:
      D.17127 = procinfo.dwProcessId;
      process_info->pid = D.17127;
      D.17128 = procinfo.dwThreadId;
      process_info->tid = D.17128;
      goto <D.17129>;
      <D.17121>:
      D.17130 = GetLastError ();
      D.17131 = -D.17130;
      process_info->pid = D.17131;
      <D.17129>:
      D.17046 = (MonoBoolean) ret;
      return D.17046;
    }
  finally
    {
      startinfo = {CLOBBER};
      procinfo = {CLOBBER};
      spath = {CLOBBER};
    }
}


complete_path (const gunichar2 * appname, gchar * * completed)
{
  int D.17134;
  gchar * D.17137;
  gboolean D.17138;
  int D.17139;
  int D.17142;
  gchar * D.17145;
  gchar * D.17148;
  gchar * utf8app;
  gchar * utf8appmemory;
  gchar * found;

  utf8app = monoeg_g_utf16_to_utf8 (appname, -1, 0B, 0B, 0B);
  utf8appmemory = utf8app;
  D.17134 = monoeg_g_path_is_absolute (utf8app);
  if (D.17134 != 0) goto <D.17135>; else goto <D.17136>;
  <D.17135>:
  D.17137 = quote_path (utf8app);
  *completed = D.17137;
  monoeg_g_free (utf8appmemory);
  D.17138 = 1;
  return D.17138;
  <D.17136>:
  D.17139 = monoeg_g_file_test (utf8app, 8);
  if (D.17139 != 0) goto <D.17140>; else goto <D.17141>;
  <D.17140>:
  D.17142 = monoeg_g_file_test (utf8app, 4);
  if (D.17142 == 0) goto <D.17143>; else goto <D.17144>;
  <D.17143>:
  D.17145 = quote_path (utf8app);
  *completed = D.17145;
  monoeg_g_free (utf8appmemory);
  D.17138 = 1;
  return D.17138;
  <D.17144>:
  <D.17141>:
  found = monoeg_g_find_program_in_path (utf8app);
  if (found == 0B) goto <D.17146>; else goto <D.17147>;
  <D.17146>:
  *completed = 0B;
  monoeg_g_free (utf8appmemory);
  D.17138 = 0;
  return D.17138;
  <D.17147>:
  D.17148 = quote_path (found);
  *completed = D.17148;
  monoeg_g_free (found);
  monoeg_g_free (utf8appmemory);
  D.17138 = 1;
  return D.17138;
}


quote_path (const gchar * path)
{
  gchar * D.17150;
  gchar * res;

  res = monoeg_g_shell_quote (path);
  D.17150 = res;
  return D.17150;
}


memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.17152;
  long unsigned int D.17153;

  D.17153 = __builtin_object_size (__dest, 0);
  D.17152 = __builtin___memcpy_chk (__dest, __src, __len, D.17153);
  return D.17152;
}


ves_icall_System_Diagnostics_Process_WaitForExit_internal (struct MonoObject * this, void * process, gint32 ms)
{
  unsigned int ms.21;
  MonoBoolean D.17161;
  guint32 ret;

  if (ms < 0) goto <D.17155>; else goto <D.17156>;
  <D.17155>:
  ret = WaitForSingleObjectEx (process, 4294967295, 1);
  goto <D.17157>;
  <D.17156>:
  ms.21 = (unsigned int) ms;
  ret = WaitForSingleObjectEx (process, ms.21, 1);
  <D.17157>:
  if (ret == 0) goto <D.17159>; else goto <D.17160>;
  <D.17159>:
  D.17161 = 1;
  return D.17161;
  <D.17160>:
  D.17161 = 0;
  return D.17161;
}


ves_icall_System_Diagnostics_Process_WaitForInputIdle_internal (struct MonoObject * this, void * process, gint32 ms)
{
  unsigned int ms.22;
  MonoBoolean D.17167;
  _Bool D.17168;
  guint32 ret;

  if (ms < 0) goto <D.17163>; else goto <D.17164>;
  <D.17163>:
  ret = WaitForInputIdle (process, 4294967295);
  goto <D.17165>;
  <D.17164>:
  ms.22 = (unsigned int) ms;
  ret = WaitForInputIdle (process, ms.22);
  <D.17165>:
  D.17168 = ret == 0;
  D.17167 = (MonoBoolean) D.17168;
  return D.17167;
}


ves_icall_System_Diagnostics_Process_ExitTime_internal (void * process)
{
  unsigned int D.17172;
  long unsigned int D.17173;
  long unsigned int D.17174;
  unsigned int D.17175;
  long unsigned int D.17176;
  long unsigned int D.17177;
  gint64 D.17178;
  gboolean ret;
  gint64 ticks;
  struct FILETIME create_time;
  struct FILETIME exit_time;
  struct FILETIME kernel_time;
  struct FILETIME user_time;

  try
    {
      ret = GetProcessTimes (process, &create_time, &exit_time, &kernel_time, &user_time);
      if (ret == 1) goto <D.17170>; else goto <D.17171>;
      <D.17170>:
      D.17172 = exit_time.dwHighDateTime;
      D.17173 = (long unsigned int) D.17172;
      D.17174 = D.17173 << 32;
      D.17175 = exit_time.dwLowDateTime;
      D.17176 = (long unsigned int) D.17175;
      D.17177 = D.17174 + D.17176;
      ticks = (gint64) D.17177;
      D.17178 = ticks;
      return D.17178;
      <D.17171>:
      D.17178 = 0;
      return D.17178;
    }
  finally
    {
      create_time = {CLOBBER};
      exit_time = {CLOBBER};
      kernel_time = {CLOBBER};
      user_time = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_StartTime_internal (void * process)
{
  unsigned int D.17183;
  long unsigned int D.17184;
  long unsigned int D.17185;
  unsigned int D.17186;
  long unsigned int D.17187;
  long unsigned int D.17188;
  gint64 D.17189;
  gboolean ret;
  gint64 ticks;
  struct FILETIME create_time;
  struct FILETIME exit_time;
  struct FILETIME kernel_time;
  struct FILETIME user_time;

  try
    {
      ret = GetProcessTimes (process, &create_time, &exit_time, &kernel_time, &user_time);
      if (ret == 1) goto <D.17181>; else goto <D.17182>;
      <D.17181>:
      D.17183 = create_time.dwHighDateTime;
      D.17184 = (long unsigned int) D.17183;
      D.17185 = D.17184 << 32;
      D.17186 = create_time.dwLowDateTime;
      D.17187 = (long unsigned int) D.17186;
      D.17188 = D.17185 + D.17187;
      ticks = (gint64) D.17188;
      D.17189 = ticks;
      return D.17189;
      <D.17182>:
      D.17189 = 0;
      return D.17189;
    }
  finally
    {
      create_time = {CLOBBER};
      exit_time = {CLOBBER};
      kernel_time = {CLOBBER};
      user_time = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_ExitCode_internal (void * process)
{
  gint32 D.17192;
  unsigned int code.23;
  DWORD code;

  try
    {
      GetExitCodeProcess (process, &code);
      code.23 = code;
      D.17192 = (gint32) code.23;
      return D.17192;
    }
  finally
    {
      code = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_ProcessName_internal (void * process)
{
  struct MonoString * D.17198;
  void * mod.24;
  int len.25;
  struct MonoDomain * D.17203;
  struct MonoString * string;
  gboolean ok;
  void * mod;
  gunichar2 name[260];
  DWORD needed;
  guint32 len;

  try
    {
      ok = EnumProcessModules (process, &mod, 8, &needed);
      if (ok == 0) goto <D.17196>; else goto <D.17197>;
      <D.17196>:
      D.17198 = 0B;
      return D.17198;
      <D.17197>:
      mod.24 = mod;
      len = GetModuleBaseName (process, mod.24, &name, 260);
      if (len == 0) goto <D.17200>; else goto <D.17201>;
      <D.17200>:
      D.17198 = 0B;
      return D.17198;
      <D.17201>:
      len.25 = (int) len;
      D.17203 = mono_domain_get ();
      string = mono_string_new_utf16 (D.17203, &name, len.25);
      D.17198 = string;
      return D.17198;
    }
  finally
    {
      mod = {CLOBBER};
      name = {CLOBBER};
      needed = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_GetProcesses_internal ()
{
  long unsigned int D.17206;
  long unsigned int D.17207;
  unsigned int D.17208;
  unsigned int needed.26;
  long unsigned int D.17212;
  unsigned int D.17214;
  long unsigned int D.17215;
  struct MonoClass * D.17216;
  struct MonoDomain * D.17217;
  long unsigned int D.17218;
  char * D.17219;
  struct MonoArray * D.17220;
  struct MonoArray * procs;
  gboolean ret;
  DWORD needed;
  guint32 count;
  guint32 * pids;

  try
    {
      count = 512;
      <D.16744>:
      D.17206 = (long unsigned int) count;
      D.17207 = D.17206 * 4;
      pids = monoeg_malloc0 (D.17207);
      D.17208 = count * 4;
      ret = EnumProcesses (pids, D.17208, &needed);
      if (ret == 0) goto <D.17209>; else goto <D.17210>;
      <D.17209>:
      {
        struct MonoException * exc;

        monoeg_g_free (pids);
        pids = 0B;
        exc = mono_get_exception_not_supported ("This system does not support EnumProcesses");
        mono_raise_exception (exc);
        monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "process.c", 920);
      }
      <D.17210>:
      needed.26 = needed;
      D.17212 = (long unsigned int) needed.26;
      D.17206 = (long unsigned int) count;
      D.17207 = D.17206 * 4;
      if (D.17212 < D.17207) goto <D.16743>; else goto <D.17213>;
      <D.17213>:
      monoeg_g_free (pids);
      pids = 0B;
      D.17214 = count * 3;
      count = D.17214 / 2;
      goto <D.16744>;
      <D.16743>:
      needed.26 = needed;
      count = needed.26 / 4;
      D.17215 = (long unsigned int) count;
      D.17216 = mono_get_int32_class ();
      D.17217 = mono_domain_get ();
      procs = mono_array_new (D.17217, D.17216, D.17215);
      needed.26 = needed;
      D.17218 = (long unsigned int) needed.26;
      D.17219 = mono_array_addr_with_size (procs, 4, 0);
      memcpy (D.17219, pids, D.17218);
      monoeg_g_free (pids);
      pids = 0B;
      D.17220 = procs;
      return D.17220;
    }
  finally
    {
      needed = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_GetWorkingSet_internal (void * process, guint32 * min, guint32 * max)
{
  long unsigned int ws_min.27;
  unsigned int D.17224;
  long unsigned int ws_max.28;
  unsigned int D.17226;
  MonoBoolean D.17227;
  gboolean ret;
  SIZE_T ws_min;
  SIZE_T ws_max;

  try
    {
      ret = GetProcessWorkingSetSize (process, &ws_min, &ws_max);
      ws_min.27 = ws_min;
      D.17224 = (unsigned int) ws_min.27;
      *min = D.17224;
      ws_max.28 = ws_max;
      D.17226 = (unsigned int) ws_max.28;
      *max = D.17226;
      D.17227 = (MonoBoolean) ret;
      return D.17227;
    }
  finally
    {
      ws_min = {CLOBBER};
      ws_max = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_SetWorkingSet_internal (void * process, guint32 min, guint32 max, MonoBoolean use_min)
{
  MonoBoolean D.17232;
  long unsigned int ws_min.29;
  long unsigned int ws_max.30;
  long unsigned int ws_max.31;
  long unsigned int ws_min.32;
  gboolean ret;
  SIZE_T ws_min;
  SIZE_T ws_max;

  try
    {
      ret = GetProcessWorkingSetSize (process, &ws_min, &ws_max);
      if (ret == 0) goto <D.17230>; else goto <D.17231>;
      <D.17230>:
      D.17232 = 0;
      return D.17232;
      <D.17231>:
      if (use_min == 1) goto <D.17233>; else goto <D.17234>;
      <D.17233>:
      ws_min.29 = (long unsigned int) min;
      ws_min = ws_min.29;
      goto <D.17236>;
      <D.17234>:
      ws_max.30 = (long unsigned int) max;
      ws_max = ws_max.30;
      <D.17236>:
      ws_max.31 = ws_max;
      ws_min.32 = ws_min;
      ret = SetProcessWorkingSetSize (process, ws_min.32, ws_max.31);
      D.17232 = (MonoBoolean) ret;
      return D.17232;
    }
  finally
    {
      ws_min = {CLOBBER};
      ws_max = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_Kill_internal (void * process, gint32 sig)
{
  MonoBoolean D.17242;
  int D.17243;
  int D.17244;

  D.17243 = -sig;
  D.17244 = TerminateProcess (process, D.17243);
  D.17242 = (MonoBoolean) D.17244;
  return D.17242;
}


ves_icall_System_Diagnostics_Process_Times (void * process, gint32 type)
{
  int D.17246;
  gint64 D.17251;
  struct FILETIME * user_time.33;
  struct FILETIME * kernel_time.34;
  long int D.17256;
  long int D.17257;
  struct FILETIME create_time;
  struct FILETIME exit_time;
  struct FILETIME kernel_time;
  struct FILETIME user_time;

  try
    {
      D.17246 = GetProcessTimes (process, &create_time, &exit_time, &kernel_time, &user_time);
      if (D.17246 != 0) goto <D.17247>; else goto <D.17248>;
      <D.17247>:
      if (type == 0) goto <D.17249>; else goto <D.17250>;
      <D.17249>:
      user_time.33 = &user_time;
      D.17251 = MEM[(gint64 *)user_time.33];
      return D.17251;
      <D.17250>:
      if (type == 1) goto <D.17253>; else goto <D.17254>;
      <D.17253>:
      kernel_time.34 = &kernel_time;
      D.17251 = MEM[(gint64 *)kernel_time.34];
      return D.17251;
      <D.17254>:
      kernel_time.34 = &kernel_time;
      D.17256 = MEM[(gint64 *)kernel_time.34];
      user_time.33 = &user_time;
      D.17257 = MEM[(gint64 *)user_time.33];
      D.17251 = D.17256 + D.17257;
      return D.17251;
      <D.17248>:
      D.17251 = 0;
      return D.17251;
    }
  finally
    {
      create_time = {CLOBBER};
      exit_time = {CLOBBER};
      kernel_time = {CLOBBER};
      user_time = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_GetPriorityClass (void * process, gint32 * error)
{
  unsigned int D.17260;
  gint32 iftmp.35;
  unsigned int D.17264;
  gint32 D.17266;
  gint32 ret;

  D.17260 = GetPriorityClass (process);
  ret = (gint32) D.17260;
  if (ret == 0) goto <D.17262>; else goto <D.17263>;
  <D.17262>:
  D.17264 = GetLastError ();
  iftmp.35 = (gint32) D.17264;
  goto <D.17265>;
  <D.17263>:
  iftmp.35 = 0;
  <D.17265>:
  *error = iftmp.35;
  D.17266 = ret;
  return D.17266;
}


ves_icall_System_Diagnostics_Process_SetPriorityClass (void * process, gint32 priority_class, gint32 * error)
{
  unsigned int priority_class.36;
  gint32 iftmp.37;
  unsigned int D.17272;
  MonoBoolean D.17274;
  gboolean ret;

  priority_class.36 = (unsigned int) priority_class;
  ret = SetPriorityClass (process, priority_class.36);
  if (ret == 0) goto <D.17270>; else goto <D.17271>;
  <D.17270>:
  D.17272 = GetLastError ();
  iftmp.37 = (gint32) D.17272;
  goto <D.17273>;
  <D.17271>:
  iftmp.37 = 0;
  <D.17273>:
  *error = iftmp.37;
  D.17274 = (MonoBoolean) ret;
  return D.17274;
}


ves_icall_System_Diagnostics_Process_ProcessHandle_duplicate (void * process)
{
  void * D.17276;
  void * D.17277;
  void * D.17278;
  void * ret;

  try
    {
      D.17276 = GetCurrentProcess ();
      D.17277 = GetCurrentProcess ();
      DuplicateHandle (D.17277, process, D.17276, &ret, 2032639, 1, 0);
      D.17278 = ret;
      return D.17278;
    }
  finally
    {
      ret = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_ProcessHandle_close (void * process)
{
  CloseHandle (process);
}


ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 * error)
{
  <unnamed type> data_type.38;
  long int D.17282;
  void * D.17283;
  long int D.17284;
  <unnamed type> perror.39;
  int perror.40;
  gint64 D.17289;
  MonoProcessError perror;
  guint64 res;

  try
    {
      data_type.38 = (<unnamed type>) data_type;
      D.17282 = (long int) pid;
      D.17283 = (void *) D.17282;
      D.17284 = mono_process_get_data_with_error (D.17283, data_type.38, &perror);
      res = (guint64) D.17284;
      if (error != 0B) goto <D.17285>; else goto <D.17286>;
      <D.17285>:
      perror.39 = perror;
      perror.40 = (int) perror.39;
      *error = perror.40;
      <D.17286>:
      D.17289 = (gint64) res;
      return D.17289;
    }
  finally
    {
      perror = {CLOBBER};
    }
}


