process_wait (void * handle, guint32 timeout, gboolean alertable)
{
  long unsigned int D.11312;
  guint32 D.11315;
  signed int handle.0;
  _Bool D.11317;
  long int D.11318;
  long int D.11319;
  struct _WapiHandle_process * process_handle.1;
  int D.11325;
  int D.11330;
  int D.11331;
  _Bool D.11334;
  union MonoSemType * D.11339;
  unsigned int D.11340;
  unsigned int D.11341;
  int * D.11345;
  int D.11346;
  int D.11354;
  unsigned int D.11358;
  unsigned int D.11363;
  int D.11366;
  _Bool D.11369;
  long int D.11370;
  long int D.11371;
  int iftmp.2;
  union 
{
  int __in;
  int __i;
} D.11302;
  int D.11378;
  unsigned char D.11379;
  unsigned char D.11380;
  unsigned char D.11381;
  signed char D.11382;
  signed char D.11383;
  union 
{
  int __in;
  int __i;
} D.11306;
  int D.11386;
  int D.11387;
  int D.11388;
  unsigned int D.11389;
  union 
{
  int __in;
  int __i;
} D.11310;
  int D.11391;
  int D.11392;
  int D.11393;
  unsigned int D.11394;
  long int D.11395;
  struct WapiFileTime * D.11396;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  pid_t pid;
  pid_t ret;
  int status;
  guint32 start;
  guint32 now;
  struct MonoProcess * mp;
  gboolean spin;
  void * current_thread;
  static const char __func__[13] = "process_wait";
  typedef union 
{
  int __in;
  int __i;
} unionunion 
{
  int __in;
  int __i;
};

  try
    {
      D.11312 = pthread_self ();
      current_thread = _wapi_thread_handle_from_id (D.11312);
      if (current_thread == 0B) goto <D.11313>; else goto <D.11314>;
      <D.11313>:
      SetLastError (6);
      D.11315 = 4294967295;
      return D.11315;
      <D.11314>:
      handle.0 = (signed int) handle;
      D.11317 = handle.0 < 0;
      D.11318 = (long int) D.11317;
      D.11319 = __builtin_expect (D.11318, 0);
      if (D.11319 != 0) goto <D.11320>; else goto <D.11321>;
      <D.11320>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 2912, "(GPOINTER_TO_UINT (handle) & _WAPI_PROCESS_UNHANDLED) != _WAPI_PROCESS_UNHANDLED");
      <D.11321>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.11322>; else goto <D.11323>;
      <D.11322>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      D.11315 = 4294967295;
      return D.11315;
      <D.11323>:
      process_handle.1 = process_handle;
      D.11325 = process_handle.1->exited;
      if (D.11325 != 0) goto <D.11326>; else goto <D.11327>;
      <D.11326>:
      D.11315 = 0;
      return D.11315;
      <D.11327>:
      process_handle.1 = process_handle;
      pid = process_handle.1->id;
      process_handle.1 = process_handle;
      mp = process_handle.1->mono_process;
      if (mp != 0B) goto <D.11328>; else goto <D.11329>;
      <D.11328>:
      process_handle.1 = process_handle;
      D.11330 = process_handle.1->self;
      D.11331 = _wapi_getpid ();
      if (D.11330 != D.11331) goto <D.11332>; else goto <D.11333>;
      <D.11332>:
      mp = 0B;
      <D.11333>:
      <D.11329>:
      start = mono_msec_ticks ();
      now = start;
      D.11334 = mp == 0B;
      spin = (gboolean) D.11334;
      <D.11298>:
      if (mp != 0B) goto <D.11335>; else goto <D.11336>;
      <D.11335>:
      if (timeout != 4294967295) goto <D.11337>; else goto <D.11338>;
      <D.11337>:
      D.11339 = &mp->exit_sem;
      D.11340 = start - now;
      D.11341 = D.11340 + timeout;
      ret = mono_sem_timedwait (D.11339, D.11341, alertable);
      goto <D.11342>;
      <D.11338>:
      D.11339 = &mp->exit_sem;
      ret = mono_sem_wait (D.11339, alertable);
      <D.11342>:
      if (ret == -1) goto <D.11343>; else goto <D.11344>;
      <D.11343>:
      D.11345 = __errno_location ();
      D.11346 = *D.11345;
      if (D.11346 != 4) goto <D.11347>; else goto <D.11348>;
      <D.11347>:
      D.11345 = __errno_location ();
      D.11346 = *D.11345;
      if (D.11346 != 145) goto <D.11349>; else goto <D.11350>;
      <D.11349>:
      <D.11350>:
      <D.11348>:
      <D.11344>:
      if (ret == 0) goto <D.11351>; else goto <D.11352>;
      <D.11351>:
      D.11339 = &mp->exit_sem;
      mono_sem_post (D.11339);
      goto <D.11297>;
      <D.11352>:
      goto <D.11353>;
      <D.11336>:
      D.11354 = is_pid_valid (pid);
      if (D.11354 == 0) goto <D.11297>; else goto <D.11355>;
      <D.11355>:
      <D.11353>:
      if (timeout == 0) goto <D.11356>; else goto <D.11357>;
      <D.11356>:
      D.11315 = 258;
      return D.11315;
      <D.11357>:
      now = mono_msec_ticks ();
      D.11358 = now - start;
      if (D.11358 >= timeout) goto <D.11359>; else goto <D.11360>;
      <D.11359>:
      D.11315 = 258;
      return D.11315;
      <D.11360>:
      if (spin != 0) goto <D.11361>; else goto <D.11362>;
      <D.11361>:
      D.11340 = start - now;
      D.11341 = D.11340 + timeout;
      D.11363 = MIN_EXPR <D.11341, 100>;
      _wapi_handle_spin (D.11363);
      <D.11362>:
      if (alertable != 0) goto <D.11364>; else goto <D.11365>;
      <D.11364>:
      D.11366 = _wapi_thread_apc_pending (current_thread);
      if (D.11366 != 0) goto <D.11367>; else goto <D.11368>;
      <D.11367>:
      D.11315 = 192;
      return D.11315;
      <D.11368>:
      <D.11365>:
      goto <D.11298>;
      <D.11297>:
      ret = _wapi_handle_lock_shared_handles ();
      D.11369 = ret != 0;
      D.11370 = (long int) D.11369;
      D.11371 = __builtin_expect (D.11370, 0);
      if (D.11371 != 0) goto <D.11372>; else goto <D.11373>;
      <D.11372>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 3006, "ret == 0");
      <D.11373>:
      if (mp != 0B) goto <D.11375>; else goto <D.11376>;
      <D.11375>:
      iftmp.2 = mp->status;
      goto <D.11377>;
      <D.11376>:
      iftmp.2 = 0;
      <D.11377>:
      status = iftmp.2;
      D.11302.__in = status;
      D.11378 = D.11302.__i;
      D.11379 = (unsigned char) D.11378;
      D.11380 = D.11379 & 127;
      D.11381 = D.11380 + 1;
      D.11382 = (signed char) D.11381;
      D.11383 = D.11382 >> 1;
      if (D.11383 > 0) goto <D.11384>; else goto <D.11385>;
      <D.11384>:
      {
        typedef union 
      {
        int __in;
        int __i;
      } unionunion 
      {
        int __in;
        int __i;
      };

        process_handle.1 = process_handle;
        D.11306.__in = status;
        D.11386 = D.11306.__i;
        D.11387 = D.11386 & 127;
        D.11388 = D.11387 + 128;
        D.11389 = (unsigned int) D.11388;
        process_handle.1->exitstatus = D.11389;
      }
      goto <D.11390>;
      <D.11385>:
      {
        typedef union 
      {
        int __in;
        int __i;
      } unionunion 
      {
        int __in;
        int __i;
      };

        process_handle.1 = process_handle;
        D.11310.__in = status;
        D.11391 = D.11310.__i;
        D.11392 = D.11391 & 65280;
        D.11393 = D.11392 >> 8;
        D.11394 = (unsigned int) D.11393;
        process_handle.1->exitstatus = D.11394;
      }
      <D.11390>:
      D.11395 = time (0B);
      process_handle.1 = process_handle;
      D.11396 = &process_handle.1->exit_time;
      _wapi_time_t_to_filetime (D.11395, D.11396);
      process_handle.1 = process_handle;
      process_handle.1->exited = 1;
      _wapi_shared_handle_set_signal_state (handle, 1);
      _wapi_handle_unlock_shared_handles ();
      D.11315 = 0;
      return D.11315;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


is_pid_valid (pid_t pid)
{
  int D.11399;
  gboolean D.11402;
  gboolean result;
  gchar * dir;

  result = 0;
  dir = monoeg_g_strdup_printf ("/proc/%d", pid);
  D.11399 = access (dir, 0);
  if (D.11399 == 0) goto <D.11400>; else goto <D.11401>;
  <D.11400>:
  result = 1;
  <D.11401>:
  monoeg_g_free (dir);
  D.11402 = result;
  return D.11402;
}


_wapi_handle_spin (guint32 ms)
{
  _Bool D.11404;
  long int D.11405;
  long int D.11406;
  unsigned int D.11409;
  long int D.11410;
  struct timespec sleepytime;

  try
    {
      D.11404 = ms > 999;
      D.11405 = (long int) D.11404;
      D.11406 = __builtin_expect (D.11405, 0);
      if (D.11406 != 0) goto <D.11407>; else goto <D.11408>;
      <D.11407>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 326, "ms < 1000");
      <D.11408>:
      sleepytime.tv_sec = 0;
      D.11409 = ms * 1000000;
      D.11410 = (long int) D.11409;
      sleepytime.tv_nsec = D.11410;
      nanosleep (&sleepytime, 0B);
    }
  finally
    {
      sleepytime = {CLOBBER};
    }
}


_wapi_handle_lock_shared_handles ()
{
  int D.11411;

  D.11411 = _wapi_shm_sem_lock (3);
  return D.11411;
}


_wapi_shared_handle_set_signal_state (void * handle, gboolean state)
{
  int iftmp.3;
  <unnamed type> D.11418;
  <unnamed type> D.11420;
  <unnamed type> D.11422;
  <unnamed type> D.11424;
  _Bool D.11426;
  long int D.11427;
  long int D.11428;
  unsigned int D.11431;
  struct _WapiHandleUnshared * D.11432;
  unsigned int D.11433;
  unsigned int D.11434;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.4;
  unsigned int D.11436;
  guint32 idx;
  struct _WapiHandleUnshared * handle_data;
  struct _WapiHandle_shared_ref * ref;
  struct _WapiHandleShared * shared_data;

  idx = (guint32) handle;
  if (idx > 4194303) goto <D.11413>; else goto <D.11414>;
  <D.11413>:
  return;
  <D.11414>:
  D.11418 = _wapi_handle_type (handle);
  if (D.11418 != 9) goto <D.11419>; else goto <D.11416>;
  <D.11419>:
  D.11420 = _wapi_handle_type (handle);
  if (D.11420 != 11) goto <D.11421>; else goto <D.11416>;
  <D.11421>:
  D.11422 = _wapi_handle_type (handle);
  if (D.11422 != 12) goto <D.11423>; else goto <D.11416>;
  <D.11423>:
  D.11424 = _wapi_handle_type (handle);
  if (D.11424 != 13) goto <D.11425>; else goto <D.11416>;
  <D.11425>:
  iftmp.3 = 1;
  goto <D.11417>;
  <D.11416>:
  iftmp.3 = 0;
  <D.11417>:
  D.11426 = iftmp.3 != 0;
  D.11427 = (long int) D.11426;
  D.11428 = __builtin_expect (D.11427, 0);
  if (D.11428 != 0) goto <D.11429>; else goto <D.11430>;
  <D.11429>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 201, "_WAPI_SHARED_HANDLE(_wapi_handle_type (handle))");
  <D.11430>:
  D.11431 = idx / 256;
  D.11432 = _wapi_private_handles[D.11431];
  D.11433 = idx & 255;
  D.11434 = D.11433 * 144;
  handle_data = D.11432 + D.11434;
  ref = &handle_data->u.shared;
  _wapi_shared_layout.4 = _wapi_shared_layout;
  D.11436 = ref->offset;
  shared_data = &_wapi_shared_layout.4->handles[D.11436];
  shared_data->signalled = state;
}


_wapi_handle_type (void * handle)
{
  unsigned int D.11442;
  struct _WapiHandleUnshared * D.11443;
  WapiHandleType D.11444;
  unsigned int D.11445;
  unsigned int D.11446;
  struct _WapiHandleUnshared * D.11447;
  guint32 idx;

  idx = (guint32) handle;
  if (idx > 4194303) goto <D.11438>; else goto <D.11440>;
  <D.11440>:
  if (idx > 268435455) goto <D.11438>; else goto <D.11441>;
  <D.11441>:
  D.11442 = idx / 256;
  D.11443 = _wapi_private_handles[D.11442];
  if (D.11443 == 0B) goto <D.11438>; else goto <D.11439>;
  <D.11438>:
  D.11444 = 0;
  return D.11444;
  <D.11439>:
  D.11442 = idx / 256;
  D.11443 = _wapi_private_handles[D.11442];
  D.11445 = idx & 255;
  D.11446 = D.11445 * 144;
  D.11447 = D.11443 + D.11446;
  D.11444 = D.11447->type;
  return D.11444;
}


_wapi_handle_unlock_shared_handles ()
{
  int D.11449;

  D.11449 = _wapi_shm_sem_unlock (3);
  return D.11449;
}


process_close (void * handle, void * data)
{
  struct MonoProcess * D.11451;
  int D.11454;
  int D.11455;
  gint32 * D.11458;
  struct _WapiHandle_process * process_handle;

  process_handle = data;
  D.11451 = process_handle->mono_process;
  if (D.11451 != 0B) goto <D.11452>; else goto <D.11453>;
  <D.11452>:
  D.11454 = process_handle->self;
  D.11455 = _wapi_getpid ();
  if (D.11454 == D.11455) goto <D.11456>; else goto <D.11457>;
  <D.11456>:
  D.11451 = process_handle->mono_process;
  D.11458 = &D.11451->handle_count;
  InterlockedDecrement (D.11458);
  <D.11457>:
  <D.11453>:
  mono_processes_cleanup ();
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.11459;
  unsigned int D.11460;

  D.11460 = __sync_sub_and_fetch_4 (val, 1);
  D.11459 = (gint32) D.11460;
  return D.11459;
}


mono_processes_cleanup ()
{
  int D.11462;
  int D.11465;
  void * D.11468;
  int D.11476;
  unsigned int spin.5;
  struct MonoProcess * mono_processes.6;
  struct MonoProcess * mono_processes.7;
  int mono_processes_read_lock.8;
  union MonoSemType * D.11497;
  struct MonoProcess * mp;
  struct MonoProcess * prev;
  struct MonoProcess * candidate;
  void * unref_handle;
  int spin;

  prev = 0B;
  candidate = 0B;
  D.11462 = InterlockedCompareExchange (&mono_processes_cleaning_up, 1, 0);
  if (D.11462 != 0) goto <D.11463>; else goto <D.11464>;
  <D.11463>:
  return;
  <D.11464>:
  mp = mono_processes;
  goto <D.11251>;
  <D.11252>:
  D.11465 = mp->pid;
  if (D.11465 == 0) goto <D.11466>; else goto <D.11467>;
  <D.11466>:
  D.11468 = mp->handle;
  if (D.11468 != 0B) goto <D.11469>; else goto <D.11470>;
  <D.11469>:
  pthread_mutex_lock (&mono_processes_mutex);
  unref_handle = mp->handle;
  mp->handle = 0B;
  pthread_mutex_unlock (&mono_processes_mutex);
  if (unref_handle != 0B) goto <D.11471>; else goto <D.11472>;
  <D.11471>:
  _wapi_handle_unref (unref_handle);
  <D.11472>:
  // predicted unlikely by continue predictor.
  goto <D.11251>;
  <D.11470>:
  <D.11467>:
  mp = mp->next;
  <D.11251>:
  if (mp != 0B) goto <D.11252>; else goto <D.11253>;
  <D.11253>:
  mp = mono_processes;
  spin = 0;
  goto <D.11255>;
  <D.11256>:
  D.11476 = mp->handle_count;
  if (D.11476 == 0) goto <D.11477>; else goto <D.11473>;
  <D.11477>:
  D.11465 = mp->pid;
  if (D.11465 == 0) goto <D.11474>; else goto <D.11473>;
  <D.11473>:
  if (candidate != 0B) goto <D.11474>; else goto <D.11475>;
  <D.11474>:
  if (spin > 0) goto <D.11478>; else goto <D.11479>;
  <D.11478>:
  spin.5 = (unsigned int) spin;
  _wapi_handle_spin (spin.5);
  spin = spin << 1;
  <D.11479>:
  pthread_mutex_lock (&mono_processes_mutex);
  if (candidate == 0B) goto <D.11481>; else goto <D.11482>;
  <D.11481>:
  mono_processes.6 = mono_processes;
  if (mp == mono_processes.6) goto <D.11484>; else goto <D.11485>;
  <D.11484>:
  mono_processes.7 = mp->next;
  mono_processes = mono_processes.7;
  goto <D.11487>;
  <D.11485>:
  mono_processes.7 = mp->next;
  prev->next = mono_processes.7;
  <D.11487>:
  candidate = mp;
  <D.11482>:
  mono_memory_barrier ();
  mono_processes_read_lock.8 = mono_processes_read_lock;
  if (mono_processes_read_lock.8 != 0) goto <D.11489>; else goto <D.11490>;
  <D.11489>:
  if (spin == 0) goto <D.11491>; else goto <D.11492>;
  <D.11491>:
  spin = 1;
  goto <D.11493>;
  <D.11492>:
  if (spin > 7) goto <D.11494>; else goto <D.11495>;
  <D.11494>:
  pthread_mutex_unlock (&mono_processes_mutex);
  goto <D.11254>;
  <D.11495>:
  <D.11493>:
  goto <D.11496>;
  <D.11490>:
  mp = candidate->next;
  D.11497 = &candidate->exit_sem;
  sem_destroy (D.11497);
  monoeg_g_free (candidate);
  candidate = 0B;
  <D.11496>:
  pthread_mutex_unlock (&mono_processes_mutex);
  // predicted unlikely by continue predictor.
  goto <D.11255>;
  <D.11475>:
  spin = 0;
  prev = mp;
  mp = mp->next;
  <D.11255>:
  if (mp != 0B) goto <D.11256>; else goto <D.11254>;
  <D.11254>:
  InterlockedDecrement (&mono_processes_cleaning_up);
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.11499;
  unsigned int comp.9;
  unsigned int exch.10;
  unsigned int D.11502;

  comp.9 = (unsigned int) comp;
  exch.10 = (unsigned int) exch;
  D.11502 = __sync_val_compare_and_swap_4 (dest, comp.9, exch.10);
  D.11499 = (gint32) D.11502;
  return D.11499;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


ShellExecuteEx (struct WapiShellExecuteInfo * sei)
{
  gboolean D.11506;
  const gunichar2 * D.11507;
  const gunichar2 * utf16_quote.11;
  const gunichar2 * iftmp.12;
  const gunichar2 * D.11512;
  const gunichar2 * D.11518;
  unsigned int D.11521;
  gunichar2 * handler_utf16.13;
  gchar * handler.14;
  char * handler.15;
  gchar * handler.16;
  gchar * handler.17;
  gchar * handler.18;
  gunichar2 * handler_utf16.19;
  const gunichar2 * utf16_space.20;
  const gunichar2 * iftmp.21;
  unsigned int D.11550;
  void * D.11553;
  <unnamed type> D.11554;
  unsigned int D.11555;
  gboolean ret;
  struct WapiProcessInformation process_info;
  gunichar2 * args;

  try
    {
      if (sei == 0B) goto <D.11504>; else goto <D.11505>;
      <D.11504>:
      SetLastError (87);
      D.11506 = 0;
      return D.11506;
      <D.11505>:
      D.11507 = sei->lpFile;
      if (D.11507 == 0B) goto <D.11508>; else goto <D.11509>;
      <D.11508>:
      D.11506 = 1;
      return D.11506;
      <D.11509>:
      utf16_quote.11 = utf16_quote;
      D.11507 = sei->lpFile;
      utf16_quote.11 = utf16_quote;
      D.11512 = sei->lpParameters;
      if (D.11512 != 0B) goto <D.11513>; else goto <D.11514>;
      <D.11513>:
      iftmp.12 = utf16_space;
      goto <D.11515>;
      <D.11514>:
      iftmp.12 = 0B;
      <D.11515>:
      D.11512 = sei->lpParameters;
      args = utf16_concat (utf16_quote.11, D.11507, utf16_quote.11, iftmp.12, D.11512, 0B);
      if (args == 0B) goto <D.11516>; else goto <D.11517>;
      <D.11516>:
      SetLastError (13);
      D.11506 = 0;
      return D.11506;
      <D.11517>:
      D.11518 = sei->lpDirectory;
      ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.11518, 0B, &process_info);
      monoeg_g_free (args);
      if (ret == 0) goto <D.11519>; else goto <D.11520>;
      <D.11519>:
      D.11521 = GetLastError ();
      if (D.11521 == 14) goto <D.11522>; else goto <D.11523>;
      <D.11522>:
      D.11506 = ret;
      return D.11506;
      <D.11523>:
      <D.11520>:
      if (ret == 0) goto <D.11524>; else goto <D.11525>;
      <D.11524>:
      {
        static char * handler;
        static gunichar2 * handler_utf16;

        handler_utf16.13 = handler_utf16;
        if (handler_utf16.13 == 4294967295B) goto <D.11527>; else goto <D.11528>;
        <D.11527>:
        D.11506 = 0;
        return D.11506;
        <D.11528>:
        handler.14 = monoeg_g_find_program_in_path ("xdg-open");
        handler = handler.14;
        handler.15 = handler;
        if (handler.15 == 0B) goto <D.11531>; else goto <D.11532>;
        <D.11531>:
        handler.16 = monoeg_g_find_program_in_path ("gnome-open");
        handler = handler.16;
        handler.15 = handler;
        if (handler.15 == 0B) goto <D.11534>; else goto <D.11535>;
        <D.11534>:
        handler.17 = monoeg_g_find_program_in_path ("kfmclient");
        handler = handler.17;
        handler.15 = handler;
        if (handler.15 == 0B) goto <D.11537>; else goto <D.11538>;
        <D.11537>:
        handler_utf16 = 4294967295B;
        D.11506 = 0;
        return D.11506;
        <D.11538>:
        {
          char * old;

          old = handler;
          handler.18 = monoeg_g_strconcat (old, " exec", 0B);
          handler = handler.18;
          monoeg_g_free (old);
        }
        <D.11535>:
        <D.11532>:
        handler.15 = handler;
        handler_utf16.19 = monoeg_g_utf8_to_utf16 (handler.15, -1, 0B, 0B, 0B);
        handler_utf16 = handler_utf16.19;
        handler.15 = handler;
        monoeg_g_free (handler.15);
        handler_utf16.13 = handler_utf16;
        utf16_space.20 = utf16_space;
        utf16_quote.11 = utf16_quote;
        D.11507 = sei->lpFile;
        utf16_quote.11 = utf16_quote;
        D.11512 = sei->lpParameters;
        if (D.11512 != 0B) goto <D.11543>; else goto <D.11544>;
        <D.11543>:
        iftmp.21 = utf16_space;
        goto <D.11545>;
        <D.11544>:
        iftmp.21 = 0B;
        <D.11545>:
        D.11512 = sei->lpParameters;
        args = utf16_concat (handler_utf16.13, utf16_space.20, utf16_quote.11, D.11507, utf16_quote.11, iftmp.21, D.11512, 0B);
        if (args == 0B) goto <D.11546>; else goto <D.11547>;
        <D.11546>:
        SetLastError (13);
        D.11506 = 0;
        return D.11506;
        <D.11547>:
        D.11518 = sei->lpDirectory;
        ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.11518, 0B, &process_info);
        monoeg_g_free (args);
        if (ret == 0) goto <D.11548>; else goto <D.11549>;
        <D.11548>:
        D.11550 = GetLastError ();
        if (D.11550 != 14) goto <D.11551>; else goto <D.11552>;
        <D.11551>:
        SetLastError (13);
        <D.11552>:
        D.11506 = 0;
        return D.11506;
        <D.11549>:
        D.11553 = process_info.hProcess;
        CloseHandle (D.11553);
        process_info.hProcess = 0B;
      }
      <D.11525>:
      D.11554 = sei->fMask;
      D.11555 = D.11554 & 64;
      if (D.11555 != 0) goto <D.11556>; else goto <D.11557>;
      <D.11556>:
      D.11553 = process_info.hProcess;
      sei->hProcess = D.11553;
      goto <D.11558>;
      <D.11557>:
      D.11553 = process_info.hProcess;
      CloseHandle (D.11553);
      <D.11558>:
      D.11506 = ret;
      return D.11506;
    }
  finally
    {
      process_info = {CLOBBER};
    }
}


utf16_concat (const gunichar2 * first)
{
  int D.11561;
  void * args.22;
  void * args.23;
  int D.11564;
  void * args.24;
  void * args.25;
  int D.11567;
  unsigned int D.11568;
  unsigned int D.11569;
  gunichar2 * D.11572;
  unsigned int total.26;
  unsigned int D.11574;
  gunichar2 * D.11575;
  int i.27;
  unsigned int i.28;
  unsigned int D.11578;
  gunichar2 * D.11579;
  short unsigned int D.11580;
  void * args.29;
  void * args.30;
  int i.31;
  unsigned int i.32;
  unsigned int D.11585;
  gunichar2 * D.11586;
  short unsigned int D.11587;
  void * args.33;
  void * args.34;
  void * args;
  int total;
  int i;
  const gunichar2 * s;
  gunichar2 * ret;

  try
    {
      total = 0;
      __builtin_va_start (&args, 0);
      D.11561 = len16 (first);
      total = D.11561 + total;
      args.22 = args;
      args.23 = args.22 + 4;
      args = args.23;
      s = MEM[(gunichar2 * *)args.22];
      goto <D.10735>;
      <D.10734>:
      D.11564 = len16 (s);
      total = D.11564 + total;
      args.24 = args;
      args.25 = args.24 + 4;
      args = args.25;
      s = MEM[(gunichar2 * *)args.24];
      <D.10735>:
      if (s != 0B) goto <D.10734>; else goto <D.10736>;
      <D.10736>:
      __builtin_va_end (&args);
      D.11567 = total + 1;
      D.11568 = (unsigned int) D.11567;
      D.11569 = D.11568 * 2;
      ret = monoeg_malloc (D.11569);
      if (ret == 0B) goto <D.11570>; else goto <D.11571>;
      <D.11570>:
      D.11572 = 0B;
      return D.11572;
      <D.11571>:
      total.26 = (unsigned int) total;
      D.11574 = total.26 * 2;
      D.11575 = ret + D.11574;
      *D.11575 = 0;
      i = 0;
      s = first;
      goto <D.10738>;
      <D.10737>:
      i.27 = i;
      i = i.27 + 1;
      i.28 = (unsigned int) i.27;
      D.11578 = i.28 * 2;
      D.11579 = ret + D.11578;
      D.11580 = *s;
      *D.11579 = D.11580;
      s = s + 2;
      <D.10738>:
      D.11580 = *s;
      if (D.11580 != 0) goto <D.10737>; else goto <D.10739>;
      <D.10739>:
      __builtin_va_start (&args, 0);
      args.29 = args;
      args.30 = args.29 + 4;
      args = args.30;
      s = MEM[(gunichar2 * *)args.29];
      goto <D.10745>;
      <D.10744>:
      {
        const gunichar2 * p;

        p = s;
        goto <D.10742>;
        <D.10741>:
        i.31 = i;
        i = i.31 + 1;
        i.32 = (unsigned int) i.31;
        D.11585 = i.32 * 2;
        D.11586 = ret + D.11585;
        D.11587 = *p;
        *D.11586 = D.11587;
        p = p + 2;
        <D.10742>:
        D.11587 = *p;
        if (D.11587 != 0) goto <D.10741>; else goto <D.10743>;
        <D.10743>:
      }
      args.33 = args;
      args.34 = args.33 + 4;
      args = args.34;
      s = MEM[(gunichar2 * *)args.33];
      <D.10745>:
      if (s != 0B) goto <D.10744>; else goto <D.10746>;
      <D.10746>:
      __builtin_va_end (&args);
      D.11572 = ret;
      return D.11572;
    }
  finally
    {
      args = {CLOBBER};
    }
}


len16 (const gunichar2 * str)
{
  const gunichar2 * str.35;
  short unsigned int D.11593;
  int D.11594;
  int len;

  len = 0;
  goto <D.10724>;
  <D.10723>:
  len = len + 1;
  <D.10724>:
  str.35 = str;
  str = str.35 + 2;
  D.11593 = *str.35;
  if (D.11593 != 0) goto <D.10723>; else goto <D.10725>;
  <D.10725>:
  D.11594 = len;
  return D.11594;
}


CreateProcessWithLogonW (const gunichar2 * username, const gunichar2 * domain, const gunichar2 * password, const guint32 logonFlags, const gunichar2 * appname, const gunichar2 * cmdline, guint32 create_flags, void * env, const gunichar2 * cwd, struct WapiStartupInfo * startup, struct WapiProcessInformation * process_info)
{
  gboolean D.11596;

  D.11596 = CreateProcess (appname, cmdline, 0B, 0B, 0, create_flags, env, cwd, startup, process_info);
  return D.11596;
}


CreateProcess (const gunichar2 * appname, const gunichar2 * cmdline, struct WapiSecurityAttributes * process_attrs, struct WapiSecurityAttributes * thread_attrs, gboolean inherit_handles, guint32 create_flags, void * new_environ, const gunichar2 * cwd, struct WapiStartupInfo * startup, struct WapiProcessInformation * process_info)
{
  const short unsigned int * * D.11612;
  const short unsigned int * D.11613;
  char D.11614;
  unsigned int D.11615;
  unsigned int D.11616;
  const short unsigned int * D.11617;
  short unsigned int D.11618;
  int D.11619;
  int D.11620;
  gchar * D.11623;
  char D.11624;
  const void * D.11627;
  unsigned int D.11628;
  unsigned int D.11629;
  unsigned int D.11630;
  sizetype D.11631;
  gchar * D.11632;
  char D.11633;
  int D.11636;
  int D.11640;
  char D.11646;
  gchar * D.11648;
  char D.11649;
  sizetype D.11653;
  gchar * D.11654;
  char D.11655;
  unsigned int D.11657;
  unsigned int D.11658;
  const short unsigned int * D.11659;
  short unsigned int D.11660;
  int D.11661;
  int D.11662;
  const gchar * D.11663;
  unsigned int D.11664;
  unsigned int D.11667;
  unsigned int D.11668;
  const short unsigned int * D.11669;
  short unsigned int D.11670;
  int D.11671;
  int D.11672;
  char D.11681;
  unsigned int D.11682;
  unsigned int D.11683;
  const short unsigned int * D.11684;
  short unsigned int D.11685;
  int D.11686;
  int D.11687;
  gchar * D.11690;
  char D.11691;
  const void * D.11694;
  unsigned int D.11695;
  unsigned int D.11696;
  unsigned int D.11697;
  sizetype D.11698;
  gchar * D.11699;
  int D.11702;
  int D.11706;
  int D.11711;
  const gunichar2 * utf16_space.36;
  char D.11725;
  struct GError * gerr.37;
  gchar * D.11730;
  <unnamed type> D.11734;
  unsigned int D.11735;
  void * D.11737;
  void * D.11738;
  void * D.11739;
  void * D.11740;
  void * D.11741;
  void * D.11742;
  short unsigned int D.11747;
  unsigned int D.11748;
  unsigned int D.11749;
  unsigned int D.11750;
  gchar * * D.11751;
  gchar * D.11752;
  char * * environ.38;
  unsigned int D.11755;
  char * * D.11756;
  char * D.11757;
  gchar * D.11758;
  unsigned int handle.39;
  unsigned int D.11762;
  struct _WapiHandleUnshared * D.11763;
  unsigned int D.11764;
  unsigned int D.11765;
  unsigned int D.11766;
  gchar * D.11767;
  int D.11768;
  int D.11771;
  _Bool D.11772;
  long int D.11773;
  long int D.11774;
  int D.11781;
  int D.11786;
  int D.11787;
  int i.40;
  int D.11791;
  gchar * * argv.41;
  gchar * D.11795;
  struct _WapiHandle_process * process_handle_data.42;
  union MonoSemType * D.11799;
  int D.11800;
  int * D.11803;
  int D.11804;
  char * D.11805;
  int D.11807;
  struct MonoProcess * mono_processes.43;
  unsigned int pid.44;
  gboolean D.11830;
  gchar * cmd;
  gchar * prog;
  gchar * full_prog;
  gchar * args;
  gchar * args_after_prog;
  gchar * dir;
  gchar * * env_strings;
  gchar * * argv;
  guint32 i;
  guint32 env_count;
  gboolean ret;
  void * handle;
  struct _WapiHandle_process process_handle;
  struct _WapiHandle_process * process_handle_data;
  struct GError * gerr;
  int in_fd;
  int out_fd;
  int err_fd;
  pid_t pid;
  int thr_ret;
  int startup_pipe[2];
  int dummy;
  struct MonoProcess * mono_process;
  gboolean fork_failed;
  void free_strings = <<< error >>>;
  static const char __func__[14] = "CreateProcess";
  void cleanup = <<< error >>>;

  try
    {
      cmd = 0B;
      prog = 0B;
      full_prog = 0B;
      args = 0B;
      args_after_prog = 0B;
      dir = 0B;
      env_strings = 0B;
      argv = 0B;
      env_count = 0;
      ret = 0;
      process_handle = {};
      gerr = 0B;
      startup_pipe[0] = -1;
      startup_pipe[1] = -1;
      fork_failed = 0;
      mono_once (&process_ops_once, process_ops_init);
      mono_once (&process_sig_chld_once, process_add_sigchld_handler);
      if (appname != 0B) goto <D.11598>; else goto <D.11599>;
      <D.11598>:
      cmd = mono_unicode_to_external (appname);
      if (cmd == 0B) goto <D.11600>; else goto <D.11601>;
      <D.11600>:
      SetLastError (3);
      goto free_strings;
      <D.11601>:
      switchDirectorySeparators (cmd);
      <D.11599>:
      if (cmdline != 0B) goto <D.11602>; else goto <D.11603>;
      <D.11602>:
      args = mono_unicode_to_external (cmdline);
      if (args == 0B) goto <D.11604>; else goto <D.11605>;
      <D.11604>:
      SetLastError (3);
      goto free_strings;
      <D.11605>:
      <D.11603>:
      if (cwd != 0B) goto <D.11606>; else goto <D.11607>;
      <D.11606>:
      dir = mono_unicode_to_external (cwd);
      if (dir == 0B) goto <D.11608>; else goto <D.11609>;
      <D.11608>:
      SetLastError (3);
      goto free_strings;
      <D.11609>:
      switchDirectorySeparators (dir);
      <D.11607>:
      if (cmd != 0B) goto <D.11610>; else goto <D.11611>;
      <D.11610>:
      {
        gchar * unquoted;

        D.11612 = __ctype_b_loc ();
        D.11613 = *D.11612;
        D.11614 = *cmd;
        D.11615 = (unsigned int) D.11614;
        D.11616 = D.11615 * 2;
        D.11617 = D.11613 + D.11616;
        D.11618 = *D.11617;
        D.11619 = (int) D.11618;
        D.11620 = D.11619 & 1024;
        if (D.11620 != 0) goto <D.11621>; else goto <D.11622>;
        <D.11621>:
        D.11623 = cmd + 1;
        D.11624 = *D.11623;
        if (D.11624 == 58) goto <D.11625>; else goto <D.11626>;
        <D.11625>:
        D.11627 = cmd + 2;
        D.11628 = strlen (cmd);
        D.11629 = D.11628 + 4294967294;
        memmove (cmd, D.11627, D.11629);
        D.11630 = strlen (cmd);
        D.11631 = D.11630 + 4294967294;
        D.11632 = cmd + D.11631;
        *D.11632 = 0;
        <D.11626>:
        <D.11622>:
        unquoted = monoeg_g_shell_unquote (cmd, 0B);
        D.11633 = *unquoted;
        if (D.11633 == 47) goto <D.11634>; else goto <D.11635>;
        <D.11634>:
        prog = monoeg_strdup (unquoted);
        D.11636 = is_executable (prog);
        if (D.11636 == 0) goto <D.11637>; else goto <D.11638>;
        <D.11637>:
        monoeg_g_free (unquoted);
        SetLastError (2);
        goto free_strings;
        <D.11638>:
        goto <D.11639>;
        <D.11635>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, unquoted);
          monoeg_g_free (curdir);
          D.11640 = is_executable (prog);
          if (D.11640 == 0) goto <D.11641>; else goto <D.11642>;
          <D.11641>:
          monoeg_g_free (unquoted);
          SetLastError (2);
          goto free_strings;
          <D.11642>:
        }
        <D.11639>:
        monoeg_g_free (unquoted);
        args_after_prog = args;
      }
      goto <D.11643>;
      <D.11611>:
      {
        gchar * token;
        char quote;

        token = 0B;
        args = monoeg_g_strchug (args);
        args_after_prog = args;
        D.11646 = *args;
        if (D.11646 == 34) goto <D.11644>; else goto <D.11647>;
        <D.11647>:
        D.11646 = *args;
        if (D.11646 == 39) goto <D.11644>; else goto <D.11645>;
        <D.11644>:
        quote = *args;
        i = 1;
        goto <D.10842>;
        <D.10841>:
        i = i + 1;
        <D.10842>:
        D.11648 = args + i;
        D.11649 = *D.11648;
        if (D.11649 != 0) goto <D.11650>; else goto <D.10843>;
        <D.11650>:
        D.11648 = args + i;
        D.11649 = *D.11648;
        if (D.11649 != quote) goto <D.10841>; else goto <D.10843>;
        <D.10843>:
        D.11653 = i + 1;
        D.11654 = args + D.11653;
        D.11655 = *D.11654;
        if (D.11655 == 0) goto <D.11651>; else goto <D.11656>;
        <D.11656>:
        D.11612 = __ctype_b_loc ();
        D.11613 = *D.11612;
        D.11653 = i + 1;
        D.11654 = args + D.11653;
        D.11655 = *D.11654;
        D.11657 = (unsigned int) D.11655;
        D.11658 = D.11657 * 2;
        D.11659 = D.11613 + D.11658;
        D.11660 = *D.11659;
        D.11661 = (int) D.11660;
        D.11662 = D.11661 & 8192;
        if (D.11662 != 0) goto <D.11651>; else goto <D.11652>;
        <D.11651>:
        D.11663 = args + 1;
        D.11664 = i + 4294967295;
        token = monoeg_g_strndup (D.11663, D.11664);
        D.11653 = i + 1;
        D.11654 = args + D.11653;
        args_after_prog = monoeg_g_strchug (D.11654);
        <D.11652>:
        <D.11645>:
        if (token == 0B) goto <D.11665>; else goto <D.11666>;
        <D.11665>:
        i = 0;
        goto <D.10846>;
        <D.10845>:
        D.11612 = __ctype_b_loc ();
        D.11613 = *D.11612;
        D.11648 = args + i;
        D.11649 = *D.11648;
        D.11667 = (unsigned int) D.11649;
        D.11668 = D.11667 * 2;
        D.11669 = D.11613 + D.11668;
        D.11670 = *D.11669;
        D.11671 = (int) D.11670;
        D.11672 = D.11671 & 8192;
        if (D.11672 != 0) goto <D.11673>; else goto <D.11674>;
        <D.11673>:
        token = monoeg_g_strndup (args, i);
        D.11653 = i + 1;
        args_after_prog = args + D.11653;
        goto <D.10844>;
        <D.11674>:
        i = i + 1;
        <D.10846>:
        D.11648 = args + i;
        D.11649 = *D.11648;
        if (D.11649 != 0) goto <D.10845>; else goto <D.10844>;
        <D.10844>:
        <D.11666>:
        if (token == 0B) goto <D.11675>; else goto <D.11676>;
        <D.11675>:
        D.11646 = *args;
        if (D.11646 != 0) goto <D.11677>; else goto <D.11678>;
        <D.11677>:
        token = monoeg_strdup (args);
        args_after_prog = 0B;
        <D.11678>:
        <D.11676>:
        if (token == 0B) goto <D.11679>; else goto <D.11680>;
        <D.11679>:
        SetLastError (3);
        goto free_strings;
        <D.11680>:
        switchDirectorySeparators (token);
        D.11612 = __ctype_b_loc ();
        D.11613 = *D.11612;
        D.11681 = *token;
        D.11682 = (unsigned int) D.11681;
        D.11683 = D.11682 * 2;
        D.11684 = D.11613 + D.11683;
        D.11685 = *D.11684;
        D.11686 = (int) D.11685;
        D.11687 = D.11686 & 1024;
        if (D.11687 != 0) goto <D.11688>; else goto <D.11689>;
        <D.11688>:
        D.11690 = token + 1;
        D.11691 = *D.11690;
        if (D.11691 == 58) goto <D.11692>; else goto <D.11693>;
        <D.11692>:
        D.11694 = token + 2;
        D.11695 = strlen (token);
        D.11696 = D.11695 + 4294967294;
        memmove (token, D.11694, D.11696);
        D.11697 = strlen (token);
        D.11698 = D.11697 + 4294967294;
        D.11699 = token + D.11698;
        *D.11699 = 0;
        <D.11693>:
        <D.11689>:
        D.11681 = *token;
        if (D.11681 == 47) goto <D.11700>; else goto <D.11701>;
        <D.11700>:
        prog = monoeg_strdup (token);
        D.11702 = is_executable (prog);
        if (D.11702 == 0) goto <D.11703>; else goto <D.11704>;
        <D.11703>:
        monoeg_g_free (token);
        SetLastError (2);
        goto free_strings;
        <D.11704>:
        goto <D.11705>;
        <D.11701>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, token);
          monoeg_g_free (curdir);
          D.11706 = is_executable (prog);
          if (D.11706 == 0) goto <D.11707>; else goto <D.11708>;
          <D.11707>:
          monoeg_g_free (prog);
          prog = monoeg_g_find_program_in_path (token);
          if (prog == 0B) goto <D.11709>; else goto <D.11710>;
          <D.11709>:
          monoeg_g_free (token);
          SetLastError (2);
          goto free_strings;
          <D.11710>:
          <D.11708>:
        }
        <D.11705>:
        monoeg_g_free (token);
      }
      <D.11643>:
      D.11711 = is_managed_binary (prog);
      if (D.11711 != 0) goto <D.11712>; else goto <D.11713>;
      <D.11712>:
      {
        gunichar2 * newapp;
        gunichar2 * newcmd;
        gsize bytes_ignored;

        try
          {
            newapp = mono_unicode_from_external ("mono", &bytes_ignored);
            if (newapp != 0B) goto <D.11714>; else goto <D.11715>;
            <D.11714>:
            if (appname != 0B) goto <D.11716>; else goto <D.11717>;
            <D.11716>:
            utf16_space.36 = utf16_space;
            utf16_space.36 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.36, appname, utf16_space.36, cmdline, 0B);
            goto <D.11719>;
            <D.11717>:
            utf16_space.36 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.36, cmdline, 0B);
            <D.11719>:
            monoeg_g_free (newapp);
            if (newcmd != 0B) goto <D.11720>; else goto <D.11721>;
            <D.11720>:
            ret = CreateProcess (0B, newcmd, process_attrs, thread_attrs, inherit_handles, create_flags, new_environ, cwd, startup, process_info);
            monoeg_g_free (newcmd);
            goto free_strings;
            <D.11721>:
            <D.11715>:
          }
        finally
          {
            bytes_ignored = {CLOBBER};
          }
      }
      <D.11713>:
      if (args_after_prog != 0B) goto <D.11724>; else goto <D.11722>;
      <D.11724>:
      D.11725 = *args_after_prog;
      if (D.11725 != 0) goto <D.11726>; else goto <D.11722>;
      <D.11726>:
      {
        gchar * qprog;

        qprog = monoeg_g_shell_quote (prog);
        full_prog = monoeg_g_strconcat (qprog, " ", args_after_prog, 0B);
        monoeg_g_free (qprog);
      }
      goto <D.11723>;
      <D.11722>:
      full_prog = monoeg_g_shell_quote (prog);
      <D.11723>:
      ret = monoeg_g_shell_parse_argv (full_prog, 0B, &argv, &gerr);
      if (ret == 0) goto <D.11727>; else goto <D.11728>;
      <D.11727>:
      gerr.37 = gerr;
      D.11730 = gerr.37->message;
      monoeg_g_log (0B, 32, "CreateProcess: %s\n", D.11730);
      gerr.37 = gerr;
      monoeg_g_error_free (gerr.37);
      gerr = 0B;
      goto free_strings;
      <D.11728>:
      if (startup != 0B) goto <D.11733>; else goto <D.11731>;
      <D.11733>:
      D.11734 = startup->dwFlags;
      D.11735 = D.11734 & 256;
      if (D.11735 != 0) goto <D.11736>; else goto <D.11731>;
      <D.11736>:
      D.11737 = startup->hStdInput;
      in_fd = (int) D.11737;
      D.11738 = startup->hStdOutput;
      out_fd = (int) D.11738;
      D.11739 = startup->hStdError;
      err_fd = (int) D.11739;
      goto <D.11732>;
      <D.11731>:
      D.11740 = GetStdHandle (-10);
      in_fd = (int) D.11740;
      D.11741 = GetStdHandle (-11);
      out_fd = (int) D.11741;
      D.11742 = GetStdHandle (-12);
      err_fd = (int) D.11742;
      <D.11732>:
      monoeg_g_strlcpy (&process_handle.proc_name, prog, 255);
      process_set_defaults (&process_handle);
      handle = _wapi_handle_new (9, &process_handle);
      if (handle == 4294967295B) goto <D.11743>; else goto <D.11744>;
      <D.11743>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      ret = 0;
      SetLastError (14);
      goto free_strings;
      <D.11744>:
      if (new_environ != 0B) goto <D.11745>; else goto <D.11746>;
      <D.11745>:
      {
        gunichar2 * new_environp;

        new_environp = new_environ;
        goto <D.10858>;
        <D.10857>:
        env_count = env_count + 1;
        goto <D.10855>;
        <D.10854>:
        new_environp = new_environp + 2;
        <D.10855>:
        D.11747 = *new_environp;
        if (D.11747 != 0) goto <D.10854>; else goto <D.10856>;
        <D.10856>:
        new_environp = new_environp + 2;
        <D.10858>:
        D.11747 = *new_environp;
        if (D.11747 != 0) goto <D.10857>; else goto <D.10859>;
        <D.10859>:
        D.11748 = env_count + 2;
        D.11749 = D.11748 * 4;
        env_strings = monoeg_malloc0 (D.11749);
        env_count = 0;
        new_environp = new_environ;
        goto <D.10864>;
        <D.10863>:
        D.11750 = env_count * 4;
        D.11751 = env_strings + D.11750;
        D.11752 = mono_unicode_to_external (new_environp);
        *D.11751 = D.11752;
        env_count = env_count + 1;
        goto <D.10861>;
        <D.10860>:
        new_environp = new_environp + 2;
        <D.10861>:
        D.11747 = *new_environp;
        if (D.11747 != 0) goto <D.10860>; else goto <D.10862>;
        <D.10862>:
        new_environp = new_environp + 2;
        <D.10864>:
        D.11747 = *new_environp;
        if (D.11747 != 0) goto <D.10863>; else goto <D.10865>;
        <D.10865>:
      }
      goto <D.11753>;
      <D.11746>:
      i = 0;
      goto <D.10867>;
      <D.10866>:
      env_count = env_count + 1;
      i = i + 1;
      <D.10867>:
      environ.38 = environ;
      D.11755 = i * 4;
      D.11756 = environ.38 + D.11755;
      D.11757 = *D.11756;
      if (D.11757 != 0B) goto <D.10866>; else goto <D.10868>;
      <D.10868>:
      D.11748 = env_count + 2;
      D.11749 = D.11748 * 4;
      env_strings = monoeg_malloc0 (D.11749);
      env_count = 0;
      i = 0;
      goto <D.10870>;
      <D.10869>:
      D.11750 = env_count * 4;
      D.11751 = env_strings + D.11750;
      environ.38 = environ;
      D.11755 = i * 4;
      D.11756 = environ.38 + D.11755;
      D.11757 = *D.11756;
      D.11758 = monoeg_strdup (D.11757);
      *D.11751 = D.11758;
      env_count = env_count + 1;
      i = i + 1;
      <D.10870>:
      environ.38 = environ;
      D.11755 = i * 4;
      D.11756 = environ.38 + D.11755;
      D.11757 = *D.11756;
      if (D.11757 != 0B) goto <D.10869>; else goto <D.10871>;
      <D.10871>:
      <D.11753>:
      if (env_strings != 0B) goto <D.11759>; else goto <D.11760>;
      <D.11759>:
      {
        struct _WapiHandleUnshared * handle_data;
        struct _WapiHandle_shared_ref * ref;

        handle.39 = (unsigned int) handle;
        D.11762 = handle.39 / 256;
        D.11763 = _wapi_private_handles[D.11762];
        handle.39 = (unsigned int) handle;
        D.11764 = handle.39 & 255;
        D.11765 = D.11764 * 144;
        handle_data = D.11763 + D.11765;
        ref = &handle_data->u.shared;
        D.11750 = env_count * 4;
        D.11751 = env_strings + D.11750;
        D.11766 = ref->offset;
        D.11767 = monoeg_g_strdup_printf ("_WAPI_PROCESS_HANDLE_OFFSET=%d", D.11766);
        *D.11751 = D.11767;
      }
      <D.11760>:
      D.11768 = pipe (&startup_pipe);
      if (D.11768 == -1) goto <D.11769>; else goto <D.11770>;
      <D.11769>:
      startup_pipe[1] = -1;
      D.11771 = startup_pipe[1];
      startup_pipe[0] = D.11771;
      <D.11770>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.11772 = thr_ret != 0;
      D.11773 = (long int) D.11772;
      D.11774 = __builtin_expect (D.11773, 0);
      if (D.11774 != 0) goto <D.11775>; else goto <D.11776>;
      <D.11775>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 965, "thr_ret == 0");
      <D.11776>:
      pid = fork ();
      if (pid == -1) goto <D.11777>; else goto <D.11778>;
      <D.11777>:
      SetLastError (14);
      ret = 0;
      fork_failed = 1;
      goto cleanup;
      <D.11778>:
      if (pid == 0) goto <D.11779>; else goto <D.11780>;
      <D.11779>:
      D.11781 = startup_pipe[0];
      if (D.11781 != -1) goto <D.11782>; else goto <D.11783>;
      <D.11782>:
      {
        ssize_t _i;

        D.11781 = startup_pipe[0];
        _i = read (D.11781, &dummy, 1);
        D.11781 = startup_pipe[0];
        close (D.11781);
        D.11771 = startup_pipe[1];
        close (D.11771);
      }
      <D.11783>:
      dup2 (in_fd, 0);
      dup2 (out_fd, 1);
      dup2 (err_fd, 2);
      if (inherit_handles != 1) goto <D.11784>; else goto <D.11785>;
      <D.11784>:
      <D.11785>:
      D.11786 = getdtablesize ();
      D.11787 = D.11786 + -1;
      i = (guint32) D.11787;
      goto <D.10877>;
      <D.10876>:
      i.40 = (int) i;
      close (i.40);
      i = i + 4294967295;
      <D.10877>:
      if (i > 2) goto <D.10876>; else goto <D.10878>;
      <D.10878>:
      if (dir != 0B) goto <D.11789>; else goto <D.11790>;
      <D.11789>:
      D.11791 = chdir (dir);
      if (D.11791 == -1) goto <D.11792>; else goto <D.11793>;
      <D.11792>:
      _exit (-1);
      <D.11793>:
      <D.11790>:
      argv.41 = argv;
      D.11795 = *argv.41;
      argv.41 = argv;
      execve (D.11795, argv.41, env_strings);
      _exit (-1);
      <D.11780>:
      ret = _wapi_lookup_handle (handle, 9, &process_handle_data);
      if (ret == 0) goto <D.11796>; else goto <D.11797>;
      <D.11796>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      _wapi_handle_unref (handle);
      goto cleanup;
      <D.11797>:
      process_handle_data.42 = process_handle_data;
      process_handle_data.42->id = pid;
      mono_process = monoeg_malloc0 (36);
      mono_process->pid = pid;
      mono_process->handle_count = 1;
      D.11799 = &mono_process->exit_sem;
      D.11800 = sem_init (D.11799, 0, 0);
      if (D.11800 != 0) goto <D.11801>; else goto <D.11802>;
      <D.11801>:
      D.11803 = __errno_location ();
      D.11804 = *D.11803;
      D.11805 = strerror (D.11804);
      monoeg_g_log (0B, 16, "%s: could not create exit semaphore for process.", D.11805);
      monoeg_g_free (mono_process);
      goto <D.11806>;
      <D.11802>:
      _wapi_handle_ref (handle);
      mono_process->handle = handle;
      process_handle_data.42 = process_handle_data;
      D.11807 = _wapi_getpid ();
      process_handle_data.42->self = D.11807;
      process_handle_data.42 = process_handle_data;
      process_handle_data.42->mono_process = mono_process;
      pthread_mutex_lock (&mono_processes_mutex);
      mono_processes.43 = mono_processes;
      mono_process->next = mono_processes.43;
      mono_processes = mono_process;
      pthread_mutex_unlock (&mono_processes_mutex);
      <D.11806>:
      if (process_info != 0B) goto <D.11809>; else goto <D.11810>;
      <D.11809>:
      process_info->hProcess = handle;
      pid.44 = (unsigned int) pid;
      process_info->dwProcessId = pid.44;
      process_info->hThread = 4294967295B;
      process_info->dwThreadId = 0;
      <D.11810>:
      cleanup:
      _wapi_handle_unlock_shared_handles ();
      if (fork_failed != 0) goto <D.11812>; else goto <D.11813>;
      <D.11812>:
      _wapi_handle_unref (handle);
      <D.11813>:
      D.11771 = startup_pipe[1];
      if (D.11771 != -1) goto <D.11814>; else goto <D.11815>;
      <D.11814>:
      {
        ssize_t _i;

        D.11771 = startup_pipe[1];
        _i = write (D.11771, &startup_pipe, 1);
        D.11781 = startup_pipe[0];
        close (D.11781);
        D.11771 = startup_pipe[1];
        close (D.11771);
      }
      <D.11815>:
      free_strings:
      if (cmd != 0B) goto <D.11816>; else goto <D.11817>;
      <D.11816>:
      monoeg_g_free (cmd);
      <D.11817>:
      if (full_prog != 0B) goto <D.11818>; else goto <D.11819>;
      <D.11818>:
      monoeg_g_free (full_prog);
      <D.11819>:
      if (prog != 0B) goto <D.11820>; else goto <D.11821>;
      <D.11820>:
      monoeg_g_free (prog);
      <D.11821>:
      if (args != 0B) goto <D.11822>; else goto <D.11823>;
      <D.11822>:
      monoeg_g_free (args);
      <D.11823>:
      if (dir != 0B) goto <D.11824>; else goto <D.11825>;
      <D.11824>:
      monoeg_g_free (dir);
      <D.11825>:
      if (env_strings != 0B) goto <D.11826>; else goto <D.11827>;
      <D.11826>:
      monoeg_g_strfreev (env_strings);
      <D.11827>:
      argv.41 = argv;
      if (argv.41 != 0B) goto <D.11828>; else goto <D.11829>;
      <D.11828>:
      argv.41 = argv;
      monoeg_g_strfreev (argv.41);
      <D.11829>:
      mono_processes_cleanup ();
      D.11830 = ret;
      return D.11830;
    }
  finally
    {
      argv = {CLOBBER};
      process_handle = {CLOBBER};
      process_handle_data = {CLOBBER};
      gerr = {CLOBBER};
      startup_pipe = {CLOBBER};
      dummy = {CLOBBER};
    }
}


process_add_sigchld_handler ()
{
  int D.11835;
  _Bool D.11836;
  long int D.11837;
  long int D.11838;
  struct sigaction sa;

  try
    {
      sa.__sigaction_handler.sa_sigaction = mono_sigchld_signal_handler;
      sigemptyset (&sa.sa_mask);
      sa.sa_flags = 9;
      D.11835 = sigaction (18, &sa, &previous_chld_sa);
      D.11836 = D.11835 == -1;
      D.11837 = (long int) D.11836;
      D.11838 = __builtin_expect (D.11837, 0);
      if (D.11838 != 0) goto <D.11839>; else goto <D.11840>;
      <D.11839>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 2887, "sigaction (SIGCHLD, &sa, &previous_chld_sa) != -1");
      <D.11840>:
    }
  finally
    {
      sa = {CLOBBER};
    }
}


mono_sigchld_signal_handler (int _dummy, struct siginfo_t * info, void * context)
{
  int * D.11842;
  int D.11843;
  int D.11845;
  int status.45;
  union MonoSemType * D.11849;
  int status;
  int pid;
  struct MonoProcess * p;

  try
    {
      InterlockedIncrement (&mono_processes_read_lock);
      <D.11276>:
      <D.11270>:
      pid = waitpid (-1, &status, 1);
      if (pid == -1) goto <D.11841>; else goto <D.11271>;
      <D.11841>:
      D.11842 = __errno_location ();
      D.11843 = *D.11842;
      if (D.11843 == 4) goto <D.11270>; else goto <D.11271>;
      <D.11271>:
      if (pid <= 0) goto <D.11272>; else goto <D.11844>;
      <D.11844>:
      p = mono_processes;
      goto <D.11275>;
      <D.11274>:
      D.11845 = p->pid;
      if (D.11845 == pid) goto <D.11846>; else goto <D.11847>;
      <D.11846>:
      p->pid = 0;
      status.45 = status;
      p->status = status.45;
      D.11849 = &p->exit_sem;
      mono_sem_post (D.11849);
      goto <D.11273>;
      <D.11847>:
      p = p->next;
      <D.11275>:
      if (p != 0B) goto <D.11274>; else goto <D.11273>;
      <D.11273>:
      goto <D.11276>;
      <D.11272>:
      InterlockedDecrement (&mono_processes_read_lock);
    }
  finally
    {
      status = {CLOBBER};
    }
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.11850;
  unsigned int D.11851;

  D.11851 = __sync_add_and_fetch_4 (val, 1);
  D.11850 = (gint32) D.11851;
  return D.11850;
}


process_ops_init ()
{
  _wapi_handle_register_capabilities (9, 9);
}


switchDirectorySeparators (gchar * path)
{
  gchar * D.11853;
  char D.11854;
  unsigned int D.11857;
  sizetype D.11860;
  gchar * D.11861;
  char D.11862;
  size_t i;
  size_t pathLength;

  pathLength = strlen (path);
  i = 0;
  goto <D.10798>;
  <D.10797>:
  D.11853 = path + i;
  D.11854 = *D.11853;
  if (D.11854 == 92) goto <D.11855>; else goto <D.11856>;
  <D.11855>:
  D.11857 = pathLength + 4294967295;
  if (D.11857 > i) goto <D.11858>; else goto <D.11859>;
  <D.11858>:
  D.11860 = i + 1;
  D.11861 = path + D.11860;
  D.11862 = *D.11861;
  if (D.11862 != 39) goto <D.11863>; else goto <D.11864>;
  <D.11863>:
  D.11853 = path + i;
  *D.11853 = 47;
  <D.11864>:
  <D.11859>:
  <D.11856>:
  i = i + 1;
  <D.10798>:
  if (i < pathLength) goto <D.10797>; else goto <D.10799>;
  <D.10799>:
}


memmove (void * __dest, const void * __src, size_t __len)
{
  void * D.11865;
  unsigned int D.11866;

  D.11866 = __builtin_object_size (__dest, 0);
  D.11865 = __builtin___memmove_chk (__dest, __src, __len, D.11866);
  return D.11865;
}


is_executable (const char * prog)
{
  int D.11868;
  gboolean D.11871;
  int D.11872;
  unsigned int D.11875;
  unsigned int D.11876;
  struct stat buf;

  try
    {
      D.11868 = access (prog, 1);
      if (D.11868 != 0) goto <D.11869>; else goto <D.11870>;
      <D.11869>:
      D.11871 = 0;
      return D.11871;
      <D.11870>:
      D.11872 = stat (prog, &buf);
      if (D.11872 != 0) goto <D.11873>; else goto <D.11874>;
      <D.11873>:
      D.11871 = 0;
      return D.11871;
      <D.11874>:
      D.11875 = buf.st_mode;
      D.11876 = D.11875 & 61440;
      if (D.11876 == 32768) goto <D.11877>; else goto <D.11878>;
      <D.11877>:
      D.11871 = 1;
      return D.11871;
      <D.11878>:
      D.11871 = 0;
      return D.11871;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


stat (const char * __path, struct stat * __statbuf)
{
  int D.11881;

  D.11881 = __xstat (3, __path, __statbuf);
  return D.11881;
}


is_managed_binary (const gchar * filename)
{
  int * D.11883;
  gboolean D.11886;
  unsigned char D.11889;
  unsigned char D.11891;
  int D.11895;
  int D.11896;
  int D.11897;
  int D.11898;
  unsigned char D.11899;
  int D.11900;
  int D.11901;
  int D.11902;
  unsigned char D.11903;
  int D.11904;
  int D.11905;
  int D.11906;
  long long int D.11907;
  long long int D.11915;
  long long int D.11919;
  unsigned char * D.11921;
  unsigned char * D.11922;
  int original_errno;
  int file;
  off_t new_offset;
  unsigned char buffer[8];
  off_t file_size;
  off_t optional_header_offset;
  off_t pe_header_offset;
  gboolean managed;
  int num_read;
  guint32 first_word;
  guint32 second_word;
  void leave = <<< error >>>;

  try
    {
      D.11883 = __errno_location ();
      original_errno = *D.11883;
      file = open (filename, 8192);
      managed = 0;
      if (file < 0) goto <D.11884>; else goto <D.11885>;
      <D.11884>:
      D.11883 = __errno_location ();
      *D.11883 = original_errno;
      D.11886 = 0;
      return D.11886;
      <D.11885>:
      file_size = lseek (file, 0, 2);
      lseek (file, 0, 0);
      if (file_size <= 63) goto leave; else goto <D.11887>;
      <D.11887>:
      num_read = read (file, &buffer, 2);
      if (num_read != 2) goto leave; else goto <D.11888>;
      <D.11888>:
      D.11889 = buffer[0];
      if (D.11889 != 77) goto leave; else goto <D.11890>;
      <D.11890>:
      D.11891 = buffer[1];
      if (D.11891 != 90) goto leave; else goto <D.11892>;
      <D.11892>:
      new_offset = lseek (file, 60, 0);
      if (new_offset != 60) goto leave; else goto <D.11893>;
      <D.11893>:
      num_read = read (file, &buffer, 4);
      if (num_read != 4) goto leave; else goto <D.11894>;
      <D.11894>:
      D.11889 = buffer[0];
      D.11895 = (int) D.11889;
      D.11891 = buffer[1];
      D.11896 = (int) D.11891;
      D.11897 = D.11896 << 8;
      D.11898 = D.11895 | D.11897;
      D.11899 = buffer[2];
      D.11900 = (int) D.11899;
      D.11901 = D.11900 << 16;
      D.11902 = D.11898 | D.11901;
      D.11903 = buffer[3];
      D.11904 = (int) D.11903;
      D.11905 = D.11904 << 24;
      D.11906 = D.11902 | D.11905;
      pe_header_offset = (off_t) D.11906;
      D.11907 = pe_header_offset + 23;
      if (D.11907 >= file_size) goto leave; else goto <D.11908>;
      <D.11908>:
      new_offset = lseek (file, pe_header_offset, 0);
      if (new_offset != pe_header_offset) goto leave; else goto <D.11909>;
      <D.11909>:
      num_read = read (file, &buffer, 4);
      if (num_read != 4) goto leave; else goto <D.11910>;
      <D.11910>:
      D.11889 = buffer[0];
      if (D.11889 != 80) goto leave; else goto <D.11911>;
      <D.11911>:
      D.11891 = buffer[1];
      if (D.11891 != 69) goto leave; else goto <D.11912>;
      <D.11912>:
      D.11899 = buffer[2];
      if (D.11899 != 0) goto leave; else goto <D.11913>;
      <D.11913>:
      D.11903 = buffer[3];
      if (D.11903 != 0) goto leave; else goto <D.11914>;
      <D.11914>:
      D.11915 = pe_header_offset + 20;
      new_offset = lseek (file, D.11915, 0);
      D.11915 = pe_header_offset + 20;
      if (D.11915 != new_offset) goto leave; else goto <D.11916>;
      <D.11916>:
      num_read = read (file, &buffer, 2);
      if (num_read != 2) goto leave; else goto <D.11917>;
      <D.11917>:
      D.11889 = buffer[0];
      D.11895 = (int) D.11889;
      D.11891 = buffer[1];
      D.11896 = (int) D.11891;
      D.11897 = D.11896 << 8;
      D.11898 = D.11895 | D.11897;
      if (D.11898 <= 215) goto leave; else goto <D.11918>;
      <D.11918>:
      optional_header_offset = pe_header_offset + 24;
      D.11919 = optional_header_offset + 208;
      new_offset = lseek (file, D.11919, 0);
      D.11919 = optional_header_offset + 208;
      if (D.11919 != new_offset) goto leave; else goto <D.11920>;
      <D.11920>:
      num_read = read (file, &buffer, 8);
      D.11921 = &buffer[0];
      first_word = MEM[(guint32 *)D.11921];
      D.11922 = &buffer[4];
      second_word = MEM[(guint32 *)D.11922];
      if (num_read != 8) goto leave; else goto <D.11923>;
      <D.11923>:
      if (first_word == 0) goto leave; else goto <D.11924>;
      <D.11924>:
      if (second_word == 0) goto leave; else goto <D.11925>;
      <D.11925>:
      managed = 1;
      leave:
      close (file);
      D.11883 = __errno_location ();
      *D.11883 = original_errno;
      D.11886 = managed;
      return D.11886;
    }
  finally
    {
      buffer = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.11928;
  int D.11931;
  int D.11936;
  int D.11938;
  int D.11939;
  int D.11942;
  int D.11943;

  D.11928 = __builtin_va_arg_pack_len ();
  if (D.11928 > 1) goto <D.11929>; else goto <D.11930>;
  <D.11929>:
  __open_too_many_args ();
  <D.11930>:
  D.11931 = __builtin_constant_p (__oflag);
  if (D.11931 != 0) goto <D.11932>; else goto <D.11933>;
  <D.11932>:
  D.11936 = __oflag & 256;
  if (D.11936 != 0) goto <D.11934>; else goto <D.11937>;
  <D.11937>:
  D.11938 = __oflag & 4259840;
  if (D.11938 == 4259840) goto <D.11934>; else goto <D.11935>;
  <D.11934>:
  D.11939 = __builtin_va_arg_pack_len ();
  if (D.11939 <= 0) goto <D.11940>; else goto <D.11941>;
  <D.11940>:
  __open_missing_mode ();
  D.11942 = __open_2 (__path, __oflag);
  return D.11942;
  <D.11941>:
  <D.11935>:
  D.11942 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.11942;
  <D.11933>:
  D.11943 = __builtin_va_arg_pack_len ();
  if (D.11943 <= 0) goto <D.11944>; else goto <D.11945>;
  <D.11944>:
  D.11942 = __open_2 (__path, __oflag);
  return D.11942;
  <D.11945>:
  D.11942 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.11942;
}


process_set_defaults (struct _WapiHandle_process * process_handle)
{
  long int D.11947;
  struct WapiFileTime * D.11948;

  process_handle->min_working_set = 204800;
  process_handle->max_working_set = 1413120;
  D.11947 = time (0B);
  D.11948 = &process_handle->create_time;
  _wapi_time_t_to_filetime (D.11947, D.11948);
}


monoeg_strdup (const gchar * str)
{
  gchar * D.11951;

  if (str != 0B) goto <D.11949>; else goto <D.11950>;
  <D.11949>:
  D.11951 = __strdup (str);
  return D.11951;
  <D.11950>:
  D.11951 = 0B;
  return D.11951;
}


read (int __fd, void * __buf, size_t __nbytes)
{
  unsigned int D.11953;
  int D.11956;
  ssize_t D.11959;
  unsigned int D.11960;
  unsigned int D.11961;
  unsigned int D.11964;

  D.11953 = __builtin_object_size (__buf, 0);
  if (D.11953 != 4294967295) goto <D.11954>; else goto <D.11955>;
  <D.11954>:
  D.11956 = __builtin_constant_p (__nbytes);
  if (D.11956 == 0) goto <D.11957>; else goto <D.11958>;
  <D.11957>:
  D.11960 = __builtin_object_size (__buf, 0);
  D.11959 = __read_chk (__fd, __buf, __nbytes, D.11960);
  return D.11959;
  <D.11958>:
  D.11961 = __builtin_object_size (__buf, 0);
  if (D.11961 < __nbytes) goto <D.11962>; else goto <D.11963>;
  <D.11962>:
  D.11964 = __builtin_object_size (__buf, 0);
  D.11959 = __read_chk_warn (__fd, __buf, __nbytes, D.11964);
  return D.11959;
  <D.11963>:
  <D.11955>:
  D.11959 = __read_alias (__fd, __buf, __nbytes);
  return D.11959;
}


_wapi_process_duplicate ()
{
  void * current_process.46;
  void * D.11967;

  mono_once (&process_current_once, process_set_current);
  current_process.46 = current_process;
  _wapi_handle_ref (current_process.46);
  D.11967 = current_process;
  return D.11967;
}


process_set_current ()
{
  int D.11971;
  unsigned int D.11972;
  void * current_process.47;
  void * current_process.48;
  struct _WapiHandle_process * process_handlep.49;
  int D.11978;
  int D.10906;
  int iftmp.50;
  int D.10905;
  const char[5] * D.11984;
  unsigned char D.11985;
  int D.11986;
  unsigned char D.11987;
  int D.11988;
  const unsigned char * D.11993;
  unsigned char D.11994;
  int D.11995;
  const unsigned char * D.11996;
  unsigned char D.11997;
  int D.11998;
  const unsigned char * D.12003;
  unsigned char D.12004;
  int D.12005;
  const unsigned char * D.12006;
  unsigned char D.12007;
  int D.12008;
  const unsigned char * D.12013;
  unsigned char D.12014;
  int D.12015;
  const unsigned char * D.12016;
  unsigned char D.12017;
  int D.12018;
  void * current_process.51;
  pid_t pid;
  const char * handle_env;
  struct _WapiHandle_process process_handle;
  static const char __func__[20] = "process_set_current";

  try
    {
      pid = _wapi_getpid ();
      process_handle = {};
      mono_once (&process_ops_once, process_ops_init);
      handle_env = monoeg_g_getenv ("_WAPI_PROCESS_HANDLE_OFFSET");
      monoeg_g_unsetenv ("_WAPI_PROCESS_HANDLE_OFFSET");
      if (handle_env != 0B) goto <D.11969>; else goto <D.11970>;
      <D.11969>:
      {
        struct _WapiHandle_process * process_handlep;
        gchar * procname;
        gboolean ok;

        try
          {
            procname = 0B;
            D.11971 = atoi (handle_env);
            D.11972 = (unsigned int) D.11971;
            current_process.47 = _wapi_handle_new_from_offset (9, D.11972, 1);
            current_process = current_process.47;
            current_process.48 = current_process;
            ok = _wapi_lookup_handle (current_process.48, 9, &process_handlep);
            if (ok != 0) goto <D.11975>; else goto <D.11976>;
            <D.11975>:
            process_handlep.49 = process_handlep;
            D.11978 = process_handlep.49->id;
            if (D.11978 == pid) goto <D.11979>; else goto <D.11980>;
            <D.11979>:
            process_handlep.49 = process_handlep;
            procname = &process_handlep.49->proc_name;
            {
              size_t __s1_len;
              size_t __s2_len;

              __s2_len = 4;
              if (__s2_len <= 3) goto <D.11982>; else goto <D.11983>;
              <D.11982>:
              {
                const unsigned char * __s2;
                int __result;

                __s2 = procname;
                D.11984 = "mono";
                D.11985 = MEM[(const unsigned char *)D.11984];
                D.11986 = (int) D.11985;
                D.11987 = *__s2;
                D.11988 = (int) D.11987;
                __result = D.11986 - D.11988;
                {
                  if (__s2_len != 0) goto <D.11989>; else goto <D.11990>;
                  <D.11989>:
                  if (__result == 0) goto <D.11991>; else goto <D.11992>;
                  <D.11991>:
                  D.11993 = &MEM[(void *)"mono" + 1B];
                  D.11994 = *D.11993;
                  D.11995 = (int) D.11994;
                  D.11996 = __s2 + 1;
                  D.11997 = *D.11996;
                  D.11998 = (int) D.11997;
                  __result = D.11995 - D.11998;
                  if (__s2_len > 1) goto <D.11999>; else goto <D.12000>;
                  <D.11999>:
                  if (__result == 0) goto <D.12001>; else goto <D.12002>;
                  <D.12001>:
                  D.12003 = &MEM[(void *)"mono" + 2B];
                  D.12004 = *D.12003;
                  D.12005 = (int) D.12004;
                  D.12006 = __s2 + 2;
                  D.12007 = *D.12006;
                  D.12008 = (int) D.12007;
                  __result = D.12005 - D.12008;
                  if (__s2_len > 2) goto <D.12009>; else goto <D.12010>;
                  <D.12009>:
                  if (__result == 0) goto <D.12011>; else goto <D.12012>;
                  <D.12011>:
                  D.12013 = &MEM[(void *)"mono" + 3B];
                  D.12014 = *D.12013;
                  D.12015 = (int) D.12014;
                  D.12016 = __s2 + 3;
                  D.12017 = *D.12016;
                  D.12018 = (int) D.12017;
                  __result = D.12015 - D.12018;
                  <D.12012>:
                  <D.12010>:
                  <D.12002>:
                  <D.12000>:
                  <D.11992>:
                  <D.11990>:
                }
                D.10905 = __result;
              }
              iftmp.50 = -D.10905;
              goto <D.12019>;
              <D.11983>:
              iftmp.50 = __builtin_strcmp (procname, "mono");
              <D.12019>:
              D.10906 = iftmp.50;
            }
            if (D.10906 == 0) goto <D.12020>; else goto <D.12021>;
            <D.12020>:
            process_handlep.49 = process_handlep;
            process_set_name (process_handlep.49);
            goto <D.12022>;
            <D.12021>:
            <D.12022>:
            return;
            <D.11980>:
            current_process.48 = current_process;
            _wapi_handle_unref (current_process.48);
            <D.11976>:
          }
        finally
          {
            process_handlep = {CLOBBER};
          }
      }
      <D.11970>:
      process_handle.id = pid;
      process_set_defaults (&process_handle);
      process_set_name (&process_handle);
      current_process.51 = _wapi_handle_new (9, &process_handle);
      current_process = current_process.51;
      current_process.48 = current_process;
      if (current_process.48 == 4294967295B) goto <D.12024>; else goto <D.12025>;
      <D.12024>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      return;
      <D.12025>:
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


atoi (const char * __nptr)
{
  int D.12031;

  D.12031 = strtol (__nptr, 0B, 10);
  return D.12031;
}


process_set_name (struct _WapiHandle_process * process_handle)
{
  gchar[256] * D.12037;
  const gchar * D.12038;
  gchar * progname;
  gchar * utf8_progname;
  gchar * slash;

  progname = monoeg_g_get_prgname ();
  utf8_progname = mono_utf8_from_external (progname);
  if (utf8_progname != 0B) goto <D.12033>; else goto <D.12034>;
  <D.12033>:
  slash = strrchr (utf8_progname, 47);
  if (slash != 0B) goto <D.12035>; else goto <D.12036>;
  <D.12035>:
  D.12037 = &process_handle->proc_name;
  D.12038 = slash + 1;
  monoeg_g_strlcpy (D.12037, D.12038, 255);
  goto <D.12039>;
  <D.12036>:
  D.12037 = &process_handle->proc_name;
  monoeg_g_strlcpy (D.12037, utf8_progname, 255);
  <D.12039>:
  monoeg_g_free (utf8_progname);
  <D.12034>:
}


GetCurrentProcess ()
{
  void * D.12040;

  mono_once (&process_current_once, process_set_current);
  D.12040 = 4294967295B;
  return D.12040;
}


GetProcessId (void * handle)
{
  signed int handle.52;
  guint32 D.12045;
  unsigned int handle.53;
  struct _WapiHandle_process * process_handle.54;
  int D.12050;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.52 = (signed int) handle;
      if (handle.52 < 0) goto <D.12043>; else goto <D.12044>;
      <D.12043>:
      handle.53 = (unsigned int) handle;
      D.12045 = handle.53 & 2147483647;
      return D.12045;
      <D.12044>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.12047>; else goto <D.12048>;
      <D.12047>:
      SetLastError (6);
      D.12045 = 0;
      return D.12045;
      <D.12048>:
      process_handle.54 = process_handle;
      D.12050 = process_handle.54->id;
      D.12045 = (guint32) D.12050;
      return D.12045;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetCurrentProcessId ()
{
  guint32 D.12053;
  void * current_process.55;

  mono_once (&process_current_once, process_set_current);
  current_process.55 = current_process;
  D.12053 = GetProcessId (current_process.55);
  return D.12053;
}


EnumProcesses (guint32 * pids, guint32 len, guint32 * needed)
{
  gboolean D.12058;
  const short unsigned int * * D.12059;
  const short unsigned int * D.12060;
  char D.12061;
  unsigned int D.12062;
  unsigned int D.12063;
  const short unsigned int * D.12064;
  short unsigned int D.12065;
  int D.12066;
  int D.12067;
  char[256] * D.12070;
  char * endptr.56;
  char D.12072;
  unsigned int i.57;
  unsigned int D.12076;
  guint32 * D.12077;
  unsigned int pid.58;
  unsigned int D.12080;
  guint32 fit;
  guint32 i;
  struct DIR * dir;
  struct dirent * entry;

  mono_once (&process_current_once, process_set_current);
  dir = opendir ("/proc");
  if (dir == 0B) goto <D.12056>; else goto <D.12057>;
  <D.12056>:
  D.12058 = 0;
  return D.12058;
  <D.12057>:
  i = 0;
  fit = len / 4;
  goto <D.10937>;
  <D.10938>:
  {
    pid_t pid;
    char * endptr;

    try
      {
        D.12059 = __ctype_b_loc ();
        D.12060 = *D.12059;
        D.12061 = entry->d_name[0];
        D.12062 = (unsigned int) D.12061;
        D.12063 = D.12062 * 2;
        D.12064 = D.12060 + D.12063;
        D.12065 = *D.12064;
        D.12066 = (int) D.12065;
        D.12067 = D.12066 & 2048;
        if (D.12067 == 0) goto <D.12068>; else goto <D.12069>;
        <D.12068>:
        // predicted unlikely by continue predictor.
        goto <D.10937>;
        <D.12069>:
        D.12070 = &entry->d_name;
        pid = strtol (D.12070, &endptr, 10);
        endptr.56 = endptr;
        D.12072 = *endptr.56;
        if (D.12072 == 0) goto <D.12073>; else goto <D.12074>;
        <D.12073>:
        i.57 = i;
        i = i.57 + 1;
        D.12076 = i.57 * 4;
        D.12077 = pids + D.12076;
        pid.58 = (unsigned int) pid;
        *D.12077 = pid.58;
        <D.12074>:
      }
    finally
      {
        endptr = {CLOBBER};
      }
  }
  <D.10937>:
  if (i < fit) goto <D.12079>; else goto <D.10939>;
  <D.12079>:
  entry = readdir (dir);
  if (entry != 0B) goto <D.10938>; else goto <D.10939>;
  <D.10939>:
  closedir (dir);
  D.12080 = i * 4;
  *needed = D.12080;
  D.12058 = 1;
  return D.12058;
}


CloseProcess (void * handle)
{
  signed int handle.59;
  gboolean D.12087;

  handle.59 = (signed int) handle;
  if (handle.59 < 0) goto <D.12085>; else goto <D.12086>;
  <D.12085>:
  D.12087 = 1;
  return D.12087;
  <D.12086>:
  D.12087 = CloseHandle (handle);
  return D.12087;
}


OpenProcess (guint32 req_access, gboolean inherit, guint32 pid)
{
  void * pid.60;
  int pid.61;
  int D.12093;
  void * D.12096;
  unsigned int D.12097;
  void * handle;

  handle = 0B;
  mono_once (&process_current_once, process_set_current);
  pid.60 = (void *) pid;
  handle = _wapi_search_handle (9, process_open_compare, pid.60, 0B, 1);
  if (handle == 0B) goto <D.12090>; else goto <D.12091>;
  <D.12090>:
  pid.61 = (int) pid;
  D.12093 = is_pid_valid (pid.61);
  if (D.12093 != 0) goto <D.12094>; else goto <D.12095>;
  <D.12094>:
  D.12097 = pid + 2147483648;
  D.12096 = (void *) D.12097;
  return D.12096;
  <D.12095>:
  SetLastError (127);
  D.12096 = 0B;
  return D.12096;
  <D.12091>:
  D.12096 = handle;
  return D.12096;
}


process_open_compare (void * handle, void * user_data)
{
  gboolean D.12101;
  int D.12104;
  pid_t wanted_pid;
  pid_t checking_pid;

  checking_pid = signal_process_if_gone (handle);
  if (checking_pid == 0) goto <D.12099>; else goto <D.12100>;
  <D.12099>:
  D.12101 = 0;
  return D.12101;
  <D.12100>:
  wanted_pid = (pid_t) user_data;
  if (checking_pid == wanted_pid) goto <D.12103>; else goto <D.12102>;
  <D.12103>:
  D.12104 = _wapi_handle_issignalled (handle);
  if (D.12104 == 0) goto <D.12105>; else goto <D.12102>;
  <D.12105>:
  D.12101 = 1;
  return D.12101;
  <D.12102>:
  D.12101 = 0;
  return D.12101;
}


signal_process_if_gone (void * handle)
{
  signed int handle.62;
  _Bool D.12108;
  long int D.12109;
  long int D.12110;
  pid_t D.12115;
  struct _WapiHandle_process * process_handle.63;
  int D.12119;
  int D.12120;
  int * D.12123;
  int D.12124;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.62 = (signed int) handle;
      D.12108 = handle.62 < 0;
      D.12109 = (long int) D.12108;
      D.12110 = __builtin_expect (D.12109, 0);
      if (D.12110 != 0) goto <D.12111>; else goto <D.12112>;
      <D.12111>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 1271, "(GPOINTER_TO_UINT (handle) & _WAPI_PROCESS_UNHANDLED) != _WAPI_PROCESS_UNHANDLED");
      <D.12112>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.12113>; else goto <D.12114>;
      <D.12113>:
      D.12115 = 0;
      return D.12115;
      <D.12114>:
      process_handle.63 = process_handle;
      D.12119 = process_handle.63->id;
      D.12120 = kill (D.12119, 0);
      if (D.12120 == -1) goto <D.12121>; else goto <D.12122>;
      <D.12121>:
      D.12123 = __errno_location ();
      D.12124 = *D.12123;
      if (D.12124 == 3) goto <D.12116>; else goto <D.12125>;
      <D.12125>:
      D.12123 = __errno_location ();
      D.12124 = *D.12123;
      if (D.12124 == 1) goto <D.12116>; else goto <D.12117>;
      <D.12116>:
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.12117>:
      <D.12122>:
      process_handle.63 = process_handle;
      D.12115 = process_handle.63->id;
      return D.12115;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


_wapi_handle_issignalled (void * handle)
{
  gboolean D.12130;
  <unnamed type> D.12133;
  <unnamed type> D.12135;
  <unnamed type> D.12137;
  <unnamed type> D.12139;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.64;
  unsigned int handle.65;
  unsigned int D.12142;
  struct _WapiHandleUnshared * D.12143;
  unsigned int D.12144;
  unsigned int D.12145;
  struct _WapiHandleUnshared * D.12146;
  unsigned int D.12147;
  unsigned int D.12148;
  struct _WapiHandleUnshared * D.12149;
  unsigned int D.12150;
  unsigned int D.12151;
  struct _WapiHandleUnshared * D.12152;
  guint32 idx;

  idx = (guint32) handle;
  if (idx > 4194303) goto <D.12128>; else goto <D.12129>;
  <D.12128>:
  D.12130 = 0;
  return D.12130;
  <D.12129>:
  D.12133 = _wapi_handle_type (handle);
  if (D.12133 == 9) goto <D.12131>; else goto <D.12134>;
  <D.12134>:
  D.12135 = _wapi_handle_type (handle);
  if (D.12135 == 11) goto <D.12131>; else goto <D.12136>;
  <D.12136>:
  D.12137 = _wapi_handle_type (handle);
  if (D.12137 == 12) goto <D.12131>; else goto <D.12138>;
  <D.12138>:
  D.12139 = _wapi_handle_type (handle);
  if (D.12139 == 13) goto <D.12131>; else goto <D.12132>;
  <D.12131>:
  _wapi_shared_layout.64 = _wapi_shared_layout;
  handle.65 = (unsigned int) handle;
  D.12142 = handle.65 / 256;
  D.12143 = _wapi_private_handles[D.12142];
  handle.65 = (unsigned int) handle;
  D.12144 = handle.65 & 255;
  D.12145 = D.12144 * 144;
  D.12146 = D.12143 + D.12145;
  D.12147 = D.12146->u.shared.offset;
  D.12130 = _wapi_shared_layout.64->handles[D.12147].signalled;
  return D.12130;
  <D.12132>:
  D.12148 = idx / 256;
  D.12149 = _wapi_private_handles[D.12148];
  D.12150 = idx & 255;
  D.12151 = D.12150 * 144;
  D.12152 = D.12149 + D.12151;
  D.12130 = D.12152->signalled;
  return D.12130;
}


GetExitCodeProcess (void * process, guint32 * code)
{
  gboolean D.12156;
  unsigned int process.66;
  signed int process.67;
  int pid.68;
  int D.12162;
  int D.12167;
  struct _WapiHandle_process * process_handle.69;
  unsigned int D.12171;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  guint32 pid;

  try
    {
      pid = 4294967295;
      mono_once (&process_current_once, process_set_current);
      if (code == 0B) goto <D.12154>; else goto <D.12155>;
      <D.12154>:
      D.12156 = 0;
      return D.12156;
      <D.12155>:
      process.66 = (unsigned int) process;
      pid = process.66 + 2147483648;
      process.67 = (signed int) process;
      if (process.67 < 0) goto <D.12159>; else goto <D.12160>;
      <D.12159>:
      pid.68 = (int) pid;
      D.12162 = is_pid_valid (pid.68);
      if (D.12162 != 0) goto <D.12163>; else goto <D.12164>;
      <D.12163>:
      *code = 259;
      D.12156 = 1;
      return D.12156;
      <D.12164>:
      D.12156 = 0;
      return D.12156;
      <D.12160>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12165>; else goto <D.12166>;
      <D.12165>:
      D.12156 = 0;
      return D.12156;
      <D.12166>:
      process_wait (process, 0, 1);
      D.12167 = _wapi_handle_issignalled (process);
      if (D.12167 == 1) goto <D.12168>; else goto <D.12169>;
      <D.12168>:
      process_handle.69 = process_handle;
      D.12171 = process_handle.69->exitstatus;
      *code = D.12171;
      goto <D.12172>;
      <D.12169>:
      *code = 259;
      <D.12172>:
      D.12156 = 1;
      return D.12156;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetProcessTimes (void * process, struct WapiFileTime * create_time, struct WapiFileTime * exit_time, struct WapiFileTime * kernel_time, struct WapiFileTime * user_time)
{
  gboolean D.12180;
  signed int process.70;
  struct _WapiHandle_process * process_handle.71;
  int D.12187;
  int D.12190;
  int D.12191;
  int D.12194;
  long int D.12197;
  long int D.12198;
  long int D.12199;
  long int D.12200;
  long int D.12201;
  long int D.12202;
  long int D.12203;
  long int D.12204;
  long int D.12205;
  long int D.12206;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  gboolean ku_times_set;

  try
    {
      ku_times_set = 0;
      mono_once (&process_current_once, process_set_current);
      if (create_time == 0B) goto <D.12175>; else goto <D.12177>;
      <D.12177>:
      if (exit_time == 0B) goto <D.12175>; else goto <D.12178>;
      <D.12178>:
      if (kernel_time == 0B) goto <D.12175>; else goto <D.12179>;
      <D.12179>:
      if (user_time == 0B) goto <D.12175>; else goto <D.12176>;
      <D.12175>:
      D.12180 = 0;
      return D.12180;
      <D.12176>:
      process.70 = (signed int) process;
      if (process.70 < 0) goto <D.12182>; else goto <D.12183>;
      <D.12182>:
      D.12180 = 0;
      return D.12180;
      <D.12183>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12184>; else goto <D.12185>;
      <D.12184>:
      D.12180 = 0;
      return D.12180;
      <D.12185>:
      process_handle.71 = process_handle;
      *create_time = process_handle.71->create_time;
      D.12187 = _wapi_handle_issignalled (process);
      if (D.12187 == 1) goto <D.12188>; else goto <D.12189>;
      <D.12188>:
      process_handle.71 = process_handle;
      *exit_time = process_handle.71->exit_time;
      <D.12189>:
      process_handle.71 = process_handle;
      D.12190 = process_handle.71->id;
      D.12191 = getpid ();
      if (D.12190 == D.12191) goto <D.12192>; else goto <D.12193>;
      <D.12192>:
      {
        struct rusage time_data;

        try
          {
            D.12194 = getrusage (0, &time_data);
            if (D.12194 == 0) goto <D.12195>; else goto <D.12196>;
            <D.12195>:
            {
              gint64 tick_val;
              gint64 * tick_val_ptr;

              ku_times_set = 1;
              D.12197 = time_data.ru_utime.tv_sec;
              D.12198 = D.12197 * 10000000;
              D.12199 = time_data.ru_utime.tv_usec;
              D.12200 = D.12199 * 10;
              D.12201 = D.12198 + D.12200;
              tick_val = (gint64) D.12201;
              tick_val_ptr = user_time;
              *tick_val_ptr = tick_val;
              D.12202 = time_data.ru_stime.tv_sec;
              D.12203 = D.12202 * 10000000;
              D.12204 = time_data.ru_stime.tv_usec;
              D.12205 = D.12204 * 10;
              D.12206 = D.12203 + D.12205;
              tick_val = (gint64) D.12206;
              tick_val_ptr = kernel_time;
              *tick_val_ptr = tick_val;
            }
            <D.12196>:
          }
        finally
          {
            time_data = {CLOBBER};
          }
      }
      <D.12193>:
      if (ku_times_set == 0) goto <D.12207>; else goto <D.12208>;
      <D.12207>:
      memset (kernel_time, 0, 8);
      memset (user_time, 0, 8);
      <D.12208>:
      D.12180 = 1;
      return D.12180;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.12213;
  int D.12218;
  void * D.12220;
  unsigned int D.12221;

  D.12213 = __builtin_constant_p (__len);
  if (D.12213 != 0) goto <D.12214>; else goto <D.12215>;
  <D.12214>:
  if (__len == 0) goto <D.12216>; else goto <D.12217>;
  <D.12216>:
  D.12218 = __builtin_constant_p (__ch);
  if (D.12218 == 0) goto <D.12211>; else goto <D.12219>;
  <D.12219>:
  if (__ch != 0) goto <D.12211>; else goto <D.12212>;
  <D.12211>:
  __warn_memset_zero_len ();
  D.12220 = __dest;
  return D.12220;
  <D.12212>:
  <D.12217>:
  <D.12215>:
  D.12221 = __builtin_object_size (__dest, 0);
  D.12220 = __builtin___memset_chk (__dest, __ch, __len, D.12221);
  return D.12220;
}


EnumProcessModules (void * process, void * * modules, guint32 size, guint32 * needed)
{
  gboolean D.12225;
  signed int process.72;
  int process.73;
  struct _WapiHandle_process * process_handle.74;
  unsigned int D.12237;
  unsigned int D.12238;
  unsigned int i.75;
  void * D.12240;
  unsigned int i.76;
  unsigned int D.12244;
  void * * D.12245;
  void * D.12246;
  gchar * D.12248;
  int D.12249;
  sizetype i.77;
  sizetype D.12254;
  sizetype D.12255;
  void * * D.12256;
  unsigned int i.78;
  unsigned int D.12258;
  void * D.12260;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  struct FILE * fp;
  struct GSList * mods;
  struct WapiProcModule * module;
  guint32 count;
  guint32 avail;
  int i;
  pid_t pid;
  gchar * proc_name;

  try
    {
      mods = 0B;
      avail = size / 4;
      proc_name = 0B;
      if (size <= 3) goto <D.12223>; else goto <D.12224>;
      <D.12223>:
      D.12225 = 0;
      return D.12225;
      <D.12224>:
      process.72 = (signed int) process;
      if (process.72 < 0) goto <D.12227>; else goto <D.12228>;
      <D.12227>:
      process.73 = (int) process;
      pid = process.73 & 2147483647;
      goto <D.12230>;
      <D.12228>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12231>; else goto <D.12232>;
      <D.12231>:
      D.12225 = 0;
      return D.12225;
      <D.12232>:
      process_handle.74 = process_handle;
      pid = process_handle.74->id;
      process_handle.74 = process_handle;
      proc_name = &process_handle.74->proc_name;
      <D.12230>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.12234>; else goto <D.12235>;
      <D.12234>:
      *modules = 0B;
      *needed = 4;
      goto <D.12236>;
      <D.12235>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      D.12237 = count + 1;
      D.12238 = D.12237 * 4;
      *needed = D.12238;
      *modules = 0B;
      i = 0;
      goto <D.11113>;
      <D.11112>:
      i.75 = (unsigned int) i;
      module = monoeg_g_slist_nth_data (mods, i.75);
      D.12240 = *modules;
      if (D.12240 != 0B) goto <D.12241>; else goto <D.12242>;
      <D.12241>:
      i.76 = (unsigned int) i;
      D.12244 = i.76 * 4;
      D.12245 = modules + D.12244;
      D.12246 = module->address_start;
      *D.12245 = D.12246;
      goto <D.12247>;
      <D.12242>:
      D.12248 = module->filename;
      D.12249 = match_procname_to_modulename (proc_name, D.12248);
      if (D.12249 != 0) goto <D.12250>; else goto <D.12251>;
      <D.12250>:
      D.12246 = module->address_start;
      *modules = D.12246;
      goto <D.12252>;
      <D.12251>:
      i.77 = (sizetype) i;
      D.12254 = i.77 + 1;
      D.12255 = D.12254 * 4;
      D.12256 = modules + D.12255;
      D.12246 = module->address_start;
      *D.12256 = D.12246;
      <D.12252>:
      <D.12247>:
      i = i + 1;
      <D.11113>:
      i.78 = (unsigned int) i;
      D.12258 = avail + 4294967295;
      if (i.78 < D.12258) goto <D.12259>; else goto <D.11114>;
      <D.12259>:
      i.78 = (unsigned int) i;
      if (i.78 < count) goto <D.11112>; else goto <D.11114>;
      <D.11114>:
      i = 0;
      goto <D.11116>;
      <D.11115>:
      i.75 = (unsigned int) i;
      D.12260 = monoeg_g_slist_nth_data (mods, i.75);
      free_procmodule (D.12260);
      i = i + 1;
      <D.11116>:
      i.78 = (unsigned int) i;
      if (i.78 < count) goto <D.11115>; else goto <D.11117>;
      <D.11117>:
      monoeg_g_slist_free (mods);
      <D.12236>:
      D.12225 = 1;
      return D.12225;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


open_process_map (int pid, const char * mode)
{
  const gchar * D.12263;
  struct FILE * D.12265;
  struct FILE * fp;
  const gchar * proc_path[3];
  int i;
  gchar * filename;

  try
    {
      fp = 0B;
      proc_path[0] = "/proc/%d/maps";
      proc_path[1] = "/proc/%d/map";
      proc_path[2] = 0B;
      i = 0;
      goto <D.11094>;
      <D.11093>:
      D.12263 = proc_path[i];
      filename = monoeg_g_strdup_printf (D.12263, pid);
      fp = fopen (filename, mode);
      monoeg_g_free (filename);
      i = i + 1;
      <D.11094>:
      if (fp == 0B) goto <D.12264>; else goto <D.11095>;
      <D.12264>:
      D.12263 = proc_path[i];
      if (D.12263 != 0B) goto <D.11093>; else goto <D.11095>;
      <D.11095>:
      D.12265 = fp;
      return D.12265;
    }
  finally
    {
      proc_path = {CLOBBER};
    }
}


load_modules (struct FILE * fp)
{
  const short unsigned int * * D.12268;
  const short unsigned int * D.12269;
  char D.12270;
  unsigned int D.12271;
  unsigned int D.12272;
  const short unsigned int * D.12273;
  short unsigned int D.12274;
  int D.12275;
  int D.12276;
  char D.12277;
  unsigned int D.12278;
  unsigned int D.12279;
  const short unsigned int * D.12280;
  short unsigned int D.12281;
  int D.12282;
  int D.12283;
  long unsigned int D.12286;
  char D.12289;
  unsigned int D.12290;
  unsigned int D.12291;
  const short unsigned int * D.12292;
  short unsigned int D.12293;
  int D.12294;
  int D.12295;
  long unsigned int D.12298;
  char D.12301;
  char D.12306;
  unsigned int D.12307;
  unsigned int D.12308;
  const short unsigned int * D.12309;
  short unsigned int D.12310;
  int D.12311;
  int D.12312;
  long unsigned int D.12315;
  char D.12318;
  unsigned int D.12319;
  unsigned int D.12320;
  const short unsigned int * D.12321;
  short unsigned int D.12322;
  int D.12323;
  int D.12324;
  char D.12329;
  unsigned int D.12330;
  unsigned int D.12331;
  const short unsigned int * D.12332;
  short unsigned int D.12333;
  int D.12334;
  int D.12335;
  char D.12340;
  unsigned int D.12341;
  unsigned int D.12342;
  const short unsigned int * D.12343;
  short unsigned int D.12344;
  int D.12345;
  int D.12346;
  long int D.12349;
  gchar * D.12356;
  gchar * D.12357;
  gchar * D.12358;
  gchar * D.12359;
  struct GSList * D.12360;
  char * D.12364;
  struct GSList * D.12365;
  struct GSList * ret;
  struct WapiProcModule * mod;
  gchar buf[4097];
  gchar * p;
  gchar * endp;
  gchar * start_start;
  gchar * end_start;
  gchar * prot_start;
  gchar * offset_start;
  gchar * maj_dev_start;
  gchar * min_dev_start;
  gchar * inode_start;
  gchar prot_buf[5];
  void * address_start;
  void * address_end;
  void * address_offset;
  guint32 maj_dev;
  guint32 min_dev;
  ino_t inode;
  dev_t device;

  try
    {
      ret = 0B;
      goto <D.11019>;
      <D.11038>:
      p = &buf;
      goto <D.11017>;
      <D.11016>:
      p = p + 1;
      <D.11017>:
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 != 0) goto <D.11016>; else goto <D.11018>;
      <D.11018>:
      start_start = p;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12277 = *start_start;
      D.12278 = (unsigned int) D.12277;
      D.12279 = D.12278 * 2;
      D.12280 = D.12269 + D.12279;
      D.12281 = *D.12280;
      D.12282 = (int) D.12281;
      D.12283 = D.12282 & 4096;
      if (D.12283 == 0) goto <D.12284>; else goto <D.12285>;
      <D.12284>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12285>:
      D.12286 = strtoul (start_start, &endp, 16);
      address_start = (void *) D.12286;
      p = endp;
      D.12270 = *p;
      if (D.12270 != 45) goto <D.12287>; else goto <D.12288>;
      <D.12287>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12288>:
      p = p + 1;
      end_start = p;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12289 = *end_start;
      D.12290 = (unsigned int) D.12289;
      D.12291 = D.12290 * 2;
      D.12292 = D.12269 + D.12291;
      D.12293 = *D.12292;
      D.12294 = (int) D.12293;
      D.12295 = D.12294 & 4096;
      if (D.12295 == 0) goto <D.12296>; else goto <D.12297>;
      <D.12296>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12297>:
      D.12298 = strtoul (end_start, &endp, 16);
      address_end = (void *) D.12298;
      p = endp;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 == 0) goto <D.12299>; else goto <D.12300>;
      <D.12299>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12300>:
      goto <D.11021>;
      <D.11020>:
      p = p + 1;
      <D.11021>:
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 != 0) goto <D.11020>; else goto <D.11022>;
      <D.11022>:
      prot_start = p;
      D.12301 = *prot_start;
      if (D.12301 != 114) goto <D.12302>; else goto <D.12303>;
      <D.12302>:
      D.12301 = *prot_start;
      if (D.12301 != 45) goto <D.12304>; else goto <D.12305>;
      <D.12304>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12305>:
      <D.12303>:
      memcpy (&prot_buf, prot_start, 4);
      prot_buf[4] = 0;
      goto <D.11024>;
      <D.11023>:
      p = p + 1;
      <D.11024>:
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 == 0) goto <D.11023>; else goto <D.11025>;
      <D.11025>:
      goto <D.11027>;
      <D.11026>:
      p = p + 1;
      <D.11027>:
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 != 0) goto <D.11026>; else goto <D.11028>;
      <D.11028>:
      offset_start = p;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12306 = *offset_start;
      D.12307 = (unsigned int) D.12306;
      D.12308 = D.12307 * 2;
      D.12309 = D.12269 + D.12308;
      D.12310 = *D.12309;
      D.12311 = (int) D.12310;
      D.12312 = D.12311 & 4096;
      if (D.12312 == 0) goto <D.12313>; else goto <D.12314>;
      <D.12313>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12314>:
      D.12315 = strtoul (offset_start, &endp, 16);
      address_offset = (void *) D.12315;
      p = endp;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 == 0) goto <D.12316>; else goto <D.12317>;
      <D.12316>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12317>:
      goto <D.11030>;
      <D.11029>:
      p = p + 1;
      <D.11030>:
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 != 0) goto <D.11029>; else goto <D.11031>;
      <D.11031>:
      maj_dev_start = p;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12318 = *maj_dev_start;
      D.12319 = (unsigned int) D.12318;
      D.12320 = D.12319 * 2;
      D.12321 = D.12269 + D.12320;
      D.12322 = *D.12321;
      D.12323 = (int) D.12322;
      D.12324 = D.12323 & 4096;
      if (D.12324 == 0) goto <D.12325>; else goto <D.12326>;
      <D.12325>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12326>:
      maj_dev = strtoul (maj_dev_start, &endp, 16);
      p = endp;
      D.12270 = *p;
      if (D.12270 != 58) goto <D.12327>; else goto <D.12328>;
      <D.12327>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12328>:
      p = p + 1;
      min_dev_start = p;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12329 = *min_dev_start;
      D.12330 = (unsigned int) D.12329;
      D.12331 = D.12330 * 2;
      D.12332 = D.12269 + D.12331;
      D.12333 = *D.12332;
      D.12334 = (int) D.12333;
      D.12335 = D.12334 & 4096;
      if (D.12335 == 0) goto <D.12336>; else goto <D.12337>;
      <D.12336>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12337>:
      min_dev = strtoul (min_dev_start, &endp, 16);
      p = endp;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 == 0) goto <D.12338>; else goto <D.12339>;
      <D.12338>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12339>:
      goto <D.11033>;
      <D.11032>:
      p = p + 1;
      <D.11033>:
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 != 0) goto <D.11032>; else goto <D.11034>;
      <D.11034>:
      inode_start = p;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12340 = *inode_start;
      D.12341 = (unsigned int) D.12340;
      D.12342 = D.12341 * 2;
      D.12343 = D.12269 + D.12342;
      D.12344 = *D.12343;
      D.12345 = (int) D.12344;
      D.12346 = D.12345 & 4096;
      if (D.12346 == 0) goto <D.12347>; else goto <D.12348>;
      <D.12347>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12348>:
      D.12349 = strtol (inode_start, &endp, 10);
      inode = (ino_t) D.12349;
      p = endp;
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 == 0) goto <D.12350>; else goto <D.12351>;
      <D.12350>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12351>:
      device = gnu_dev_makedev (maj_dev, min_dev);
      if (device == 0) goto <D.12352>; else goto <D.12353>;
      <D.12352>:
      if (inode == 0) goto <D.12354>; else goto <D.12355>;
      <D.12354>:
      // predicted unlikely by continue predictor.
      goto <D.11019>;
      <D.12355>:
      <D.12353>:
      goto <D.11036>;
      <D.11035>:
      p = p + 1;
      <D.11036>:
      D.12268 = __ctype_b_loc ();
      D.12269 = *D.12268;
      D.12270 = *p;
      D.12271 = (unsigned int) D.12270;
      D.12272 = D.12271 * 2;
      D.12273 = D.12269 + D.12272;
      D.12274 = *D.12273;
      D.12275 = (int) D.12274;
      D.12276 = D.12275 & 8192;
      if (D.12276 != 0) goto <D.11035>; else goto <D.11037>;
      <D.11037>:
      mod = monoeg_malloc0 (40);
      mod->address_start = address_start;
      mod->address_end = address_end;
      D.12356 = monoeg_strdup (&prot_buf);
      mod->perms = D.12356;
      mod->address_offset = address_offset;
      mod->device = device;
      mod->inode = inode;
      D.12357 = monoeg_g_strchomp (p);
      D.12358 = monoeg_g_strchug (D.12357);
      D.12359 = monoeg_strdup (D.12358);
      mod->filename = D.12359;
      D.12360 = monoeg_g_slist_find_custom (ret, mod, find_procmodule);
      if (D.12360 == 0B) goto <D.12361>; else goto <D.12362>;
      <D.12361>:
      ret = monoeg_g_slist_prepend (ret, mod);
      goto <D.12363>;
      <D.12362>:
      free_procmodule (mod);
      <D.12363>:
      <D.11019>:
      D.12364 = fgets (&buf, 4097, fp);
      if (D.12364 != 0B) goto <D.11038>; else goto <D.11039>;
      <D.11039>:
      ret = monoeg_g_slist_reverse (ret);
      D.12365 = ret;
      return D.12365;
    }
  finally
    {
      buf = {CLOBBER};
      endp = {CLOBBER};
      prot_buf = {CLOBBER};
    }
}


find_procmodule (const void * a, const void * b)
{
  long long unsigned int D.12369;
  long long unsigned int D.12370;
  long long unsigned int D.12372;
  long long unsigned int D.12373;
  gint D.12375;
  struct WapiProcModule * want;
  struct WapiProcModule * compare;

  want = a;
  compare = b;
  D.12369 = want->device;
  D.12370 = compare->device;
  if (D.12369 == D.12370) goto <D.12371>; else goto <D.12368>;
  <D.12371>:
  D.12372 = want->inode;
  D.12373 = compare->inode;
  if (D.12372 == D.12373) goto <D.12374>; else goto <D.12368>;
  <D.12374>:
  D.12375 = 0;
  return D.12375;
  <D.12368>:
  D.12375 = 1;
  return D.12375;
}


memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.12377;
  unsigned int D.12378;

  D.12378 = __builtin_object_size (__dest, 0);
  D.12377 = __builtin___memcpy_chk (__dest, __src, __len, D.12378);
  return D.12377;
}


gnu_dev_makedev (unsigned int __major, unsigned int __minor)
{
  long long unsigned int D.12380;
  unsigned int D.12381;
  unsigned int D.12382;
  unsigned int D.12383;
  unsigned int D.12384;
  long long unsigned int D.12385;
  long long unsigned int D.12386;
  long long unsigned int D.12387;
  long long unsigned int D.12388;
  long long unsigned int D.12389;
  long long unsigned int D.12390;
  long long unsigned int D.12391;
  long long unsigned int D.12392;

  D.12381 = __minor & 255;
  D.12382 = __major & 4095;
  D.12383 = D.12382 << 8;
  D.12384 = D.12381 | D.12383;
  D.12385 = (long long unsigned int) D.12384;
  D.12386 = (long long unsigned int) __minor;
  D.12387 = D.12386 & 4294967040;
  D.12388 = D.12387 << 12;
  D.12389 = D.12385 | D.12388;
  D.12390 = (long long unsigned int) __major;
  D.12391 = D.12390 & 4294963200;
  D.12392 = D.12391 << 32;
  D.12380 = D.12389 | D.12392;
  return D.12380;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  unsigned int D.12394;
  int D.12399;
  char * D.12401;
  unsigned int D.12402;
  unsigned int __n.79;
  unsigned int D.12404;
  unsigned int D.12407;

  D.12394 = __builtin_object_size (__s, 1);
  if (D.12394 != 4294967295) goto <D.12395>; else goto <D.12396>;
  <D.12395>:
  D.12399 = __builtin_constant_p (__n);
  if (D.12399 == 0) goto <D.12397>; else goto <D.12400>;
  <D.12400>:
  if (__n <= 0) goto <D.12397>; else goto <D.12398>;
  <D.12397>:
  D.12402 = __builtin_object_size (__s, 1);
  D.12401 = __fgets_chk (__s, D.12402, __n, __stream);
  return D.12401;
  <D.12398>:
  __n.79 = (unsigned int) __n;
  D.12404 = __builtin_object_size (__s, 1);
  if (__n.79 > D.12404) goto <D.12405>; else goto <D.12406>;
  <D.12405>:
  D.12407 = __builtin_object_size (__s, 1);
  D.12401 = __fgets_chk_warn (__s, D.12407, __n, __stream);
  return D.12401;
  <D.12406>:
  <D.12396>:
  D.12401 = __fgets_alias (__s, __n, __stream);
  return D.12401;
}


match_procname_to_modulename (gchar * procname, gchar * modulename)
{
  gboolean D.12412;
  int D.11057;
  int D.11066;
  const char * D.12419;
  int D.11075;
  const char * D.12428;
  int D.11084;
  char * lastsep;
  char * lastsep2;
  char * pname;
  char * mname;
  gboolean result;

  lastsep = 0B;
  lastsep2 = 0B;
  pname = 0B;
  mname = 0B;
  result = 0;
  if (procname == 0B) goto <D.12409>; else goto <D.12411>;
  <D.12411>:
  if (modulename == 0B) goto <D.12409>; else goto <D.12410>;
  <D.12409>:
  D.12412 = 0;
  return D.12412;
  <D.12410>:
  pname = mono_path_resolve_symlinks (procname);
  mname = mono_path_resolve_symlinks (modulename);
  {
    size_t __s1_len;
    size_t __s2_len;

    D.11057 = __builtin_strcmp (pname, mname);
  }
  if (D.11057 == 0) goto <D.12413>; else goto <D.12414>;
  <D.12413>:
  result = 1;
  <D.12414>:
  if (result == 0) goto <D.12415>; else goto <D.12416>;
  <D.12415>:
  lastsep = strrchr (mname, 47);
  if (lastsep != 0B) goto <D.12417>; else goto <D.12418>;
  <D.12417>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.12419 = lastsep + 1;
    D.11066 = __builtin_strcmp (D.12419, pname);
  }
  if (D.11066 == 0) goto <D.12420>; else goto <D.12421>;
  <D.12420>:
  result = 1;
  <D.12421>:
  <D.12418>:
  if (result == 0) goto <D.12422>; else goto <D.12423>;
  <D.12422>:
  lastsep2 = strrchr (pname, 47);
  if (lastsep2 != 0B) goto <D.12424>; else goto <D.12425>;
  <D.12424>:
  if (lastsep != 0B) goto <D.12426>; else goto <D.12427>;
  <D.12426>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.12419 = lastsep + 1;
    D.12428 = lastsep2 + 1;
    D.11075 = __builtin_strcmp (D.12419, D.12428);
  }
  if (D.11075 == 0) goto <D.12429>; else goto <D.12430>;
  <D.12429>:
  result = 1;
  <D.12430>:
  goto <D.12431>;
  <D.12427>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.12428 = lastsep2 + 1;
    D.11084 = __builtin_strcmp (mname, D.12428);
  }
  if (D.11084 == 0) goto <D.12432>; else goto <D.12433>;
  <D.12432>:
  result = 1;
  <D.12433>:
  <D.12431>:
  <D.12425>:
  <D.12423>:
  <D.12416>:
  monoeg_g_free (pname);
  monoeg_g_free (mname);
  D.12412 = result;
  return D.12412;
}


free_procmodule (struct WapiProcModule * mod)
{
  gchar * D.12435;
  gchar * D.12438;

  D.12435 = mod->perms;
  if (D.12435 != 0B) goto <D.12436>; else goto <D.12437>;
  <D.12436>:
  D.12435 = mod->perms;
  monoeg_g_free (D.12435);
  <D.12437>:
  D.12438 = mod->filename;
  if (D.12438 != 0B) goto <D.12439>; else goto <D.12440>;
  <D.12439>:
  D.12438 = mod->filename;
  monoeg_g_free (D.12438);
  <D.12440>:
  monoeg_g_free (mod);
}


GetModuleBaseName (void * process, void * module, gunichar2 * basename, guint32 size)
{
  guint32 D.12441;

  D.12441 = get_module_name (process, module, basename, size, 1);
  return D.12441;
}


get_module_name (void * process, void * module, gunichar2 * basename, guint32 size, gboolean base)
{
  guint32 D.12446;
  signed int process.80;
  int process.81;
  struct _WapiHandle_process * process_handle.82;
  gchar[256] * D.12455;
  int * D.12460;
  int D.12461;
  unsigned int i.83;
  gchar * D.12473;
  int D.12474;
  void * D.12476;
  unsigned int i.84;
  unsigned int bytes.85;
  unsigned int D.12488;
  unsigned int bytes.86;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  pid_t pid;
  gunichar2 * procname;
  gchar * procname_ext;
  glong len;
  gsize bytes;
  struct FILE * fp;
  struct GSList * mods;
  struct WapiProcModule * found_module;
  guint32 count;
  int i;
  gchar * proc_name;

  try
    {
      procname_ext = 0B;
      mods = 0B;
      proc_name = 0B;
      mono_once (&process_current_once, process_set_current);
      size = size * 2;
      if (basename == 0B) goto <D.12443>; else goto <D.12445>;
      <D.12445>:
      if (size == 0) goto <D.12443>; else goto <D.12444>;
      <D.12443>:
      D.12446 = 0;
      return D.12446;
      <D.12444>:
      process.80 = (signed int) process;
      if (process.80 < 0) goto <D.12448>; else goto <D.12449>;
      <D.12448>:
      process.81 = (int) process;
      pid = process.81 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.12451>;
      <D.12449>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12452>; else goto <D.12453>;
      <D.12452>:
      D.12446 = 0;
      return D.12446;
      <D.12453>:
      process_handle.82 = process_handle;
      pid = process_handle.82->id;
      process_handle.82 = process_handle;
      D.12455 = &process_handle.82->proc_name;
      proc_name = monoeg_strdup (D.12455);
      <D.12451>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.12456>; else goto <D.12457>;
      <D.12456>:
      D.12460 = __errno_location ();
      D.12461 = *D.12460;
      if (D.12461 == 13) goto <D.12462>; else goto <D.12458>;
      <D.12462>:
      if (module == 0B) goto <D.12463>; else goto <D.12458>;
      <D.12463>:
      if (base == 1) goto <D.12464>; else goto <D.12458>;
      <D.12464>:
      procname_ext = get_process_name_from_proc (pid);
      goto <D.12459>;
      <D.12458>:
      monoeg_g_free (proc_name);
      D.12446 = 0;
      return D.12446;
      <D.12459>:
      goto <D.12465>;
      <D.12457>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.11148>;
      <D.11147>:
      i.83 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.83);
      if (procname_ext == 0B) goto <D.12470>; else goto <D.12471>;
      <D.12470>:
      if (module == 0B) goto <D.12472>; else goto <D.12467>;
      <D.12472>:
      D.12473 = found_module->filename;
      D.12474 = match_procname_to_modulename (proc_name, D.12473);
      if (D.12474 != 0) goto <D.12468>; else goto <D.12467>;
      <D.12467>:
      if (module != 0B) goto <D.12475>; else goto <D.12469>;
      <D.12475>:
      D.12476 = found_module->address_start;
      if (D.12476 == module) goto <D.12468>; else goto <D.12469>;
      <D.12468>:
      if (base != 0) goto <D.12477>; else goto <D.12478>;
      <D.12477>:
      D.12473 = found_module->filename;
      procname_ext = monoeg_g_path_get_basename (D.12473);
      goto <D.12479>;
      <D.12478>:
      D.12473 = found_module->filename;
      procname_ext = monoeg_strdup (D.12473);
      <D.12479>:
      <D.12469>:
      <D.12471>:
      free_procmodule (found_module);
      i = i + 1;
      <D.11148>:
      i.84 = (unsigned int) i;
      if (i.84 < count) goto <D.11147>; else goto <D.11149>;
      <D.11149>:
      if (procname_ext == 0B) goto <D.12481>; else goto <D.12482>;
      <D.12481>:
      procname_ext = get_process_name_from_proc (pid);
      <D.12482>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      <D.12465>:
      if (procname_ext != 0B) goto <D.12483>; else goto <D.12484>;
      <D.12483>:
      procname = mono_unicode_from_external (procname_ext, &bytes);
      if (procname == 0B) goto <D.12485>; else goto <D.12486>;
      <D.12485>:
      monoeg_g_free (procname_ext);
      D.12446 = 0;
      return D.12446;
      <D.12486>:
      bytes.85 = bytes;
      D.12488 = bytes.85 / 2;
      len = (glong) D.12488;
      bytes.85 = bytes;
      bytes.86 = bytes.85 + 2;
      bytes = bytes.86;
      bytes.85 = bytes;
      if (size < bytes.85) goto <D.12490>; else goto <D.12491>;
      <D.12490>:
      memcpy (basename, procname, size);
      goto <D.12492>;
      <D.12491>:
      bytes.85 = bytes;
      memcpy (basename, procname, bytes.85);
      <D.12492>:
      monoeg_g_free (procname);
      monoeg_g_free (procname_ext);
      D.12446 = (guint32) len;
      return D.12446;
      <D.12484>:
      D.12446 = 0;
      return D.12446;
    }
  finally
    {
      process_handle = {CLOBBER};
      bytes = {CLOBBER};
    }
}


get_process_name_from_proc (pid_t pid)
{
  int D.12495;
  gchar * D.12500;
  char * D.12503;
  char * D.12510;
  const char * D.12515;
  const gchar * D.12518;
  int end.87;
  int start.88;
  int D.12521;
  int D.12522;
  unsigned int D.12523;
  struct FILE * fp;
  gchar * filename;
  gchar buf[256];
  gchar * ret;

  try
    {
      filename = 0B;
      ret = 0B;
      memset (&buf, 0, 256);
      filename = monoeg_g_strdup_printf ("/proc/%d/exe", pid);
      D.12495 = readlink (filename, &buf, 255);
      if (D.12495 > 0) goto <D.12496>; else goto <D.12497>;
      <D.12496>:
      ret = monoeg_strdup (&buf);
      <D.12497>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.12498>; else goto <D.12499>;
      <D.12498>:
      D.12500 = ret;
      return D.12500;
      <D.12499>:
      filename = monoeg_g_strdup_printf ("/proc/%d/cmdline", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.12501>; else goto <D.12502>;
      <D.12501>:
      D.12503 = fgets (&buf, 256, fp);
      if (D.12503 != 0B) goto <D.12504>; else goto <D.12505>;
      <D.12504>:
      ret = monoeg_strdup (&buf);
      <D.12505>:
      fclose (fp);
      <D.12502>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.12506>; else goto <D.12507>;
      <D.12506>:
      D.12500 = ret;
      return D.12500;
      <D.12507>:
      filename = monoeg_g_strdup_printf ("/proc/%d/stat", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.12508>; else goto <D.12509>;
      <D.12508>:
      D.12510 = fgets (&buf, 256, fp);
      if (D.12510 != 0B) goto <D.12511>; else goto <D.12512>;
      <D.12511>:
      {
        gchar * start;
        gchar * end;

        start = __builtin_strchr (&buf, 40);
        if (start != 0B) goto <D.12513>; else goto <D.12514>;
        <D.12513>:
        D.12515 = start + 1;
        end = __builtin_strchr (D.12515, 41);
        if (end != 0B) goto <D.12516>; else goto <D.12517>;
        <D.12516>:
        D.12518 = start + 1;
        end.87 = (int) end;
        start.88 = (int) start;
        D.12521 = end.87 - start.88;
        D.12522 = D.12521 + -1;
        D.12523 = (unsigned int) D.12522;
        ret = monoeg_g_strndup (D.12518, D.12523);
        <D.12517>:
        <D.12514>:
      }
      <D.12512>:
      fclose (fp);
      <D.12509>:
      monoeg_g_free (filename);
      D.12500 = ret;
      return D.12500;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


readlink (const char * restrict __path, char * restrict __buf, size_t __len)
{
  unsigned int D.12526;
  int D.12529;
  ssize_t D.12532;
  unsigned int D.12533;
  unsigned int D.12534;
  unsigned int D.12537;

  D.12526 = __builtin_object_size (__buf, 1);
  if (D.12526 != 4294967295) goto <D.12527>; else goto <D.12528>;
  <D.12527>:
  D.12529 = __builtin_constant_p (__len);
  if (D.12529 == 0) goto <D.12530>; else goto <D.12531>;
  <D.12530>:
  D.12533 = __builtin_object_size (__buf, 1);
  D.12532 = __readlink_chk (__path, __buf, __len, D.12533);
  return D.12532;
  <D.12531>:
  D.12534 = __builtin_object_size (__buf, 1);
  if (D.12534 < __len) goto <D.12535>; else goto <D.12536>;
  <D.12535>:
  D.12537 = __builtin_object_size (__buf, 1);
  D.12532 = __readlink_chk_warn (__path, __buf, __len, D.12537);
  return D.12532;
  <D.12536>:
  <D.12528>:
  D.12532 = __readlink_alias (__path, __buf, __len);
  return D.12532;
}


GetModuleFileNameEx (void * process, void * module, gunichar2 * filename, guint32 size)
{
  guint32 D.12539;

  D.12539 = get_module_name (process, module, filename, size, 0);
  return D.12539;
}


GetModuleInformation (void * process, void * module, struct WapiModuleInfo * modinfo, guint32 size)
{
  gboolean D.12544;
  signed int process.89;
  int process.90;
  struct _WapiHandle_process * process_handle.91;
  gchar[256] * D.12553;
  unsigned int i.92;
  gchar * D.12563;
  int D.12564;
  void * D.12566;
  void * D.12567;
  unsigned int D.12568;
  unsigned int D.12569;
  unsigned int D.12570;
  void * D.12571;
  unsigned int i.93;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  pid_t pid;
  struct FILE * fp;
  struct GSList * mods;
  struct WapiProcModule * found_module;
  guint32 count;
  int i;
  gboolean ret;
  gchar * proc_name;

  try
    {
      mods = 0B;
      ret = 0;
      proc_name = 0B;
      mono_once (&process_current_once, process_set_current);
      if (modinfo == 0B) goto <D.12541>; else goto <D.12543>;
      <D.12543>:
      if (size <= 11) goto <D.12541>; else goto <D.12542>;
      <D.12541>:
      D.12544 = 0;
      return D.12544;
      <D.12542>:
      process.89 = (signed int) process;
      if (process.89 < 0) goto <D.12546>; else goto <D.12547>;
      <D.12546>:
      process.90 = (int) process;
      pid = process.90 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.12549>;
      <D.12547>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12550>; else goto <D.12551>;
      <D.12550>:
      D.12544 = 0;
      return D.12544;
      <D.12551>:
      process_handle.91 = process_handle;
      pid = process_handle.91->id;
      process_handle.91 = process_handle;
      D.12553 = &process_handle.91->proc_name;
      proc_name = monoeg_strdup (D.12553);
      <D.12549>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.12554>; else goto <D.12555>;
      <D.12554>:
      monoeg_g_free (proc_name);
      D.12544 = 0;
      return D.12544;
      <D.12555>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.11179>;
      <D.11178>:
      i.92 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.92);
      if (ret == 0) goto <D.12560>; else goto <D.12561>;
      <D.12560>:
      if (module == 0B) goto <D.12562>; else goto <D.12557>;
      <D.12562>:
      D.12563 = found_module->filename;
      D.12564 = match_procname_to_modulename (proc_name, D.12563);
      if (D.12564 != 0) goto <D.12558>; else goto <D.12557>;
      <D.12557>:
      if (module != 0B) goto <D.12565>; else goto <D.12559>;
      <D.12565>:
      D.12566 = found_module->address_start;
      if (D.12566 == module) goto <D.12558>; else goto <D.12559>;
      <D.12558>:
      D.12566 = found_module->address_start;
      modinfo->lpBaseOfDll = D.12566;
      D.12567 = found_module->address_end;
      D.12568 = (unsigned int) D.12567;
      D.12566 = found_module->address_start;
      D.12569 = (unsigned int) D.12566;
      D.12570 = D.12568 - D.12569;
      modinfo->SizeOfImage = D.12570;
      D.12571 = found_module->address_offset;
      modinfo->EntryPoint = D.12571;
      ret = 1;
      <D.12559>:
      <D.12561>:
      free_procmodule (found_module);
      i = i + 1;
      <D.11179>:
      i.93 = (unsigned int) i;
      if (i.93 < count) goto <D.11178>; else goto <D.11180>;
      <D.11180>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      D.12544 = ret;
      return D.12544;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetProcessWorkingSetSize (void * process, size_t * min, size_t * max)
{
  gboolean D.12578;
  signed int process.94;
  struct _WapiHandle_process * process_handle.95;
  unsigned int D.12585;
  unsigned int D.12586;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      if (min == 0B) goto <D.12575>; else goto <D.12577>;
      <D.12577>:
      if (max == 0B) goto <D.12575>; else goto <D.12576>;
      <D.12575>:
      D.12578 = 0;
      return D.12578;
      <D.12576>:
      process.94 = (signed int) process;
      if (process.94 < 0) goto <D.12580>; else goto <D.12581>;
      <D.12580>:
      D.12578 = 0;
      return D.12578;
      <D.12581>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12582>; else goto <D.12583>;
      <D.12582>:
      D.12578 = 0;
      return D.12578;
      <D.12583>:
      process_handle.95 = process_handle;
      D.12585 = process_handle.95->min_working_set;
      *min = D.12585;
      process_handle.95 = process_handle;
      D.12586 = process_handle.95->max_working_set;
      *max = D.12586;
      D.12578 = 1;
      return D.12578;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetProcessWorkingSetSize (void * process, size_t min, size_t max)
{
  signed int process.96;
  gboolean D.12592;
  struct _WapiHandle_process * process_handle.97;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      process.96 = (signed int) process;
      if (process.96 < 0) goto <D.12590>; else goto <D.12591>;
      <D.12590>:
      D.12592 = 0;
      return D.12592;
      <D.12591>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12593>; else goto <D.12594>;
      <D.12593>:
      D.12592 = 0;
      return D.12592;
      <D.12594>:
      process_handle.97 = process_handle;
      process_handle.97->min_working_set = min;
      process_handle.97 = process_handle;
      process_handle.97->max_working_set = max;
      D.12592 = 1;
      return D.12592;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


TerminateProcess (void * process, gint32 exitCode)
{
  signed int process.98;
  int process.99;
  gboolean D.12605;
  struct _WapiHandle_process * process_handle.100;
  int iftmp.101;
  int * D.12613;
  int D.12614;
  _Bool D.12615;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int signo;
  int ret;
  pid_t pid;

  try
    {
      process.98 = (signed int) process;
      if (process.98 < 0) goto <D.12599>; else goto <D.12600>;
      <D.12599>:
      process.99 = (int) process;
      pid = process.99 & 2147483647;
      goto <D.12602>;
      <D.12600>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12603>; else goto <D.12604>;
      <D.12603>:
      SetLastError (6);
      D.12605 = 0;
      return D.12605;
      <D.12604>:
      process_handle.100 = process_handle;
      pid = process_handle.100->id;
      <D.12602>:
      if (exitCode == -1) goto <D.12608>; else goto <D.12609>;
      <D.12608>:
      iftmp.101 = 9;
      goto <D.12610>;
      <D.12609>:
      iftmp.101 = 15;
      <D.12610>:
      signo = iftmp.101;
      ret = kill (pid, signo);
      if (ret == -1) goto <D.12611>; else goto <D.12612>;
      <D.12611>:
      D.12613 = __errno_location ();
      D.12614 = *D.12613;
      switch (D.12614) <default: <D.11208>, case 1: <D.11206>, case 3: <D.11207>, case 22: <D.11204>>
      <D.11204>:
      SetLastError (87);
      goto <D.11205>;
      <D.11206>:
      SetLastError (5);
      goto <D.11205>;
      <D.11207>:
      SetLastError (127);
      goto <D.11205>;
      <D.11208>:
      SetLastError (31);
      <D.11205>:
      <D.12612>:
      D.12615 = ret == 0;
      D.12605 = (gboolean) D.12615;
      return D.12605;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetPriorityClass (void * process)
{
  signed int process.102;
  int process.103;
  guint32 D.12625;
  struct _WapiHandle_process * process_handle.104;
  int * D.12627;
  unsigned int pid.105;
  int D.12631;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  pid_t pid;

  try
    {
      process.102 = (signed int) process;
      if (process.102 < 0) goto <D.12619>; else goto <D.12620>;
      <D.12619>:
      process.103 = (int) process;
      pid = process.103 & 2147483647;
      goto <D.12622>;
      <D.12620>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12623>; else goto <D.12624>;
      <D.12623>:
      SetLastError (6);
      D.12625 = 0;
      return D.12625;
      <D.12624>:
      process_handle.104 = process_handle;
      pid = process_handle.104->id;
      <D.12622>:
      D.12627 = __errno_location ();
      *D.12627 = 0;
      pid.105 = (unsigned int) pid;
      ret = getpriority (0, pid.105);
      if (ret == -1) goto <D.12629>; else goto <D.12630>;
      <D.12629>:
      D.12627 = __errno_location ();
      D.12631 = *D.12627;
      if (D.12631 != 0) goto <D.12632>; else goto <D.12633>;
      <D.12632>:
      D.12627 = __errno_location ();
      D.12631 = *D.12627;
      switch (D.12631) <default: <D.11220>, case 1: <D.11216>, case 3: <D.11219>, case 13: <D.11217>>
      <D.11216>:
      <D.11217>:
      SetLastError (5);
      goto <D.11218>;
      <D.11219>:
      SetLastError (127);
      goto <D.11218>;
      <D.11220>:
      SetLastError (31);
      <D.11218>:
      D.12625 = 0;
      return D.12625;
      <D.12633>:
      <D.12630>:
      if (ret == 0) goto <D.12634>; else goto <D.12635>;
      <D.12634>:
      D.12625 = 32;
      return D.12625;
      <D.12635>:
      if (ret < -15) goto <D.12636>; else goto <D.12637>;
      <D.12636>:
      D.12625 = 256;
      return D.12625;
      <D.12637>:
      if (ret < -10) goto <D.12638>; else goto <D.12639>;
      <D.12638>:
      D.12625 = 128;
      return D.12625;
      <D.12639>:
      if (ret < 0) goto <D.12640>; else goto <D.12641>;
      <D.12640>:
      D.12625 = 32768;
      return D.12625;
      <D.12641>:
      if (ret > 10) goto <D.12642>; else goto <D.12643>;
      <D.12642>:
      D.12625 = 64;
      return D.12625;
      <D.12643>:
      if (ret > 0) goto <D.12644>; else goto <D.12645>;
      <D.12644>:
      D.12625 = 16384;
      return D.12625;
      <D.12645>:
      D.12625 = 32;
      return D.12625;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetPriorityClass (void * process, guint32 priority_class)
{
  signed int process.106;
  int process.107;
  gboolean D.12655;
  struct _WapiHandle_process * process_handle.108;
  unsigned int pid.109;
  int * D.12660;
  int D.12661;
  _Bool D.12662;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  int prio;
  pid_t pid;

  try
    {
      process.106 = (signed int) process;
      if (process.106 < 0) goto <D.12649>; else goto <D.12650>;
      <D.12649>:
      process.107 = (int) process;
      pid = process.107 & 2147483647;
      goto <D.12652>;
      <D.12650>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12653>; else goto <D.12654>;
      <D.12653>:
      SetLastError (6);
      D.12655 = 0;
      return D.12655;
      <D.12654>:
      process_handle.108 = process_handle;
      pid = process_handle.108->id;
      <D.12652>:
      switch (priority_class) <default: <D.11237>, case 32: <D.11233>, case 64: <D.11230>, case 128: <D.11235>, case 256: <D.11236>, case 16384: <D.11232>, case 32768: <D.11234>>
      <D.11230>:
      prio = 19;
      goto <D.11231>;
      <D.11232>:
      prio = 10;
      goto <D.11231>;
      <D.11233>:
      prio = 0;
      goto <D.11231>;
      <D.11234>:
      prio = -5;
      goto <D.11231>;
      <D.11235>:
      prio = -11;
      goto <D.11231>;
      <D.11236>:
      prio = -20;
      goto <D.11231>;
      <D.11237>:
      SetLastError (87);
      D.12655 = 0;
      return D.12655;
      <D.11231>:
      pid.109 = (unsigned int) pid;
      ret = setpriority (0, pid.109, prio);
      if (ret == -1) goto <D.12658>; else goto <D.12659>;
      <D.12658>:
      D.12660 = __errno_location ();
      D.12661 = *D.12660;
      switch (D.12661) <default: <D.11242>, case 1: <D.11238>, case 3: <D.11241>, case 13: <D.11239>>
      <D.11238>:
      <D.11239>:
      SetLastError (5);
      goto <D.11240>;
      <D.11241>:
      SetLastError (127);
      goto <D.11240>;
      <D.11242>:
      SetLastError (31);
      <D.11240>:
      <D.12659>:
      D.12662 = ret == 0;
      D.12655 = (gboolean) D.12662;
      return D.12655;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


