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

  handle = OpenProcess (2035711, 1, pid);
  if (handle == 0B) goto <D.17330>; else goto <D.17331>;
  <D.17330>:
  D.17332 = 0B;
  return D.17332;
  <D.17331>:
  D.17332 = handle;
  return D.17332;
}


ves_icall_System_Diagnostics_Process_GetPid_internal ()
{
  guint32 D.17334;

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


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.17339;
  struct MonoClass * D.17340;
  struct MonoImage * system_assembly.1;
  int D.17342;
  unsigned int needed.2;
  struct MonoDomain * D.17346;
  struct MonoClass * D.17347;
  long unsigned int D.17348;
  void * D.17349;
  unsigned int D.17350;
  unsigned int D.17353;
  unsigned int num_added.3;
  long unsigned int D.17357;
  struct MonoDomain * D.17361;
  struct MonoClass * D.17362;
  long unsigned int D.17363;
  long unsigned int D.17364;
  char * D.17365;
  struct MonoObject * D.17366;
  struct MonoArray * D.17367;
  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.17337>; else goto <D.17338>;
      <D.17337>:
      D.17339 = this->vtable;
      D.17340 = D.17339->klass;
      system_assembly.1 = D.17340->image;
      system_assembly = system_assembly.1;
      <D.17338>:
      D.17342 = EnumProcessModules (process, &mods, 8192, &needed);
      if (D.17342 != 0) goto <D.17343>; else goto <D.17344>;
      <D.17343>:
      needed.2 = needed;
      count = needed.2 / 8;
      D.17346 = mono_domain_get ();
      D.17347 = mono_get_object_class ();
      D.17348 = (long unsigned int) count;
      temp_arr = mono_array_new (D.17346, D.17347, D.17348);
      i = 0;
      goto <D.17160>;
      <D.17159>:
      D.17349 = mods[i];
      D.17350 = GetModuleBaseName (process, D.17349, &modname, 260);
      if (D.17350 != 0) goto <D.17351>; else goto <D.17352>;
      <D.17351>:
      D.17349 = mods[i];
      D.17353 = GetModuleFileNameEx (process, D.17349, &filename, 260);
      if (D.17353 != 0) goto <D.17354>; else goto <D.17355>;
      <D.17354>:
      {
        struct MonoObject * module;

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

          num_added.3 = num_added;
          num_added = num_added.3 + 1;
          D.17357 = (long unsigned int) num_added.3;
          __p = mono_array_addr_with_size (temp_arr, 8, D.17357);
          mono_gc_wbarrier_set_arrayref (temp_arr, __p, module);
        }
      }
      <D.17355>:
      <D.17352>:
      i = i + 1;
      <D.17160>:
      if (i < count) goto <D.17159>; else goto <D.17161>;
      <D.17161>:
      <D.17344>:
      if (count == num_added) goto <D.17358>; else goto <D.17359>;
      <D.17358>:
      arr = temp_arr;
      goto <D.17360>;
      <D.17359>:
      D.17361 = mono_domain_get ();
      D.17362 = mono_get_object_class ();
      D.17363 = (long unsigned int) num_added;
      arr = mono_array_new (D.17361, D.17362, D.17363);
      i = 0;
      goto <D.17164>;
      <D.17163>:
      {
        void * * __p;

        D.17364 = (long unsigned int) i;
        __p = mono_array_addr_with_size (arr, 8, D.17364);
        D.17364 = (long unsigned int) i;
        D.17365 = mono_array_addr_with_size (temp_arr, 8, D.17364);
        D.17366 = MEM[(struct MonoObject * *)D.17365];
        mono_gc_wbarrier_set_arrayref (arr, __p, D.17366);
      }
      i = i + 1;
      <D.17164>:
      if (i < num_added) goto <D.17163>; else goto <D.17165>;
      <D.17165>:
      <D.17360>:
      D.17367 = arr;
      return D.17367;
    }
  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.17371;
  void * D.17374;
  void * D.17375;
  unsigned int D.17376;
  unsigned int D.17377;
  unsigned int D.17378;
  struct MonoObject * D.17379;
  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.17371 = unicode_chars (filename);
      process_set_field_string (filever, "filename", filename, D.17371);
      ok = GetModuleInformation (process, mod, &modinfo, 24);
      if (ok != 0) goto <D.17372>; else goto <D.17373>;
      <D.17372>:
      D.17374 = modinfo.lpBaseOfDll;
      process_set_field_intptr (item, "baseaddr", D.17374);
      D.17375 = modinfo.EntryPoint;
      process_set_field_intptr (item, "entryaddr", D.17375);
      D.17376 = modinfo.SizeOfImage;
      process_set_field_int (item, "memory_size", D.17376);
      <D.17373>:
      D.17377 = unicode_chars (filename);
      process_set_field_string (item, "filename", filename, D.17377);
      D.17378 = unicode_chars (modulename);
      process_set_field_string (item, "modulename", modulename, D.17378);
      process_set_field_object (item, "version_info", filever);
      D.17379 = item;
      return D.17379;
    }
  finally
    {
      modinfo = {CLOBBER};
    }
}


process_get_fileversion (struct MonoObject * filever, gunichar2 * filename)
{
  long unsigned int D.17384;
  unsigned int verinfohandle.5;
  int D.17390;
  struct VS_FIXEDFILEINFO * ffi.6;
  unsigned int D.17394;
  unsigned int D.17395;
  short unsigned int D.17396;
  unsigned int D.17397;
  short unsigned int D.17398;
  unsigned int D.17399;
  unsigned int D.17400;
  unsigned int D.17401;
  short unsigned int D.17402;
  unsigned int D.17403;
  short unsigned int D.17404;
  unsigned int D.17405;
  unsigned int D.17406;
  unsigned int D.17407;
  short unsigned int D.17408;
  unsigned int D.17409;
  short unsigned int D.17410;
  unsigned int D.17411;
  unsigned int D.17412;
  unsigned int D.17413;
  short unsigned int D.17414;
  unsigned int D.17415;
  short unsigned int D.17416;
  unsigned int D.17417;
  unsigned int D.17418;
  unsigned int D.17419;
  unsigned int D.17420;
  int D.17421;
  int D.17422;
  int D.17423;
  int D.17424;
  int D.17425;
  int D.17426;
  int D.17429;
  unsigned int trans_size.7;
  guchar * trans_data.8;
  unsigned char D.17436;
  int D.17437;
  guchar * D.17438;
  unsigned char D.17439;
  int D.17440;
  int D.17441;
  int D.17442;
  guchar * D.17443;
  unsigned char D.17444;
  int D.17445;
  int D.17446;
  int D.17447;
  guchar * D.17448;
  unsigned char D.17449;
  int D.17450;
  int D.17451;
  int D.17452;
  unsigned int D.17453;
  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.17382>; else goto <D.17383>;
      <D.17382>:
      D.17384 = (long unsigned int) datalen;
      data = monoeg_malloc0 (D.17384);
      verinfohandle.5 = verinfohandle;
      ok = GetFileVersionInfo (filename, verinfohandle.5, datalen, data);
      if (ok != 0) goto <D.17386>; else goto <D.17387>;
      <D.17386>:
      query = monoeg_g_utf8_to_utf16 ("\\", -1, 0B, 0B, 0B);
      if (query == 0B) goto <D.17388>; else goto <D.17389>;
      <D.17388>:
      monoeg_g_free (data);
      return;
      <D.17389>:
      D.17390 = VerQueryValue (data, query, &ffi, &ffi_size);
      if (D.17390 != 0) goto <D.17391>; else goto <D.17392>;
      <D.17391>:
      ffi.6 = ffi;
      D.17394 = ffi.6->dwFileVersionMS;
      D.17395 = D.17394 >> 16;
      D.17396 = (short unsigned int) D.17395;
      D.17397 = (unsigned int) D.17396;
      process_set_field_int (filever, "filemajorpart", D.17397);
      ffi.6 = ffi;
      D.17394 = ffi.6->dwFileVersionMS;
      D.17398 = (short unsigned int) D.17394;
      D.17399 = (unsigned int) D.17398;
      process_set_field_int (filever, "fileminorpart", D.17399);
      ffi.6 = ffi;
      D.17400 = ffi.6->dwFileVersionLS;
      D.17401 = D.17400 >> 16;
      D.17402 = (short unsigned int) D.17401;
      D.17403 = (unsigned int) D.17402;
      process_set_field_int (filever, "filebuildpart", D.17403);
      ffi.6 = ffi;
      D.17400 = ffi.6->dwFileVersionLS;
      D.17404 = (short unsigned int) D.17400;
      D.17405 = (unsigned int) D.17404;
      process_set_field_int (filever, "fileprivatepart", D.17405);
      ffi.6 = ffi;
      D.17406 = ffi.6->dwProductVersionMS;
      D.17407 = D.17406 >> 16;
      D.17408 = (short unsigned int) D.17407;
      D.17409 = (unsigned int) D.17408;
      process_set_field_int (filever, "productmajorpart", D.17409);
      ffi.6 = ffi;
      D.17406 = ffi.6->dwProductVersionMS;
      D.17410 = (short unsigned int) D.17406;
      D.17411 = (unsigned int) D.17410;
      process_set_field_int (filever, "productminorpart", D.17411);
      ffi.6 = ffi;
      D.17412 = ffi.6->dwProductVersionLS;
      D.17413 = D.17412 >> 16;
      D.17414 = (short unsigned int) D.17413;
      D.17415 = (unsigned int) D.17414;
      process_set_field_int (filever, "productbuildpart", D.17415);
      ffi.6 = ffi;
      D.17412 = ffi.6->dwProductVersionLS;
      D.17416 = (short unsigned int) D.17412;
      D.17417 = (unsigned int) D.17416;
      process_set_field_int (filever, "productprivatepart", D.17417);
      ffi.6 = ffi;
      D.17418 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.17419 = ffi.6->dwFileFlagsMask;
      D.17420 = D.17418 & D.17419;
      D.17421 = (int) D.17420;
      D.17422 = D.17421 & 1;
      process_set_field_bool (filever, "isdebug", D.17422);
      ffi.6 = ffi;
      D.17418 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.17419 = ffi.6->dwFileFlagsMask;
      D.17420 = D.17418 & D.17419;
      D.17421 = (int) D.17420;
      D.17423 = D.17421 & 2;
      process_set_field_bool (filever, "isprerelease", D.17423);
      ffi.6 = ffi;
      D.17418 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.17419 = ffi.6->dwFileFlagsMask;
      D.17420 = D.17418 & D.17419;
      D.17421 = (int) D.17420;
      D.17424 = D.17421 & 4;
      process_set_field_bool (filever, "ispatched", D.17424);
      ffi.6 = ffi;
      D.17418 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.17419 = ffi.6->dwFileFlagsMask;
      D.17420 = D.17418 & D.17419;
      D.17421 = (int) D.17420;
      D.17425 = D.17421 & 8;
      process_set_field_bool (filever, "isprivatebuild", D.17425);
      ffi.6 = ffi;
      D.17418 = ffi.6->dwFileFlags;
      ffi.6 = ffi;
      D.17419 = ffi.6->dwFileFlagsMask;
      D.17420 = D.17418 & D.17419;
      D.17421 = (int) D.17420;
      D.17426 = D.17421 & 32;
      process_set_field_bool (filever, "isspecialbuild", D.17426);
      <D.17392>:
      monoeg_g_free (query);
      query = monoeg_g_utf8_to_utf16 ("\\VarFileInfo\\Translation", -1, 0B, 0B, 0B);
      if (query == 0B) goto <D.17427>; else goto <D.17428>;
      <D.17427>:
      monoeg_g_free (data);
      return;
      <D.17428>:
      D.17429 = VerQueryValue (data, query, &trans_data, &trans_size);
      if (D.17429 != 0) goto <D.17430>; else goto <D.17431>;
      <D.17430>:
      trans_size.7 = trans_size;
      if (trans_size.7 > 3) goto <D.17433>; else goto <D.17434>;
      <D.17433>:
      trans_data.8 = trans_data;
      D.17436 = *trans_data.8;
      D.17437 = (int) D.17436;
      trans_data.8 = trans_data;
      D.17438 = trans_data.8 + 1;
      D.17439 = *D.17438;
      D.17440 = (int) D.17439;
      D.17441 = D.17440 << 8;
      D.17442 = D.17437 | D.17441;
      trans_data.8 = trans_data;
      D.17443 = trans_data.8 + 2;
      D.17444 = *D.17443;
      D.17445 = (int) D.17444;
      D.17446 = D.17445 << 16;
      D.17447 = D.17442 | D.17446;
      trans_data.8 = trans_data;
      D.17448 = trans_data.8 + 3;
      D.17449 = *D.17448;
      D.17450 = (int) D.17449;
      D.17451 = D.17450 << 24;
      D.17452 = D.17447 | D.17451;
      lang = (guint32) D.17452;
      D.17453 = lang & 65535;
      lang_count = VerLanguageName (D.17453, &lang_buf, 128);
      if (lang_count != 0) goto <D.17454>; else goto <D.17455>;
      <D.17454>:
      process_set_field_string (filever, "language", &lang_buf, lang_count);
      <D.17455>:
      trans_data.8 = trans_data;
      D.17436 = *trans_data.8;
      trans_data.8 = trans_data;
      D.17438 = trans_data.8 + 1;
      D.17439 = *D.17438;
      process_module_stringtable (filever, data, D.17436, D.17439);
      <D.17434>:
      goto <D.17456>;
      <D.17431>:
      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.17457>; else goto <D.17458>;
      <D.17457>:
      process_set_field_string (filever, "language", &lang_buf, lang_count);
      <D.17458>:
      <D.17456>:
      monoeg_g_free (query);
      <D.17387>:
      monoeg_g_free (data);
      <D.17383>:
    }
  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.17462;
  struct MonoClass * D.17463;
  int D.17464;
  sizetype D.17465;
  guint8 * D.17466;
  unsigned char D.17467;
  struct MonoClassField * field;

  D.17462 = obj->vtable;
  D.17463 = D.17462->klass;
  field = mono_class_get_field_from_name (D.17463, fieldname);
  D.17464 = field->offset;
  D.17465 = (sizetype) D.17464;
  D.17466 = obj + D.17465;
  D.17467 = (unsigned char) val;
  *D.17466 = D.17467;
}


process_module_stringtable (struct MonoObject * filever, void * data, guchar lang_hi, guchar lang_lo)
{
  process_module_string_read (filever, data, "comments", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\Comments");
  process_module_string_read (filever, data, "companyname", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\CompanyName");
  process_module_string_read (filever, data, "filedescription", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\FileDescription");
  process_module_string_read (filever, data, "fileversion", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\FileVersion");
  process_module_string_read (filever, data, "internalname", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\InternalName");
  process_module_string_read (filever, data, "legalcopyright", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\LegalCopyright");
  process_module_string_read (filever, data, "legaltrademarks", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\LegalTrademarks");
  process_module_string_read (filever, data, "originalfilename", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\OriginalFilename");
  process_module_string_read (filever, data, "privatebuild", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\PrivateBuild");
  process_module_string_read (filever, data, "productname", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\ProductName");
  process_module_string_read (filever, data, "productversion", lang_hi, lang_lo, "\\StringFileInfo\\%02X%02X%02X%02X\\ProductVersion");
  process_module_string_read (filever, data, "specialbuild", lang_hi, lang_lo, "\\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.17468;
  int D.17469;
  int D.17472;
  unsigned int chars.9;
  gunichar2 * buffer.10;
  unsigned int D.17477;
  gchar * lang_key_utf8;
  gunichar2 * lang_key;
  gunichar2 * buffer;
  UINT chars;

  try
    {
      D.17468 = (int) lang_lo;
      D.17469 = (int) lang_hi;
      lang_key_utf8 = monoeg_g_strdup_printf (key, D.17468, D.17469, 4, 176);
      lang_key = monoeg_g_utf8_to_utf16 (lang_key_utf8, -1, 0B, 0B, 0B);
      D.17472 = VerQueryValue (data, lang_key, &buffer, &chars);
      if (D.17472 != 0) goto <D.17473>; else goto <D.17470>;
      <D.17473>:
      chars.9 = chars;
      if (chars.9 != 0) goto <D.17475>; else goto <D.17470>;
      <D.17475>:
      buffer.10 = buffer;
      chars.9 = chars;
      D.17477 = chars.9 + 4294967295;
      process_set_field_string (filever, fieldname, buffer.10, D.17477);
      goto <D.17471>;
      <D.17470>:
      process_set_field_string (filever, fieldname, "", 0);
      <D.17471>:
      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.17478;
  struct MonoClass * D.17479;
  int D.17480;
  sizetype D.17481;
  void * * D.17482;
  struct MonoClassField * field;

  D.17478 = obj->vtable;
  D.17479 = D.17478->klass;
  field = mono_class_get_field_from_name (D.17479, fieldname);
  D.17480 = field->offset;
  D.17481 = (sizetype) D.17480;
  D.17482 = obj + D.17481;
  *D.17482 = val;
}


process_set_field_int (struct MonoObject * obj, const gchar * fieldname, guint32 val)
{
  struct MonoVTable * D.17483;
  struct MonoClass * D.17484;
  int D.17485;
  sizetype D.17486;
  guint32 * D.17487;
  struct MonoClassField * field;

  D.17483 = obj->vtable;
  D.17484 = D.17483->klass;
  field = mono_class_get_field_from_name (D.17484, fieldname);
  D.17485 = field->offset;
  D.17486 = (sizetype) D.17485;
  D.17487 = obj + D.17486;
  *D.17487 = val;
}


unicode_chars (const gunichar2 * str)
{
  long unsigned int D.17488;
  long unsigned int D.17489;
  const gunichar2 * D.17490;
  short unsigned int D.17491;
  guint32 D.17494;
  guint32 len;

  len = 0;
  <D.17064>:
  D.17488 = (long unsigned int) len;
  D.17489 = D.17488 * 2;
  D.17490 = str + D.17489;
  D.17491 = *D.17490;
  if (D.17491 == 0) goto <D.17492>; else goto <D.17493>;
  <D.17492>:
  D.17494 = len;
  return D.17494;
  <D.17493>:
  len = len + 1;
  goto <D.17064>;
}


process_set_field_string (struct MonoObject * obj, const gchar * fieldname, const gunichar2 * val, guint32 len)
{
  struct MonoVTable * D.17496;
  struct MonoDomain * D.17497;
  int len.11;
  struct MonoClass * D.17499;
  int D.17500;
  sizetype D.17501;
  void * D.17502;
  struct MonoClassField * field;
  struct MonoString * string;

  D.17496 = obj->vtable;
  D.17497 = D.17496->domain;
  len.11 = (int) len;
  string = mono_string_new_utf16 (D.17497, val, len.11);
  D.17496 = obj->vtable;
  D.17499 = D.17496->klass;
  field = mono_class_get_field_from_name (D.17499, fieldname);
  D.17500 = field->offset;
  D.17501 = (sizetype) D.17500;
  D.17502 = obj + D.17501;
  mono_gc_wbarrier_generic_store (D.17502, string);
}


process_set_field_object (struct MonoObject * obj, const gchar * fieldname, struct MonoObject * data)
{
  struct MonoVTable * D.17503;
  struct MonoClass * D.17504;
  int D.17505;
  sizetype D.17506;
  void * D.17507;
  struct MonoClassField * field;

  D.17503 = obj->vtable;
  D.17504 = D.17503->klass;
  field = mono_class_get_field_from_name (D.17504, fieldname);
  D.17505 = field->offset;
  D.17506 = (sizetype) D.17505;
  D.17507 = obj + D.17506;
  mono_gc_wbarrier_generic_store (D.17507, data);
}


ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (struct MonoObject * this, struct MonoString * filename)
{
  struct MonoImage * system_assembly.12;
  struct MonoVTable * D.17511;
  struct MonoClass * D.17512;
  struct MonoImage * system_assembly.13;
  mono_unichar2 * D.17514;
  mono_unichar2 * D.17515;
  int D.17516;
  unsigned int D.17517;

  system_assembly.12 = system_assembly;
  if (system_assembly.12 == 0B) goto <D.17509>; else goto <D.17510>;
  <D.17509>:
  D.17511 = this->vtable;
  D.17512 = D.17511->klass;
  system_assembly.13 = D.17512->image;
  system_assembly = system_assembly.13;
  <D.17510>:
  D.17514 = mono_string_chars (filename);
  process_get_fileversion (this, D.17514);
  D.17515 = mono_string_chars (filename);
  D.17516 = mono_string_length (filename);
  D.17517 = (unsigned int) D.17516;
  process_set_field_string (this, "filename", D.17515, D.17517);
}


ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (struct MonoProcessStartInfo * proc_start_info, struct MonoProcInfo * process_info)
{
  unsigned int D.17518;
  WapiShellExecuteShowFlags iftmp.14;
  <unnamed type> D.17520;
  WapiShellExecuteShowFlags iftmp.15;
  struct MonoString * D.17528;
  mono_unichar2 * D.17531;
  struct MonoString * D.17532;
  mono_unichar2 * D.17535;
  struct MonoString * D.17536;
  int D.17539;
  mono_unichar2 * D.17542;
  struct MonoString * D.17543;
  int D.17546;
  mono_unichar2 * D.17549;
  unsigned char D.17550;
  void * D.17553;
  <unnamed type> D.17555;
  unsigned int D.17556;
  unsigned int D.17559;
  unsigned int D.17560;
  void * D.17562;
  unsigned int D.17563;
  MonoBoolean D.17564;
  struct SHELLEXECUTEINFO shellex;
  gboolean ret;

  try
    {
      shellex = {};
      shellex.cbSize = 112;
      shellex.fMask = 65856;
      D.17518 = proc_start_info->window_style;
      shellex.nShow = D.17518;
      D.17520 = shellex.nShow;
      if (D.17520 != 0) goto <D.17521>; else goto <D.17522>;
      <D.17521>:
      D.17520 = shellex.nShow;
      if (D.17520 != 1) goto <D.17524>; else goto <D.17525>;
      <D.17524>:
      iftmp.15 = shellex.nShow;
      goto <D.17526>;
      <D.17525>:
      iftmp.15 = 0;
      <D.17526>:
      iftmp.14 = iftmp.15;
      goto <D.17527>;
      <D.17522>:
      iftmp.14 = 1;
      <D.17527>:
      shellex.nShow = iftmp.14;
      D.17528 = proc_start_info->filename;
      if (D.17528 != 0B) goto <D.17529>; else goto <D.17530>;
      <D.17529>:
      D.17528 = proc_start_info->filename;
      D.17531 = mono_string_chars (D.17528);
      shellex.lpFile = D.17531;
      <D.17530>:
      D.17532 = proc_start_info->arguments;
      if (D.17532 != 0B) goto <D.17533>; else goto <D.17534>;
      <D.17533>:
      D.17532 = proc_start_info->arguments;
      D.17535 = mono_string_chars (D.17532);
      shellex.lpParameters = D.17535;
      <D.17534>:
      D.17536 = proc_start_info->verb;
      if (D.17536 != 0B) goto <D.17537>; else goto <D.17538>;
      <D.17537>:
      D.17536 = proc_start_info->verb;
      D.17539 = mono_string_length (D.17536);
      if (D.17539 != 0) goto <D.17540>; else goto <D.17541>;
      <D.17540>:
      D.17536 = proc_start_info->verb;
      D.17542 = mono_string_chars (D.17536);
      shellex.lpVerb = D.17542;
      <D.17541>:
      <D.17538>:
      D.17543 = proc_start_info->working_directory;
      if (D.17543 != 0B) goto <D.17544>; else goto <D.17545>;
      <D.17544>:
      D.17543 = proc_start_info->working_directory;
      D.17546 = mono_string_length (D.17543);
      if (D.17546 != 0) goto <D.17547>; else goto <D.17548>;
      <D.17547>:
      D.17543 = proc_start_info->working_directory;
      D.17549 = mono_string_chars (D.17543);
      shellex.lpDirectory = D.17549;
      <D.17548>:
      <D.17545>:
      D.17550 = proc_start_info->error_dialog;
      if (D.17550 != 0) goto <D.17551>; else goto <D.17552>;
      <D.17551>:
      D.17553 = proc_start_info->error_dialog_parent_handle;
      shellex.hwnd = D.17553;
      goto <D.17554>;
      <D.17552>:
      D.17555 = shellex.fMask;
      D.17556 = D.17555 | 1024;
      shellex.fMask = D.17556;
      <D.17554>:
      ret = ShellExecuteEx (&shellex);
      if (ret == 0) goto <D.17557>; else goto <D.17558>;
      <D.17557>:
      D.17559 = GetLastError ();
      D.17560 = -D.17559;
      process_info->pid = D.17560;
      goto <D.17561>;
      <D.17558>:
      D.17562 = shellex.hProcess;
      process_info->process_handle = D.17562;
      process_info->thread_handle = 0B;
      D.17562 = shellex.hProcess;
      D.17563 = GetProcessId (D.17562);
      process_info->pid = D.17563;
      process_info->tid = 0;
      <D.17561>:
      D.17564 = (MonoBoolean) ret;
      return D.17564;
    }
  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.17567;
  struct MonoString * D.17570;
  gchar * spath.16;
  MonoBoolean D.17574;
  struct MonoArray * D.17575;
  struct MonoArray * D.17578;
  long unsigned int D.17579;
  char * D.17580;
  int D.17583;
  long unsigned int D.17584;
  long unsigned int D.17585;
  unsigned int D.17586;
  unsigned int len.17;
  unsigned int D.17588;
  char * D.17589;
  int D.17590;
  long unsigned int D.17591;
  long unsigned int D.17592;
  unsigned int D.17593;
  unsigned int D.17594;
  unsigned int D.17595;
  long unsigned int D.17596;
  int D.17597;
  long unsigned int D.17598;
  long unsigned int D.17599;
  char * D.17600;
  char * D.17603;
  mono_unichar2 * D.17604;
  int D.17605;
  long unsigned int D.17606;
  long unsigned int D.17607;
  int D.17608;
  long unsigned int D.17609;
  long unsigned int D.17610;
  mono_unichar2 * D.17611;
  int D.17612;
  long unsigned int D.17613;
  long unsigned int D.17614;
  int D.17615;
  long unsigned int D.17616;
  long unsigned int D.17617;
  long unsigned int D.17618;
  struct MonoString * D.17622;
  int D.17624;
  struct MonoString * D.17625;
  unsigned char D.17628;
  _Bool D.17629;
  mono_unichar2 * D.17630;
  const gunichar2 * iftmp.18;
  struct MonoString * D.17632;
  void * D.17636;
  const gunichar2 * iftmp.19;
  const gunichar2 * iftmp.20;
  void * D.17650;
  void * D.17651;
  void * D.17652;
  unsigned int D.17655;
  unsigned int D.17656;
  unsigned int D.17658;
  unsigned int D.17659;
  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.17567 = proc_start_info->create_no_window;
      if (D.17567 != 0) goto <D.17568>; else goto <D.17569>;
      <D.17568>:
      creation_flags = creation_flags | 134217728;
      <D.17569>:
      D.17570 = proc_start_info->filename;
      shell_path = mono_string_chars (D.17570);
      complete_path (shell_path, &spath);
      spath.16 = spath;
      if (spath.16 == 0B) goto <D.17572>; else goto <D.17573>;
      <D.17572>:
      process_info->pid = 4294967294;
      D.17574 = 0;
      return D.17574;
      <D.17573>:
      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.17575 = process_info->env_keys;
      if (D.17575 != 0B) goto <D.17576>; else goto <D.17577>;
      <D.17576>:
      {
        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.17215>;
        <D.17214>:
        D.17578 = process_info->env_values;
        D.17579 = (long unsigned int) i;
        D.17580 = mono_array_addr_with_size (D.17578, 8, D.17579);
        ms = MEM[(struct MonoString * *)D.17580];
        if (ms == 0B) goto <D.17581>; else goto <D.17582>;
        <D.17581>:
        // predicted unlikely by continue predictor.
        goto <D.17213>;
        <D.17582>:
        D.17583 = mono_string_length (ms);
        D.17584 = (long unsigned int) D.17583;
        D.17585 = D.17584 * 2;
        D.17586 = (unsigned int) D.17585;
        len.17 = (unsigned int) len;
        D.17588 = D.17586 + len.17;
        len = (gint) D.17588;
        D.17575 = process_info->env_keys;
        D.17579 = (long unsigned int) i;
        D.17589 = mono_array_addr_with_size (D.17575, 8, D.17579);
        ms = MEM[(struct MonoString * *)D.17589];
        D.17590 = mono_string_length (ms);
        D.17591 = (long unsigned int) D.17590;
        D.17592 = D.17591 * 2;
        D.17593 = (unsigned int) D.17592;
        len.17 = (unsigned int) len;
        D.17594 = D.17593 + len.17;
        len = (gint) D.17594;
        len.17 = (unsigned int) len;
        D.17595 = len.17 + 4;
        len = (gint) D.17595;
        <D.17213>:
        i = i + 1;
        <D.17215>:
        D.17579 = (long unsigned int) i;
        D.17575 = process_info->env_keys;
        D.17596 = mono_array_length (D.17575);
        if (D.17579 < D.17596) goto <D.17214>; else goto <D.17216>;
        <D.17216>:
        equals16 = monoeg_g_utf8_to_utf16 ("=", 1, 0B, 0B, 0B);
        D.17597 = len + 1;
        D.17598 = (long unsigned int) D.17597;
        D.17599 = D.17598 * 2;
        str = monoeg_malloc0 (D.17599);
        ptr = str;
        i = 0;
        goto <D.17219>;
        <D.17218>:
        D.17578 = process_info->env_values;
        D.17579 = (long unsigned int) i;
        D.17600 = mono_array_addr_with_size (D.17578, 8, D.17579);
        value = MEM[(struct MonoString * *)D.17600];
        if (value == 0B) goto <D.17601>; else goto <D.17602>;
        <D.17601>:
        // predicted unlikely by continue predictor.
        goto <D.17217>;
        <D.17602>:
        D.17575 = process_info->env_keys;
        D.17579 = (long unsigned int) i;
        D.17603 = mono_array_addr_with_size (D.17575, 8, D.17579);
        key = MEM[(struct MonoString * *)D.17603];
        D.17604 = mono_string_chars (key);
        D.17605 = mono_string_length (key);
        D.17606 = (long unsigned int) D.17605;
        D.17607 = D.17606 * 2;
        memcpy (ptr, D.17604, D.17607);
        D.17608 = mono_string_length (key);
        D.17609 = (long unsigned int) D.17608;
        D.17610 = D.17609 * 2;
        ptr = ptr + D.17610;
        memcpy (ptr, equals16, 2);
        ptr = ptr + 2;
        D.17611 = mono_string_chars (value);
        D.17612 = mono_string_length (value);
        D.17613 = (long unsigned int) D.17612;
        D.17614 = D.17613 * 2;
        memcpy (ptr, D.17611, D.17614);
        D.17615 = mono_string_length (value);
        D.17616 = (long unsigned int) D.17615;
        D.17617 = D.17616 * 2;
        ptr = ptr + D.17617;
        ptr = ptr + 2;
        <D.17217>:
        i = i + 1;
        <D.17219>:
        D.17579 = (long unsigned int) i;
        D.17575 = process_info->env_keys;
        D.17618 = mono_array_length (D.17575);
        if (D.17579 < D.17618) goto <D.17218>; else goto <D.17220>;
        <D.17220>:
        monoeg_g_free (equals16);
        env_vars = str;
      }
      <D.17577>:
      D.17622 = proc_start_info->working_directory;
      if (D.17622 == 0B) goto <D.17619>; else goto <D.17623>;
      <D.17623>:
      D.17622 = proc_start_info->working_directory;
      D.17624 = mono_string_length (D.17622);
      if (D.17624 == 0) goto <D.17619>; else goto <D.17620>;
      <D.17619>:
      dir = 0B;
      goto <D.17621>;
      <D.17620>:
      D.17622 = proc_start_info->working_directory;
      dir = mono_string_chars (D.17622);
      <D.17621>:
      D.17625 = process_info->username;
      if (D.17625 != 0B) goto <D.17626>; else goto <D.17627>;
      <D.17626>:
      D.17628 = process_info->load_user_profile;
      D.17629 = D.17628 != 0;
      logon_flags = (guint32) D.17629;
      D.17625 = process_info->username;
      D.17630 = mono_string_chars (D.17625);
      D.17632 = process_info->domain;
      if (D.17632 != 0B) goto <D.17633>; else goto <D.17634>;
      <D.17633>:
      D.17632 = process_info->domain;
      iftmp.18 = mono_string_chars (D.17632);
      goto <D.17635>;
      <D.17634>:
      iftmp.18 = 0B;
      <D.17635>:
      D.17636 = process_info->password;
      if (cmd != 0B) goto <D.17638>; else goto <D.17639>;
      <D.17638>:
      iftmp.19 = mono_string_chars (cmd);
      goto <D.17640>;
      <D.17639>:
      iftmp.19 = 0B;
      <D.17640>:
      ret = CreateProcessWithLogonW (D.17630, iftmp.18, D.17636, logon_flags, shell_path, iftmp.19, creation_flags, env_vars, dir, &startinfo, &procinfo);
      goto <D.17641>;
      <D.17627>:
      if (cmd != 0B) goto <D.17643>; else goto <D.17644>;
      <D.17643>:
      iftmp.20 = mono_string_chars (cmd);
      goto <D.17645>;
      <D.17644>:
      iftmp.20 = 0B;
      <D.17645>:
      ret = CreateProcess (shell_path, iftmp.20, 0B, 0B, 1, creation_flags, env_vars, dir, &startinfo, &procinfo);
      <D.17641>:
      monoeg_g_free (env_vars);
      if (free_shell_path != 0) goto <D.17646>; else goto <D.17647>;
      <D.17646>:
      monoeg_g_free (shell_path);
      <D.17647>:
      if (ret != 0) goto <D.17648>; else goto <D.17649>;
      <D.17648>:
      D.17650 = procinfo.hProcess;
      process_info->process_handle = D.17650;
      process_info->thread_handle = 0B;
      D.17651 = procinfo.hThread;
      D.17652 = D.17651 + 18446744073709551615;
      if (D.17652 <= -3B) goto <D.17653>; else goto <D.17654>;
      <D.17653>:
      D.17651 = procinfo.hThread;
      CloseHandle (D.17651);
      <D.17654>:
      D.17655 = procinfo.dwProcessId;
      process_info->pid = D.17655;
      D.17656 = procinfo.dwThreadId;
      process_info->tid = D.17656;
      goto <D.17657>;
      <D.17649>:
      D.17658 = GetLastError ();
      D.17659 = -D.17658;
      process_info->pid = D.17659;
      <D.17657>:
      D.17574 = (MonoBoolean) ret;
      return D.17574;
    }
  finally
    {
      startinfo = {CLOBBER};
      procinfo = {CLOBBER};
      spath = {CLOBBER};
    }
}


complete_path (const gunichar2 * appname, gchar * * completed)
{
  int D.17662;
  gchar * D.17665;
  gboolean D.17666;
  int D.17667;
  int D.17670;
  gchar * D.17673;
  gchar * D.17676;
  gchar * utf8app;
  gchar * utf8appmemory;
  gchar * found;

  utf8app = monoeg_g_utf16_to_utf8 (appname, -1, 0B, 0B, 0B);
  utf8appmemory = utf8app;
  D.17662 = monoeg_g_path_is_absolute (utf8app);
  if (D.17662 != 0) goto <D.17663>; else goto <D.17664>;
  <D.17663>:
  D.17665 = quote_path (utf8app);
  *completed = D.17665;
  monoeg_g_free (utf8appmemory);
  D.17666 = 1;
  return D.17666;
  <D.17664>:
  D.17667 = monoeg_g_file_test (utf8app, 8);
  if (D.17667 != 0) goto <D.17668>; else goto <D.17669>;
  <D.17668>:
  D.17670 = monoeg_g_file_test (utf8app, 4);
  if (D.17670 == 0) goto <D.17671>; else goto <D.17672>;
  <D.17671>:
  D.17673 = quote_path (utf8app);
  *completed = D.17673;
  monoeg_g_free (utf8appmemory);
  D.17666 = 1;
  return D.17666;
  <D.17672>:
  <D.17669>:
  found = monoeg_g_find_program_in_path (utf8app);
  if (found == 0B) goto <D.17674>; else goto <D.17675>;
  <D.17674>:
  *completed = 0B;
  monoeg_g_free (utf8appmemory);
  D.17666 = 0;
  return D.17666;
  <D.17675>:
  D.17676 = quote_path (found);
  *completed = D.17676;
  monoeg_g_free (found);
  monoeg_g_free (utf8appmemory);
  D.17666 = 1;
  return D.17666;
}


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

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


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

  D.17681 = __builtin_object_size (__dest, 0);
  D.17680 = __builtin___memcpy_chk (__dest, __src, __len, D.17681);
  return D.17680;
}


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

  if (ms < 0) goto <D.17683>; else goto <D.17684>;
  <D.17683>:
  ret = WaitForSingleObjectEx (process, 4294967295, 1);
  goto <D.17685>;
  <D.17684>:
  ms.21 = (unsigned int) ms;
  ret = WaitForSingleObjectEx (process, ms.21, 1);
  <D.17685>:
  if (ret == 0) goto <D.17687>; else goto <D.17688>;
  <D.17687>:
  D.17689 = 1;
  return D.17689;
  <D.17688>:
  D.17689 = 0;
  return D.17689;
}


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

  if (ms < 0) goto <D.17691>; else goto <D.17692>;
  <D.17691>:
  ret = WaitForInputIdle (process, 4294967295);
  goto <D.17693>;
  <D.17692>:
  ms.22 = (unsigned int) ms;
  ret = WaitForInputIdle (process, ms.22);
  <D.17693>:
  D.17696 = ret == 0;
  D.17695 = (MonoBoolean) D.17696;
  return D.17695;
}


ves_icall_System_Diagnostics_Process_ExitTime_internal (void * process)
{
  unsigned int D.17700;
  long unsigned int D.17701;
  long unsigned int D.17702;
  unsigned int D.17703;
  long unsigned int D.17704;
  long unsigned int D.17705;
  gint64 D.17706;
  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.17698>; else goto <D.17699>;
      <D.17698>:
      D.17700 = exit_time.dwHighDateTime;
      D.17701 = (long unsigned int) D.17700;
      D.17702 = D.17701 << 32;
      D.17703 = exit_time.dwLowDateTime;
      D.17704 = (long unsigned int) D.17703;
      D.17705 = D.17702 + D.17704;
      ticks = (gint64) D.17705;
      D.17706 = ticks;
      return D.17706;
      <D.17699>:
      D.17706 = 0;
      return D.17706;
    }
  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.17711;
  long unsigned int D.17712;
  long unsigned int D.17713;
  unsigned int D.17714;
  long unsigned int D.17715;
  long unsigned int D.17716;
  gint64 D.17717;
  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.17709>; else goto <D.17710>;
      <D.17709>:
      D.17711 = create_time.dwHighDateTime;
      D.17712 = (long unsigned int) D.17711;
      D.17713 = D.17712 << 32;
      D.17714 = create_time.dwLowDateTime;
      D.17715 = (long unsigned int) D.17714;
      D.17716 = D.17713 + D.17715;
      ticks = (gint64) D.17716;
      D.17717 = ticks;
      return D.17717;
      <D.17710>:
      D.17717 = 0;
      return D.17717;
    }
  finally
    {
      create_time = {CLOBBER};
      exit_time = {CLOBBER};
      kernel_time = {CLOBBER};
      user_time = {CLOBBER};
    }
}


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

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


ves_icall_System_Diagnostics_Process_ProcessName_internal (void * process)
{
  struct MonoString * D.17726;
  void * mod.24;
  struct MonoDomain * D.17730;
  int len.25;
  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.17724>; else goto <D.17725>;
      <D.17724>:
      D.17726 = 0B;
      return D.17726;
      <D.17725>:
      mod.24 = mod;
      len = GetModuleBaseName (process, mod.24, &name, 260);
      if (len == 0) goto <D.17728>; else goto <D.17729>;
      <D.17728>:
      D.17726 = 0B;
      return D.17726;
      <D.17729>:
      D.17730 = mono_domain_get ();
      len.25 = (int) len;
      string = mono_string_new_utf16 (D.17730, &name, len.25);
      D.17726 = string;
      return D.17726;
    }
  finally
    {
      mod = {CLOBBER};
      name = {CLOBBER};
      needed = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_GetProcesses_internal ()
{
  long unsigned int D.17734;
  long unsigned int D.17735;
  unsigned int D.17736;
  unsigned int needed.26;
  long unsigned int D.17740;
  unsigned int D.17742;
  struct MonoDomain * D.17743;
  struct MonoClass * D.17744;
  long unsigned int D.17745;
  char * D.17746;
  long unsigned int D.17747;
  struct MonoArray * D.17748;
  struct MonoArray * procs;
  gboolean ret;
  DWORD needed;
  guint32 count;
  guint32 * pids;

  try
    {
      count = 512;
      <D.17274>:
      D.17734 = (long unsigned int) count;
      D.17735 = D.17734 * 4;
      pids = monoeg_malloc0 (D.17735);
      D.17736 = count * 4;
      ret = EnumProcesses (pids, D.17736, &needed);
      if (ret == 0) goto <D.17737>; else goto <D.17738>;
      <D.17737>:
      {
        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.17738>:
      needed.26 = needed;
      D.17740 = (long unsigned int) needed.26;
      D.17734 = (long unsigned int) count;
      D.17735 = D.17734 * 4;
      if (D.17740 < D.17735) goto <D.17273>; else goto <D.17741>;
      <D.17741>:
      monoeg_g_free (pids);
      pids = 0B;
      D.17742 = count * 3;
      count = D.17742 / 2;
      goto <D.17274>;
      <D.17273>:
      needed.26 = needed;
      count = needed.26 / 4;
      D.17743 = mono_domain_get ();
      D.17744 = mono_get_int32_class ();
      D.17745 = (long unsigned int) count;
      procs = mono_array_new (D.17743, D.17744, D.17745);
      D.17746 = mono_array_addr_with_size (procs, 4, 0);
      needed.26 = needed;
      D.17747 = (long unsigned int) needed.26;
      memcpy (D.17746, pids, D.17747);
      monoeg_g_free (pids);
      pids = 0B;
      D.17748 = procs;
      return D.17748;
    }
  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.17752;
  long unsigned int ws_max.28;
  unsigned int D.17754;
  MonoBoolean D.17755;
  gboolean ret;
  SIZE_T ws_min;
  SIZE_T ws_max;

  try
    {
      ret = GetProcessWorkingSetSize (process, &ws_min, &ws_max);
      ws_min.27 = ws_min;
      D.17752 = (unsigned int) ws_min.27;
      *min = D.17752;
      ws_max.28 = ws_max;
      D.17754 = (unsigned int) ws_max.28;
      *max = D.17754;
      D.17755 = (MonoBoolean) ret;
      return D.17755;
    }
  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.17760;
  long unsigned int ws_min.29;
  long unsigned int ws_max.30;
  long unsigned int ws_min.31;
  long unsigned int ws_max.32;
  gboolean ret;
  SIZE_T ws_min;
  SIZE_T ws_max;

  try
    {
      ret = GetProcessWorkingSetSize (process, &ws_min, &ws_max);
      if (ret == 0) goto <D.17758>; else goto <D.17759>;
      <D.17758>:
      D.17760 = 0;
      return D.17760;
      <D.17759>:
      if (use_min == 1) goto <D.17761>; else goto <D.17762>;
      <D.17761>:
      ws_min.29 = (long unsigned int) min;
      ws_min = ws_min.29;
      goto <D.17764>;
      <D.17762>:
      ws_max.30 = (long unsigned int) max;
      ws_max = ws_max.30;
      <D.17764>:
      ws_min.31 = ws_min;
      ws_max.32 = ws_max;
      ret = SetProcessWorkingSetSize (process, ws_min.31, ws_max.32);
      D.17760 = (MonoBoolean) ret;
      return D.17760;
    }
  finally
    {
      ws_min = {CLOBBER};
      ws_max = {CLOBBER};
    }
}


ves_icall_System_Diagnostics_Process_Kill_internal (void * process, gint32 sig)
{
  MonoBoolean D.17770;
  int D.17771;
  int D.17772;

  D.17771 = -sig;
  D.17772 = TerminateProcess (process, D.17771);
  D.17770 = (MonoBoolean) D.17772;
  return D.17770;
}


ves_icall_System_Diagnostics_Process_Times (void * process, gint32 type)
{
  int D.17774;
  gint64 D.17779;
  struct FILETIME * user_time.33;
  struct FILETIME * kernel_time.34;
  long int D.17784;
  long int D.17785;
  struct FILETIME create_time;
  struct FILETIME exit_time;
  struct FILETIME kernel_time;
  struct FILETIME user_time;

  try
    {
      D.17774 = GetProcessTimes (process, &create_time, &exit_time, &kernel_time, &user_time);
      if (D.17774 != 0) goto <D.17775>; else goto <D.17776>;
      <D.17775>:
      if (type == 0) goto <D.17777>; else goto <D.17778>;
      <D.17777>:
      user_time.33 = &user_time;
      D.17779 = MEM[(gint64 *)user_time.33];
      return D.17779;
      <D.17778>:
      if (type == 1) goto <D.17781>; else goto <D.17782>;
      <D.17781>:
      kernel_time.34 = &kernel_time;
      D.17779 = MEM[(gint64 *)kernel_time.34];
      return D.17779;
      <D.17782>:
      kernel_time.34 = &kernel_time;
      D.17784 = MEM[(gint64 *)kernel_time.34];
      user_time.33 = &user_time;
      D.17785 = MEM[(gint64 *)user_time.33];
      D.17779 = D.17784 + D.17785;
      return D.17779;
      <D.17776>:
      D.17779 = 0;
      return D.17779;
    }
  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.17788;
  gint32 iftmp.35;
  unsigned int D.17792;
  gint32 D.17794;
  gint32 ret;

  D.17788 = GetPriorityClass (process);
  ret = (gint32) D.17788;
  if (ret == 0) goto <D.17790>; else goto <D.17791>;
  <D.17790>:
  D.17792 = GetLastError ();
  iftmp.35 = (gint32) D.17792;
  goto <D.17793>;
  <D.17791>:
  iftmp.35 = 0;
  <D.17793>:
  *error = iftmp.35;
  D.17794 = ret;
  return D.17794;
}


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

  priority_class.36 = (unsigned int) priority_class;
  ret = SetPriorityClass (process, priority_class.36);
  if (ret == 0) goto <D.17798>; else goto <D.17799>;
  <D.17798>:
  D.17800 = GetLastError ();
  iftmp.37 = (gint32) D.17800;
  goto <D.17801>;
  <D.17799>:
  iftmp.37 = 0;
  <D.17801>:
  *error = iftmp.37;
  D.17802 = (MonoBoolean) ret;
  return D.17802;
}


ves_icall_System_Diagnostics_Process_ProcessHandle_duplicate (void * process)
{
  void * D.17804;
  void * D.17805;
  void * D.17806;
  void * ret;

  try
    {
      D.17804 = GetCurrentProcess ();
      D.17805 = GetCurrentProcess ();
      DuplicateHandle (D.17804, process, D.17805, &ret, 2032639, 1, 0);
      D.17806 = ret;
      return D.17806;
    }
  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)
{
  long int D.17809;
  void * D.17810;
  <unnamed type> data_type.38;
  long int D.17812;
  <unnamed type> perror.39;
  int perror.40;
  gint64 D.17817;
  MonoProcessError perror;
  guint64 res;

  try
    {
      D.17809 = (long int) pid;
      D.17810 = (void *) D.17809;
      data_type.38 = (<unnamed type>) data_type;
      D.17812 = mono_process_get_data_with_error (D.17810, data_type.38, &perror);
      res = (guint64) D.17812;
      if (error != 0B) goto <D.17813>; else goto <D.17814>;
      <D.17813>:
      perror.39 = perror;
      perror.40 = (int) perror.39;
      *error = perror.40;
      <D.17814>:
      D.17817 = (gint64) res;
      return D.17817;
    }
  finally
    {
      perror = {CLOBBER};
    }
}


