process_wait (void * handle, guint32 timeout, gboolean alertable)
{
  long unsigned int D.13930;
  guint32 D.13933;
  signed int handle.0;
  _Bool D.13935;
  long int D.13936;
  long int D.13937;
  struct _WapiHandle_process * process_handle.1;
  int D.13943;
  int D.13948;
  int D.13949;
  _Bool D.13952;
  union MonoSemType * D.13957;
  unsigned int D.13958;
  unsigned int D.13959;
  int * D.13963;
  int D.13964;
  int D.13972;
  unsigned int D.13976;
  unsigned int D.13981;
  int D.13984;
  _Bool D.13987;
  long int D.13988;
  long int D.13989;
  int iftmp.2;
  unsigned char D.13996;
  unsigned char D.13997;
  unsigned char D.13998;
  signed char D.13999;
  signed char D.14000;
  int D.14003;
  int D.14004;
  unsigned int D.14005;
  int D.14007;
  int D.14008;
  unsigned int D.14009;
  long int D.14010;
  struct WapiFileTime * D.14011;
  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";

  try
    {
      D.13930 = pthread_self ();
      current_thread = _wapi_thread_handle_from_id (D.13930);
      if (current_thread == 0B) goto <D.13931>; else goto <D.13932>;
      <D.13931>:
      SetLastError (6);
      D.13933 = 4294967295;
      return D.13933;
      <D.13932>:
      handle.0 = (signed int) handle;
      D.13935 = handle.0 < 0;
      D.13936 = (long int) D.13935;
      D.13937 = __builtin_expect (D.13936, 0);
      if (D.13937 != 0) goto <D.13938>; else goto <D.13939>;
      <D.13938>:
      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.13939>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.13940>; else goto <D.13941>;
      <D.13940>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      D.13933 = 4294967295;
      return D.13933;
      <D.13941>:
      process_handle.1 = process_handle;
      D.13943 = process_handle.1->exited;
      if (D.13943 != 0) goto <D.13944>; else goto <D.13945>;
      <D.13944>:
      D.13933 = 0;
      return D.13933;
      <D.13945>:
      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.13946>; else goto <D.13947>;
      <D.13946>:
      process_handle.1 = process_handle;
      D.13948 = process_handle.1->self;
      D.13949 = _wapi_getpid ();
      if (D.13948 != D.13949) goto <D.13950>; else goto <D.13951>;
      <D.13950>:
      mp = 0B;
      <D.13951>:
      <D.13947>:
      start = mono_msec_ticks ();
      now = start;
      D.13952 = mp == 0B;
      spin = (gboolean) D.13952;
      <D.13926>:
      if (mp != 0B) goto <D.13953>; else goto <D.13954>;
      <D.13953>:
      if (timeout != 4294967295) goto <D.13955>; else goto <D.13956>;
      <D.13955>:
      D.13957 = &mp->exit_sem;
      D.13958 = start - now;
      D.13959 = D.13958 + timeout;
      ret = mono_sem_timedwait (D.13957, D.13959, alertable);
      goto <D.13960>;
      <D.13956>:
      D.13957 = &mp->exit_sem;
      ret = mono_sem_wait (D.13957, alertable);
      <D.13960>:
      if (ret == -1) goto <D.13961>; else goto <D.13962>;
      <D.13961>:
      D.13963 = __errno_location ();
      D.13964 = *D.13963;
      if (D.13964 != 4) goto <D.13965>; else goto <D.13966>;
      <D.13965>:
      D.13963 = __errno_location ();
      D.13964 = *D.13963;
      if (D.13964 != 110) goto <D.13967>; else goto <D.13968>;
      <D.13967>:
      <D.13968>:
      <D.13966>:
      <D.13962>:
      if (ret == 0) goto <D.13969>; else goto <D.13970>;
      <D.13969>:
      D.13957 = &mp->exit_sem;
      mono_sem_post (D.13957);
      goto <D.13925>;
      <D.13970>:
      goto <D.13971>;
      <D.13954>:
      D.13972 = is_pid_valid (pid);
      if (D.13972 == 0) goto <D.13925>; else goto <D.13973>;
      <D.13973>:
      <D.13971>:
      if (timeout == 0) goto <D.13974>; else goto <D.13975>;
      <D.13974>:
      D.13933 = 258;
      return D.13933;
      <D.13975>:
      now = mono_msec_ticks ();
      D.13976 = now - start;
      if (D.13976 >= timeout) goto <D.13977>; else goto <D.13978>;
      <D.13977>:
      D.13933 = 258;
      return D.13933;
      <D.13978>:
      if (spin != 0) goto <D.13979>; else goto <D.13980>;
      <D.13979>:
      D.13958 = start - now;
      D.13959 = D.13958 + timeout;
      D.13981 = MIN_EXPR <D.13959, 100>;
      _wapi_handle_spin (D.13981);
      <D.13980>:
      if (alertable != 0) goto <D.13982>; else goto <D.13983>;
      <D.13982>:
      D.13984 = _wapi_thread_apc_pending (current_thread);
      if (D.13984 != 0) goto <D.13985>; else goto <D.13986>;
      <D.13985>:
      D.13933 = 192;
      return D.13933;
      <D.13986>:
      <D.13983>:
      goto <D.13926>;
      <D.13925>:
      ret = _wapi_handle_lock_shared_handles ();
      D.13987 = ret != 0;
      D.13988 = (long int) D.13987;
      D.13989 = __builtin_expect (D.13988, 0);
      if (D.13989 != 0) goto <D.13990>; else goto <D.13991>;
      <D.13990>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 3006, "ret == 0");
      <D.13991>:
      if (mp != 0B) goto <D.13993>; else goto <D.13994>;
      <D.13993>:
      iftmp.2 = mp->status;
      goto <D.13995>;
      <D.13994>:
      iftmp.2 = 0;
      <D.13995>:
      status = iftmp.2;
      D.13996 = (unsigned char) status;
      D.13997 = D.13996 & 127;
      D.13998 = D.13997 + 1;
      D.13999 = (signed char) D.13998;
      D.14000 = D.13999 >> 1;
      if (D.14000 > 0) goto <D.14001>; else goto <D.14002>;
      <D.14001>:
      process_handle.1 = process_handle;
      D.14003 = status & 127;
      D.14004 = D.14003 + 128;
      D.14005 = (unsigned int) D.14004;
      process_handle.1->exitstatus = D.14005;
      goto <D.14006>;
      <D.14002>:
      process_handle.1 = process_handle;
      D.14007 = status & 65280;
      D.14008 = D.14007 >> 8;
      D.14009 = (unsigned int) D.14008;
      process_handle.1->exitstatus = D.14009;
      <D.14006>:
      D.14010 = time (0B);
      process_handle.1 = process_handle;
      D.14011 = &process_handle.1->exit_time;
      _wapi_time_t_to_filetime (D.14010, D.14011);
      process_handle.1 = process_handle;
      process_handle.1->exited = 1;
      _wapi_shared_handle_set_signal_state (handle, 1);
      _wapi_handle_unlock_shared_handles ();
      D.13933 = 0;
      return D.13933;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


is_pid_valid (pid_t pid)
{
  int D.14014;
  gboolean D.14017;
  gboolean result;
  gchar * dir;

  result = 0;
  dir = monoeg_g_strdup_printf ("/proc/%d", pid);
  D.14014 = access (dir, 0);
  if (D.14014 == 0) goto <D.14015>; else goto <D.14016>;
  <D.14015>:
  result = 1;
  <D.14016>:
  monoeg_g_free (dir);
  D.14017 = result;
  return D.14017;
}


_wapi_handle_spin (guint32 ms)
{
  _Bool D.14019;
  long int D.14020;
  long int D.14021;
  unsigned int D.14024;
  long int D.14025;
  struct timespec sleepytime;

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


_wapi_handle_lock_shared_handles ()
{
  int D.14026;

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


_wapi_shared_handle_set_signal_state (void * handle, gboolean state)
{
  int iftmp.3;
  <unnamed type> D.14033;
  <unnamed type> D.14035;
  <unnamed type> D.14037;
  <unnamed type> D.14039;
  _Bool D.14041;
  long int D.14042;
  long int D.14043;
  unsigned int D.14046;
  struct _WapiHandleUnshared * D.14047;
  unsigned int D.14048;
  unsigned int D.14049;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.4;
  unsigned int D.14051;
  guint32 idx;
  struct _WapiHandleUnshared * handle_data;
  struct _WapiHandle_shared_ref * ref;
  struct _WapiHandleShared * shared_data;

  idx = (guint32) handle;
  if (idx > 4194303) goto <D.14028>; else goto <D.14029>;
  <D.14028>:
  return;
  <D.14029>:
  D.14033 = _wapi_handle_type (handle);
  if (D.14033 != 9) goto <D.14034>; else goto <D.14031>;
  <D.14034>:
  D.14035 = _wapi_handle_type (handle);
  if (D.14035 != 11) goto <D.14036>; else goto <D.14031>;
  <D.14036>:
  D.14037 = _wapi_handle_type (handle);
  if (D.14037 != 12) goto <D.14038>; else goto <D.14031>;
  <D.14038>:
  D.14039 = _wapi_handle_type (handle);
  if (D.14039 != 13) goto <D.14040>; else goto <D.14031>;
  <D.14040>:
  iftmp.3 = 1;
  goto <D.14032>;
  <D.14031>:
  iftmp.3 = 0;
  <D.14032>:
  D.14041 = iftmp.3 != 0;
  D.14042 = (long int) D.14041;
  D.14043 = __builtin_expect (D.14042, 0);
  if (D.14043 != 0) goto <D.14044>; else goto <D.14045>;
  <D.14044>:
  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.14045>:
  D.14046 = idx / 256;
  D.14047 = _wapi_private_handles[D.14046];
  D.14048 = idx & 255;
  D.14049 = D.14048 * 144;
  handle_data = D.14047 + D.14049;
  ref = &handle_data->u.shared;
  _wapi_shared_layout.4 = _wapi_shared_layout;
  D.14051 = ref->offset;
  shared_data = &_wapi_shared_layout.4->handles[D.14051];
  shared_data->signalled = state;
}


_wapi_handle_type (void * handle)
{
  unsigned int D.14056;
  struct _WapiHandleUnshared * D.14057;
  WapiHandleType D.14058;
  unsigned int D.14059;
  unsigned int D.14060;
  struct _WapiHandleUnshared * D.14061;
  guint32 idx;

  idx = (guint32) handle;
  if (idx > 4194303) goto <D.14053>; else goto <D.14055>;
  <D.14055>:
  D.14056 = idx / 256;
  D.14057 = _wapi_private_handles[D.14056];
  if (D.14057 == 0B) goto <D.14053>; else goto <D.14054>;
  <D.14053>:
  D.14058 = 0;
  return D.14058;
  <D.14054>:
  D.14056 = idx / 256;
  D.14057 = _wapi_private_handles[D.14056];
  D.14059 = idx & 255;
  D.14060 = D.14059 * 144;
  D.14061 = D.14057 + D.14060;
  D.14058 = D.14061->type;
  return D.14058;
}


_wapi_handle_unlock_shared_handles ()
{
  int D.14063;

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


process_close (void * handle, void * data)
{
  struct MonoProcess * D.14065;
  int D.14068;
  int D.14069;
  gint32 * D.14072;
  struct _WapiHandle_process * process_handle;

  process_handle = data;
  D.14065 = process_handle->mono_process;
  if (D.14065 != 0B) goto <D.14066>; else goto <D.14067>;
  <D.14066>:
  D.14068 = process_handle->self;
  D.14069 = _wapi_getpid ();
  if (D.14068 == D.14069) goto <D.14070>; else goto <D.14071>;
  <D.14070>:
  D.14065 = process_handle->mono_process;
  D.14072 = &D.14065->handle_count;
  InterlockedDecrement (D.14072);
  <D.14071>:
  <D.14067>:
  mono_processes_cleanup ();
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.14073;
  unsigned int D.14074;

  D.14074 = __sync_sub_and_fetch_4 (val, 1);
  D.14073 = (gint32) D.14074;
  return D.14073;
}


mono_processes_cleanup ()
{
  int D.14076;
  int D.14079;
  void * D.14082;
  int D.14090;
  unsigned int spin.5;
  struct MonoProcess * mono_processes.6;
  struct MonoProcess * mono_processes.7;
  int mono_processes_read_lock.8;
  union MonoSemType * D.14111;
  struct MonoProcess * mp;
  struct MonoProcess * prev;
  struct MonoProcess * candidate;
  void * unref_handle;
  int spin;

  prev = 0B;
  candidate = 0B;
  D.14076 = InterlockedCompareExchange (&mono_processes_cleaning_up, 1, 0);
  if (D.14076 != 0) goto <D.14077>; else goto <D.14078>;
  <D.14077>:
  return;
  <D.14078>:
  mp = mono_processes;
  goto <D.13879>;
  <D.13880>:
  D.14079 = mp->pid;
  if (D.14079 == 0) goto <D.14080>; else goto <D.14081>;
  <D.14080>:
  D.14082 = mp->handle;
  if (D.14082 != 0B) goto <D.14083>; else goto <D.14084>;
  <D.14083>:
  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.14085>; else goto <D.14086>;
  <D.14085>:
  _wapi_handle_unref (unref_handle);
  <D.14086>:
  // predicted unlikely by continue predictor.
  goto <D.13879>;
  <D.14084>:
  <D.14081>:
  mp = mp->next;
  <D.13879>:
  if (mp != 0B) goto <D.13880>; else goto <D.13881>;
  <D.13881>:
  mp = mono_processes;
  spin = 0;
  goto <D.13883>;
  <D.13884>:
  D.14090 = mp->handle_count;
  if (D.14090 == 0) goto <D.14091>; else goto <D.14087>;
  <D.14091>:
  D.14079 = mp->pid;
  if (D.14079 == 0) goto <D.14088>; else goto <D.14087>;
  <D.14087>:
  if (candidate != 0B) goto <D.14088>; else goto <D.14089>;
  <D.14088>:
  if (spin > 0) goto <D.14092>; else goto <D.14093>;
  <D.14092>:
  spin.5 = (unsigned int) spin;
  _wapi_handle_spin (spin.5);
  spin = spin << 1;
  <D.14093>:
  pthread_mutex_lock (&mono_processes_mutex);
  if (candidate == 0B) goto <D.14095>; else goto <D.14096>;
  <D.14095>:
  mono_processes.6 = mono_processes;
  if (mp == mono_processes.6) goto <D.14098>; else goto <D.14099>;
  <D.14098>:
  mono_processes.7 = mp->next;
  mono_processes = mono_processes.7;
  goto <D.14101>;
  <D.14099>:
  mono_processes.7 = mp->next;
  prev->next = mono_processes.7;
  <D.14101>:
  candidate = mp;
  <D.14096>:
  mono_memory_barrier ();
  mono_processes_read_lock.8 = mono_processes_read_lock;
  if (mono_processes_read_lock.8 != 0) goto <D.14103>; else goto <D.14104>;
  <D.14103>:
  if (spin == 0) goto <D.14105>; else goto <D.14106>;
  <D.14105>:
  spin = 1;
  goto <D.14107>;
  <D.14106>:
  if (spin > 7) goto <D.14108>; else goto <D.14109>;
  <D.14108>:
  pthread_mutex_unlock (&mono_processes_mutex);
  goto <D.13882>;
  <D.14109>:
  <D.14107>:
  goto <D.14110>;
  <D.14104>:
  mp = candidate->next;
  D.14111 = &candidate->exit_sem;
  sem_destroy (D.14111);
  monoeg_g_free (candidate);
  candidate = 0B;
  <D.14110>:
  pthread_mutex_unlock (&mono_processes_mutex);
  // predicted unlikely by continue predictor.
  goto <D.13883>;
  <D.14089>:
  spin = 0;
  prev = mp;
  mp = mp->next;
  <D.13883>:
  if (mp != 0B) goto <D.13884>; else goto <D.13882>;
  <D.13882>:
  InterlockedDecrement (&mono_processes_cleaning_up);
}


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

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


mono_memory_barrier ()
{
  __sync_synchronize ();
}


ShellExecuteEx (struct WapiShellExecuteInfo * sei)
{
  gboolean D.14120;
  const gunichar2 * D.14121;
  const gunichar2 * utf16_quote.11;
  const gunichar2 * iftmp.12;
  const gunichar2 * D.14126;
  const gunichar2 * D.14132;
  unsigned int D.14135;
  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.14164;
  void * D.14167;
  <unnamed type> D.14168;
  unsigned int D.14169;
  gboolean ret;
  struct WapiProcessInformation process_info;
  gunichar2 * args;

  try
    {
      if (sei == 0B) goto <D.14118>; else goto <D.14119>;
      <D.14118>:
      SetLastError (87);
      D.14120 = 0;
      return D.14120;
      <D.14119>:
      D.14121 = sei->lpFile;
      if (D.14121 == 0B) goto <D.14122>; else goto <D.14123>;
      <D.14122>:
      D.14120 = 1;
      return D.14120;
      <D.14123>:
      utf16_quote.11 = utf16_quote;
      D.14121 = sei->lpFile;
      utf16_quote.11 = utf16_quote;
      D.14126 = sei->lpParameters;
      if (D.14126 != 0B) goto <D.14127>; else goto <D.14128>;
      <D.14127>:
      iftmp.12 = utf16_space;
      goto <D.14129>;
      <D.14128>:
      iftmp.12 = 0B;
      <D.14129>:
      D.14126 = sei->lpParameters;
      args = utf16_concat (utf16_quote.11, D.14121, utf16_quote.11, iftmp.12, D.14126, 0B);
      if (args == 0B) goto <D.14130>; else goto <D.14131>;
      <D.14130>:
      SetLastError (13);
      D.14120 = 0;
      return D.14120;
      <D.14131>:
      D.14132 = sei->lpDirectory;
      ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.14132, 0B, &process_info);
      monoeg_g_free (args);
      if (ret == 0) goto <D.14133>; else goto <D.14134>;
      <D.14133>:
      D.14135 = GetLastError ();
      if (D.14135 == 14) goto <D.14136>; else goto <D.14137>;
      <D.14136>:
      D.14120 = ret;
      return D.14120;
      <D.14137>:
      <D.14134>:
      if (ret == 0) goto <D.14138>; else goto <D.14139>;
      <D.14138>:
      {
        static char * handler;
        static gunichar2 * handler_utf16;

        handler_utf16.13 = handler_utf16;
        if (handler_utf16.13 == 4294967295B) goto <D.14141>; else goto <D.14142>;
        <D.14141>:
        D.14120 = 0;
        return D.14120;
        <D.14142>:
        handler.14 = monoeg_g_find_program_in_path ("xdg-open");
        handler = handler.14;
        handler.15 = handler;
        if (handler.15 == 0B) goto <D.14145>; else goto <D.14146>;
        <D.14145>:
        handler.16 = monoeg_g_find_program_in_path ("gnome-open");
        handler = handler.16;
        handler.15 = handler;
        if (handler.15 == 0B) goto <D.14148>; else goto <D.14149>;
        <D.14148>:
        handler.17 = monoeg_g_find_program_in_path ("kfmclient");
        handler = handler.17;
        handler.15 = handler;
        if (handler.15 == 0B) goto <D.14151>; else goto <D.14152>;
        <D.14151>:
        handler_utf16 = 4294967295B;
        D.14120 = 0;
        return D.14120;
        <D.14152>:
        {
          char * old;

          old = handler;
          handler.18 = monoeg_g_strconcat (old, " exec", 0B);
          handler = handler.18;
          monoeg_g_free (old);
        }
        <D.14149>:
        <D.14146>:
        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.14121 = sei->lpFile;
        utf16_quote.11 = utf16_quote;
        D.14126 = sei->lpParameters;
        if (D.14126 != 0B) goto <D.14157>; else goto <D.14158>;
        <D.14157>:
        iftmp.21 = utf16_space;
        goto <D.14159>;
        <D.14158>:
        iftmp.21 = 0B;
        <D.14159>:
        D.14126 = sei->lpParameters;
        args = utf16_concat (handler_utf16.13, utf16_space.20, utf16_quote.11, D.14121, utf16_quote.11, iftmp.21, D.14126, 0B);
        if (args == 0B) goto <D.14160>; else goto <D.14161>;
        <D.14160>:
        SetLastError (13);
        D.14120 = 0;
        return D.14120;
        <D.14161>:
        D.14132 = sei->lpDirectory;
        ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.14132, 0B, &process_info);
        monoeg_g_free (args);
        if (ret == 0) goto <D.14162>; else goto <D.14163>;
        <D.14162>:
        D.14164 = GetLastError ();
        if (D.14164 != 14) goto <D.14165>; else goto <D.14166>;
        <D.14165>:
        SetLastError (13);
        <D.14166>:
        D.14120 = 0;
        return D.14120;
        <D.14163>:
        D.14167 = process_info.hProcess;
        CloseHandle (D.14167);
        process_info.hProcess = 0B;
      }
      <D.14139>:
      D.14168 = sei->fMask;
      D.14169 = D.14168 & 64;
      if (D.14169 != 0) goto <D.14170>; else goto <D.14171>;
      <D.14170>:
      D.14167 = process_info.hProcess;
      sei->hProcess = D.14167;
      goto <D.14172>;
      <D.14171>:
      D.14167 = process_info.hProcess;
      CloseHandle (D.14167);
      <D.14172>:
      D.14120 = ret;
      return D.14120;
    }
  finally
    {
      process_info = {CLOBBER};
    }
}


utf16_concat (const gunichar2 * first)
{
  int D.14175;
  void * D.14176;
  void * D.14177;
  int D.14178;
  void * D.14179;
  void * D.14180;
  int D.14181;
  unsigned int D.14182;
  unsigned int D.14183;
  gunichar2 * D.14186;
  unsigned int total.22;
  unsigned int D.14188;
  gunichar2 * D.14189;
  int i.23;
  unsigned int i.24;
  unsigned int D.14192;
  gunichar2 * D.14193;
  short unsigned int D.14194;
  void * D.14195;
  void * D.14196;
  int i.25;
  unsigned int i.26;
  unsigned int D.14199;
  gunichar2 * D.14200;
  short unsigned int D.14201;
  void * D.14202;
  void * D.14203;
  struct va_list args;
  int total;
  int i;
  const gunichar2 * s;
  gunichar2 * ret;

  try
    {
      total = 0;
      __builtin_va_start (&args, 0);
      D.14175 = len16 (first);
      total = D.14175 + total;
      D.14176 = args.__ap;
      D.14177 = D.14176 + 4;
      args.__ap = D.14177;
      s = MEM[(gunichar2 * *)D.14176];
      goto <D.13363>;
      <D.13362>:
      D.14178 = len16 (s);
      total = D.14178 + total;
      D.14179 = args.__ap;
      D.14180 = D.14179 + 4;
      args.__ap = D.14180;
      s = MEM[(gunichar2 * *)D.14179];
      <D.13363>:
      if (s != 0B) goto <D.13362>; else goto <D.13364>;
      <D.13364>:
      __builtin_va_end (&args);
      D.14181 = total + 1;
      D.14182 = (unsigned int) D.14181;
      D.14183 = D.14182 * 2;
      ret = monoeg_malloc (D.14183);
      if (ret == 0B) goto <D.14184>; else goto <D.14185>;
      <D.14184>:
      D.14186 = 0B;
      return D.14186;
      <D.14185>:
      total.22 = (unsigned int) total;
      D.14188 = total.22 * 2;
      D.14189 = ret + D.14188;
      *D.14189 = 0;
      i = 0;
      s = first;
      goto <D.13366>;
      <D.13365>:
      i.23 = i;
      i = i.23 + 1;
      i.24 = (unsigned int) i.23;
      D.14192 = i.24 * 2;
      D.14193 = ret + D.14192;
      D.14194 = *s;
      *D.14193 = D.14194;
      s = s + 2;
      <D.13366>:
      D.14194 = *s;
      if (D.14194 != 0) goto <D.13365>; else goto <D.13367>;
      <D.13367>:
      __builtin_va_start (&args, 0);
      D.14195 = args.__ap;
      D.14196 = D.14195 + 4;
      args.__ap = D.14196;
      s = MEM[(gunichar2 * *)D.14195];
      goto <D.13373>;
      <D.13372>:
      {
        const gunichar2 * p;

        p = s;
        goto <D.13370>;
        <D.13369>:
        i.25 = i;
        i = i.25 + 1;
        i.26 = (unsigned int) i.25;
        D.14199 = i.26 * 2;
        D.14200 = ret + D.14199;
        D.14201 = *p;
        *D.14200 = D.14201;
        p = p + 2;
        <D.13370>:
        D.14201 = *p;
        if (D.14201 != 0) goto <D.13369>; else goto <D.13371>;
        <D.13371>:
      }
      D.14202 = args.__ap;
      D.14203 = D.14202 + 4;
      args.__ap = D.14203;
      s = MEM[(gunichar2 * *)D.14202];
      <D.13373>:
      if (s != 0B) goto <D.13372>; else goto <D.13374>;
      <D.13374>:
      __builtin_va_end (&args);
      D.14186 = ret;
      return D.14186;
    }
  finally
    {
      args = {CLOBBER};
    }
}


len16 (const gunichar2 * str)
{
  const gunichar2 * str.27;
  short unsigned int D.14207;
  int D.14208;
  int len;

  len = 0;
  goto <D.13352>;
  <D.13351>:
  len = len + 1;
  <D.13352>:
  str.27 = str;
  str = str.27 + 2;
  D.14207 = *str.27;
  if (D.14207 != 0) goto <D.13351>; else goto <D.13353>;
  <D.13353>:
  D.14208 = len;
  return D.14208;
}


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.14210;

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


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.14227;
  const short unsigned int * D.14228;
  char D.14229;
  unsigned int D.14230;
  unsigned int D.14231;
  const short unsigned int * D.14232;
  short unsigned int D.14233;
  int D.14234;
  int D.14235;
  gchar * D.14238;
  char D.14239;
  const void * D.14242;
  unsigned int D.14243;
  unsigned int D.14244;
  unsigned int D.14245;
  sizetype D.14246;
  gchar * D.14247;
  char D.14248;
  int D.14251;
  int D.14255;
  char D.14259;
  _Bool D.14260;
  _Bool D.14261;
  _Bool D.14262;
  gchar * D.14265;
  char D.14266;
  sizetype D.14270;
  gchar * D.14271;
  char D.14272;
  unsigned int D.14274;
  unsigned int D.14275;
  const short unsigned int * D.14276;
  short unsigned int D.14277;
  int D.14278;
  int D.14279;
  const gchar * D.14280;
  unsigned int D.14281;
  unsigned int D.14284;
  unsigned int D.14285;
  const short unsigned int * D.14286;
  short unsigned int D.14287;
  int D.14288;
  int D.14289;
  char D.14294;
  char D.14299;
  unsigned int D.14300;
  unsigned int D.14301;
  const short unsigned int * D.14302;
  short unsigned int D.14303;
  int D.14304;
  int D.14305;
  gchar * D.14308;
  char D.14309;
  const void * D.14312;
  unsigned int D.14313;
  unsigned int D.14314;
  unsigned int D.14315;
  sizetype D.14316;
  gchar * D.14317;
  int D.14320;
  int D.14324;
  int D.14329;
  const gunichar2 * utf16_space.28;
  char D.14343;
  struct GError * gerr.29;
  gchar * D.14348;
  <unnamed type> D.14352;
  unsigned int D.14353;
  void * D.14355;
  void * D.14356;
  void * D.14357;
  void * D.14358;
  void * D.14359;
  void * D.14360;
  short unsigned int D.14365;
  unsigned int D.14366;
  unsigned int D.14367;
  unsigned int D.14368;
  gchar * * D.14369;
  gchar * D.14370;
  char * * environ.30;
  unsigned int D.14373;
  char * * D.14374;
  char * D.14375;
  gchar * D.14376;
  unsigned int handle.31;
  unsigned int D.14380;
  struct _WapiHandleUnshared * D.14381;
  unsigned int D.14382;
  unsigned int D.14383;
  unsigned int D.14384;
  gchar * D.14385;
  int D.14386;
  int D.14389;
  _Bool D.14390;
  long int D.14391;
  long int D.14392;
  int D.14399;
  int D.14404;
  int D.14405;
  int i.32;
  int D.14409;
  gchar * * argv.33;
  gchar * D.14413;
  struct _WapiHandle_process * process_handle_data.34;
  union MonoSemType * D.14417;
  int D.14418;
  int * D.14421;
  int D.14422;
  char * D.14423;
  int D.14425;
  struct MonoProcess * mono_processes.35;
  unsigned int pid.36;
  gboolean D.14448;
  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 = *.LC0;
      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.14213>; else goto <D.14214>;
      <D.14213>:
      cmd = mono_unicode_to_external (appname);
      if (cmd == 0B) goto <D.14215>; else goto <D.14216>;
      <D.14215>:
      SetLastError (3);
      goto free_strings;
      <D.14216>:
      switchDirectorySeparators (cmd);
      <D.14214>:
      if (cmdline != 0B) goto <D.14217>; else goto <D.14218>;
      <D.14217>:
      args = mono_unicode_to_external (cmdline);
      if (args == 0B) goto <D.14219>; else goto <D.14220>;
      <D.14219>:
      SetLastError (3);
      goto free_strings;
      <D.14220>:
      <D.14218>:
      if (cwd != 0B) goto <D.14221>; else goto <D.14222>;
      <D.14221>:
      dir = mono_unicode_to_external (cwd);
      if (dir == 0B) goto <D.14223>; else goto <D.14224>;
      <D.14223>:
      SetLastError (3);
      goto free_strings;
      <D.14224>:
      switchDirectorySeparators (dir);
      <D.14222>:
      if (cmd != 0B) goto <D.14225>; else goto <D.14226>;
      <D.14225>:
      {
        gchar * unquoted;

        D.14227 = __ctype_b_loc ();
        D.14228 = *D.14227;
        D.14229 = *cmd;
        D.14230 = (unsigned int) D.14229;
        D.14231 = D.14230 * 2;
        D.14232 = D.14228 + D.14231;
        D.14233 = *D.14232;
        D.14234 = (int) D.14233;
        D.14235 = D.14234 & 1024;
        if (D.14235 != 0) goto <D.14236>; else goto <D.14237>;
        <D.14236>:
        D.14238 = cmd + 1;
        D.14239 = *D.14238;
        if (D.14239 == 58) goto <D.14240>; else goto <D.14241>;
        <D.14240>:
        D.14242 = cmd + 2;
        D.14243 = strlen (cmd);
        D.14244 = D.14243 + 4294967294;
        memmove (cmd, D.14242, D.14244);
        D.14245 = strlen (cmd);
        D.14246 = D.14245 + 4294967294;
        D.14247 = cmd + D.14246;
        *D.14247 = 0;
        <D.14241>:
        <D.14237>:
        unquoted = monoeg_g_shell_unquote (cmd, 0B);
        D.14248 = *unquoted;
        if (D.14248 == 47) goto <D.14249>; else goto <D.14250>;
        <D.14249>:
        prog = monoeg_strdup (unquoted);
        D.14251 = is_executable (prog);
        if (D.14251 == 0) goto <D.14252>; else goto <D.14253>;
        <D.14252>:
        monoeg_g_free (unquoted);
        SetLastError (2);
        goto free_strings;
        <D.14253>:
        goto <D.14254>;
        <D.14250>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, unquoted);
          monoeg_g_free (curdir);
          D.14255 = is_executable (prog);
          if (D.14255 == 0) goto <D.14256>; else goto <D.14257>;
          <D.14256>:
          monoeg_g_free (unquoted);
          SetLastError (2);
          goto free_strings;
          <D.14257>:
        }
        <D.14254>:
        monoeg_g_free (unquoted);
        args_after_prog = args;
      }
      goto <D.14258>;
      <D.14226>:
      {
        gchar * token;
        char quote;

        token = 0B;
        args = monoeg_g_strchug (args);
        args_after_prog = args;
        D.14259 = *args;
        D.14260 = D.14259 == 34;
        D.14261 = D.14259 == 39;
        D.14262 = D.14260 | D.14261;
        if (D.14262 != 0) goto <D.14263>; else goto <D.14264>;
        <D.14263>:
        quote = *args;
        i = 1;
        goto <D.13470>;
        <D.13469>:
        i = i + 1;
        <D.13470>:
        D.14265 = args + i;
        D.14266 = *D.14265;
        if (D.14266 != 0) goto <D.14267>; else goto <D.13471>;
        <D.14267>:
        D.14265 = args + i;
        D.14266 = *D.14265;
        if (D.14266 != quote) goto <D.13469>; else goto <D.13471>;
        <D.13471>:
        D.14270 = i + 1;
        D.14271 = args + D.14270;
        D.14272 = *D.14271;
        if (D.14272 == 0) goto <D.14268>; else goto <D.14273>;
        <D.14273>:
        D.14227 = __ctype_b_loc ();
        D.14228 = *D.14227;
        D.14270 = i + 1;
        D.14271 = args + D.14270;
        D.14272 = *D.14271;
        D.14274 = (unsigned int) D.14272;
        D.14275 = D.14274 * 2;
        D.14276 = D.14228 + D.14275;
        D.14277 = *D.14276;
        D.14278 = (int) D.14277;
        D.14279 = D.14278 & 8192;
        if (D.14279 != 0) goto <D.14268>; else goto <D.14269>;
        <D.14268>:
        D.14280 = args + 1;
        D.14281 = i + 4294967295;
        token = monoeg_g_strndup (D.14280, D.14281);
        D.14270 = i + 1;
        D.14271 = args + D.14270;
        args_after_prog = monoeg_g_strchug (D.14271);
        <D.14269>:
        <D.14264>:
        if (token == 0B) goto <D.14282>; else goto <D.14283>;
        <D.14282>:
        i = 0;
        goto <D.13474>;
        <D.13473>:
        D.14227 = __ctype_b_loc ();
        D.14228 = *D.14227;
        D.14265 = args + i;
        D.14266 = *D.14265;
        D.14284 = (unsigned int) D.14266;
        D.14285 = D.14284 * 2;
        D.14286 = D.14228 + D.14285;
        D.14287 = *D.14286;
        D.14288 = (int) D.14287;
        D.14289 = D.14288 & 8192;
        if (D.14289 != 0) goto <D.14290>; else goto <D.14291>;
        <D.14290>:
        token = monoeg_g_strndup (args, i);
        D.14270 = i + 1;
        args_after_prog = args + D.14270;
        goto <D.13472>;
        <D.14291>:
        i = i + 1;
        <D.13474>:
        D.14265 = args + i;
        D.14266 = *D.14265;
        if (D.14266 != 0) goto <D.13473>; else goto <D.13472>;
        <D.13472>:
        <D.14283>:
        if (token == 0B) goto <D.14292>; else goto <D.14293>;
        <D.14292>:
        D.14294 = *args;
        if (D.14294 != 0) goto <D.14295>; else goto <D.14296>;
        <D.14295>:
        token = monoeg_strdup (args);
        args_after_prog = 0B;
        <D.14296>:
        <D.14293>:
        if (token == 0B) goto <D.14297>; else goto <D.14298>;
        <D.14297>:
        SetLastError (3);
        goto free_strings;
        <D.14298>:
        switchDirectorySeparators (token);
        D.14227 = __ctype_b_loc ();
        D.14228 = *D.14227;
        D.14299 = *token;
        D.14300 = (unsigned int) D.14299;
        D.14301 = D.14300 * 2;
        D.14302 = D.14228 + D.14301;
        D.14303 = *D.14302;
        D.14304 = (int) D.14303;
        D.14305 = D.14304 & 1024;
        if (D.14305 != 0) goto <D.14306>; else goto <D.14307>;
        <D.14306>:
        D.14308 = token + 1;
        D.14309 = *D.14308;
        if (D.14309 == 58) goto <D.14310>; else goto <D.14311>;
        <D.14310>:
        D.14312 = token + 2;
        D.14313 = strlen (token);
        D.14314 = D.14313 + 4294967294;
        memmove (token, D.14312, D.14314);
        D.14315 = strlen (token);
        D.14316 = D.14315 + 4294967294;
        D.14317 = token + D.14316;
        *D.14317 = 0;
        <D.14311>:
        <D.14307>:
        D.14299 = *token;
        if (D.14299 == 47) goto <D.14318>; else goto <D.14319>;
        <D.14318>:
        prog = monoeg_strdup (token);
        D.14320 = is_executable (prog);
        if (D.14320 == 0) goto <D.14321>; else goto <D.14322>;
        <D.14321>:
        monoeg_g_free (token);
        SetLastError (2);
        goto free_strings;
        <D.14322>:
        goto <D.14323>;
        <D.14319>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, token);
          monoeg_g_free (curdir);
          D.14324 = is_executable (prog);
          if (D.14324 == 0) goto <D.14325>; else goto <D.14326>;
          <D.14325>:
          monoeg_g_free (prog);
          prog = monoeg_g_find_program_in_path (token);
          if (prog == 0B) goto <D.14327>; else goto <D.14328>;
          <D.14327>:
          monoeg_g_free (token);
          SetLastError (2);
          goto free_strings;
          <D.14328>:
          <D.14326>:
        }
        <D.14323>:
        monoeg_g_free (token);
      }
      <D.14258>:
      D.14329 = is_managed_binary (prog);
      if (D.14329 != 0) goto <D.14330>; else goto <D.14331>;
      <D.14330>:
      {
        gunichar2 * newapp;
        gunichar2 * newcmd;
        gsize bytes_ignored;

        try
          {
            newapp = mono_unicode_from_external ("mono", &bytes_ignored);
            if (newapp != 0B) goto <D.14332>; else goto <D.14333>;
            <D.14332>:
            if (appname != 0B) goto <D.14334>; else goto <D.14335>;
            <D.14334>:
            utf16_space.28 = utf16_space;
            utf16_space.28 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.28, appname, utf16_space.28, cmdline, 0B);
            goto <D.14337>;
            <D.14335>:
            utf16_space.28 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.28, cmdline, 0B);
            <D.14337>:
            monoeg_g_free (newapp);
            if (newcmd != 0B) goto <D.14338>; else goto <D.14339>;
            <D.14338>:
            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.14339>:
            <D.14333>:
          }
        finally
          {
            bytes_ignored = {CLOBBER};
          }
      }
      <D.14331>:
      if (args_after_prog != 0B) goto <D.14342>; else goto <D.14340>;
      <D.14342>:
      D.14343 = *args_after_prog;
      if (D.14343 != 0) goto <D.14344>; else goto <D.14340>;
      <D.14344>:
      {
        gchar * qprog;

        qprog = monoeg_g_shell_quote (prog);
        full_prog = monoeg_g_strconcat (qprog, " ", args_after_prog, 0B);
        monoeg_g_free (qprog);
      }
      goto <D.14341>;
      <D.14340>:
      full_prog = monoeg_g_shell_quote (prog);
      <D.14341>:
      ret = monoeg_g_shell_parse_argv (full_prog, 0B, &argv, &gerr);
      if (ret == 0) goto <D.14345>; else goto <D.14346>;
      <D.14345>:
      gerr.29 = gerr;
      D.14348 = gerr.29->message;
      monoeg_g_log (0B, 32, "CreateProcess: %s\n", D.14348);
      gerr.29 = gerr;
      monoeg_g_error_free (gerr.29);
      gerr = 0B;
      goto free_strings;
      <D.14346>:
      if (startup != 0B) goto <D.14351>; else goto <D.14349>;
      <D.14351>:
      D.14352 = startup->dwFlags;
      D.14353 = D.14352 & 256;
      if (D.14353 != 0) goto <D.14354>; else goto <D.14349>;
      <D.14354>:
      D.14355 = startup->hStdInput;
      in_fd = (int) D.14355;
      D.14356 = startup->hStdOutput;
      out_fd = (int) D.14356;
      D.14357 = startup->hStdError;
      err_fd = (int) D.14357;
      goto <D.14350>;
      <D.14349>:
      D.14358 = GetStdHandle (-10);
      in_fd = (int) D.14358;
      D.14359 = GetStdHandle (-11);
      out_fd = (int) D.14359;
      D.14360 = GetStdHandle (-12);
      err_fd = (int) D.14360;
      <D.14350>:
      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.14361>; else goto <D.14362>;
      <D.14361>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      ret = 0;
      SetLastError (14);
      goto free_strings;
      <D.14362>:
      if (new_environ != 0B) goto <D.14363>; else goto <D.14364>;
      <D.14363>:
      {
        gunichar2 * new_environp;

        new_environp = new_environ;
        goto <D.13486>;
        <D.13485>:
        env_count = env_count + 1;
        goto <D.13483>;
        <D.13482>:
        new_environp = new_environp + 2;
        <D.13483>:
        D.14365 = *new_environp;
        if (D.14365 != 0) goto <D.13482>; else goto <D.13484>;
        <D.13484>:
        new_environp = new_environp + 2;
        <D.13486>:
        D.14365 = *new_environp;
        if (D.14365 != 0) goto <D.13485>; else goto <D.13487>;
        <D.13487>:
        D.14366 = env_count + 2;
        D.14367 = D.14366 * 4;
        env_strings = monoeg_malloc0 (D.14367);
        env_count = 0;
        new_environp = new_environ;
        goto <D.13492>;
        <D.13491>:
        D.14368 = env_count * 4;
        D.14369 = env_strings + D.14368;
        D.14370 = mono_unicode_to_external (new_environp);
        *D.14369 = D.14370;
        env_count = env_count + 1;
        goto <D.13489>;
        <D.13488>:
        new_environp = new_environp + 2;
        <D.13489>:
        D.14365 = *new_environp;
        if (D.14365 != 0) goto <D.13488>; else goto <D.13490>;
        <D.13490>:
        new_environp = new_environp + 2;
        <D.13492>:
        D.14365 = *new_environp;
        if (D.14365 != 0) goto <D.13491>; else goto <D.13493>;
        <D.13493>:
      }
      goto <D.14371>;
      <D.14364>:
      i = 0;
      goto <D.13495>;
      <D.13494>:
      env_count = env_count + 1;
      i = i + 1;
      <D.13495>:
      environ.30 = environ;
      D.14373 = i * 4;
      D.14374 = environ.30 + D.14373;
      D.14375 = *D.14374;
      if (D.14375 != 0B) goto <D.13494>; else goto <D.13496>;
      <D.13496>:
      D.14366 = env_count + 2;
      D.14367 = D.14366 * 4;
      env_strings = monoeg_malloc0 (D.14367);
      env_count = 0;
      i = 0;
      goto <D.13498>;
      <D.13497>:
      D.14368 = env_count * 4;
      D.14369 = env_strings + D.14368;
      environ.30 = environ;
      D.14373 = i * 4;
      D.14374 = environ.30 + D.14373;
      D.14375 = *D.14374;
      D.14376 = monoeg_strdup (D.14375);
      *D.14369 = D.14376;
      env_count = env_count + 1;
      i = i + 1;
      <D.13498>:
      environ.30 = environ;
      D.14373 = i * 4;
      D.14374 = environ.30 + D.14373;
      D.14375 = *D.14374;
      if (D.14375 != 0B) goto <D.13497>; else goto <D.13499>;
      <D.13499>:
      <D.14371>:
      if (env_strings != 0B) goto <D.14377>; else goto <D.14378>;
      <D.14377>:
      {
        struct _WapiHandleUnshared * handle_data;
        struct _WapiHandle_shared_ref * ref;

        handle.31 = (unsigned int) handle;
        D.14380 = handle.31 / 256;
        D.14381 = _wapi_private_handles[D.14380];
        handle.31 = (unsigned int) handle;
        D.14382 = handle.31 & 255;
        D.14383 = D.14382 * 144;
        handle_data = D.14381 + D.14383;
        ref = &handle_data->u.shared;
        D.14368 = env_count * 4;
        D.14369 = env_strings + D.14368;
        D.14384 = ref->offset;
        D.14385 = monoeg_g_strdup_printf ("_WAPI_PROCESS_HANDLE_OFFSET=%d", D.14384);
        *D.14369 = D.14385;
      }
      <D.14378>:
      D.14386 = pipe (&startup_pipe);
      if (D.14386 == -1) goto <D.14387>; else goto <D.14388>;
      <D.14387>:
      startup_pipe[1] = -1;
      D.14389 = startup_pipe[1];
      startup_pipe[0] = D.14389;
      <D.14388>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.14390 = thr_ret != 0;
      D.14391 = (long int) D.14390;
      D.14392 = __builtin_expect (D.14391, 0);
      if (D.14392 != 0) goto <D.14393>; else goto <D.14394>;
      <D.14393>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 965, "thr_ret == 0");
      <D.14394>:
      pid = fork ();
      if (pid == -1) goto <D.14395>; else goto <D.14396>;
      <D.14395>:
      SetLastError (14);
      ret = 0;
      fork_failed = 1;
      goto cleanup;
      <D.14396>:
      if (pid == 0) goto <D.14397>; else goto <D.14398>;
      <D.14397>:
      D.14399 = startup_pipe[0];
      if (D.14399 != -1) goto <D.14400>; else goto <D.14401>;
      <D.14400>:
      {
        ssize_t _i;

        D.14399 = startup_pipe[0];
        _i = read (D.14399, &dummy, 1);
        D.14399 = startup_pipe[0];
        close (D.14399);
        D.14389 = startup_pipe[1];
        close (D.14389);
      }
      <D.14401>:
      dup2 (in_fd, 0);
      dup2 (out_fd, 1);
      dup2 (err_fd, 2);
      if (inherit_handles != 1) goto <D.14402>; else goto <D.14403>;
      <D.14402>:
      <D.14403>:
      D.14404 = getdtablesize ();
      D.14405 = D.14404 + -1;
      i = (guint32) D.14405;
      goto <D.13505>;
      <D.13504>:
      i.32 = (int) i;
      close (i.32);
      i = i + 4294967295;
      <D.13505>:
      if (i > 2) goto <D.13504>; else goto <D.13506>;
      <D.13506>:
      if (dir != 0B) goto <D.14407>; else goto <D.14408>;
      <D.14407>:
      D.14409 = chdir (dir);
      if (D.14409 == -1) goto <D.14410>; else goto <D.14411>;
      <D.14410>:
      _exit (-1);
      <D.14411>:
      <D.14408>:
      argv.33 = argv;
      D.14413 = *argv.33;
      argv.33 = argv;
      execve (D.14413, argv.33, env_strings);
      _exit (-1);
      <D.14398>:
      ret = _wapi_lookup_handle (handle, 9, &process_handle_data);
      if (ret == 0) goto <D.14414>; else goto <D.14415>;
      <D.14414>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      _wapi_handle_unref (handle);
      goto cleanup;
      <D.14415>:
      process_handle_data.34 = process_handle_data;
      process_handle_data.34->id = pid;
      mono_process = monoeg_malloc0 (36);
      mono_process->pid = pid;
      mono_process->handle_count = 1;
      D.14417 = &mono_process->exit_sem;
      D.14418 = sem_init (D.14417, 0, 0);
      if (D.14418 != 0) goto <D.14419>; else goto <D.14420>;
      <D.14419>:
      D.14421 = __errno_location ();
      D.14422 = *D.14421;
      D.14423 = strerror (D.14422);
      monoeg_g_log (0B, 16, "%s: could not create exit semaphore for process.", D.14423);
      monoeg_g_free (mono_process);
      goto <D.14424>;
      <D.14420>:
      _wapi_handle_ref (handle);
      mono_process->handle = handle;
      process_handle_data.34 = process_handle_data;
      D.14425 = _wapi_getpid ();
      process_handle_data.34->self = D.14425;
      process_handle_data.34 = process_handle_data;
      process_handle_data.34->mono_process = mono_process;
      pthread_mutex_lock (&mono_processes_mutex);
      mono_processes.35 = mono_processes;
      mono_process->next = mono_processes.35;
      mono_processes = mono_process;
      pthread_mutex_unlock (&mono_processes_mutex);
      <D.14424>:
      if (process_info != 0B) goto <D.14427>; else goto <D.14428>;
      <D.14427>:
      process_info->hProcess = handle;
      pid.36 = (unsigned int) pid;
      process_info->dwProcessId = pid.36;
      process_info->hThread = 4294967295B;
      process_info->dwThreadId = 0;
      <D.14428>:
      cleanup:
      _wapi_handle_unlock_shared_handles ();
      if (fork_failed != 0) goto <D.14430>; else goto <D.14431>;
      <D.14430>:
      _wapi_handle_unref (handle);
      <D.14431>:
      D.14389 = startup_pipe[1];
      if (D.14389 != -1) goto <D.14432>; else goto <D.14433>;
      <D.14432>:
      {
        ssize_t _i;

        D.14389 = startup_pipe[1];
        _i = write (D.14389, &startup_pipe, 1);
        D.14399 = startup_pipe[0];
        close (D.14399);
        D.14389 = startup_pipe[1];
        close (D.14389);
      }
      <D.14433>:
      free_strings:
      if (cmd != 0B) goto <D.14434>; else goto <D.14435>;
      <D.14434>:
      monoeg_g_free (cmd);
      <D.14435>:
      if (full_prog != 0B) goto <D.14436>; else goto <D.14437>;
      <D.14436>:
      monoeg_g_free (full_prog);
      <D.14437>:
      if (prog != 0B) goto <D.14438>; else goto <D.14439>;
      <D.14438>:
      monoeg_g_free (prog);
      <D.14439>:
      if (args != 0B) goto <D.14440>; else goto <D.14441>;
      <D.14440>:
      monoeg_g_free (args);
      <D.14441>:
      if (dir != 0B) goto <D.14442>; else goto <D.14443>;
      <D.14442>:
      monoeg_g_free (dir);
      <D.14443>:
      if (env_strings != 0B) goto <D.14444>; else goto <D.14445>;
      <D.14444>:
      monoeg_g_strfreev (env_strings);
      <D.14445>:
      argv.33 = argv;
      if (argv.33 != 0B) goto <D.14446>; else goto <D.14447>;
      <D.14446>:
      argv.33 = argv;
      monoeg_g_strfreev (argv.33);
      <D.14447>:
      mono_processes_cleanup ();
      D.14448 = ret;
      return D.14448;
    }
  finally
    {
      argv = {CLOBBER};
      process_handle = {CLOBBER};
      process_handle_data = {CLOBBER};
      gerr = {CLOBBER};
      startup_pipe = {CLOBBER};
      dummy = {CLOBBER};
    }
}


process_add_sigchld_handler ()
{
  int D.14453;
  _Bool D.14454;
  long int D.14455;
  long int D.14456;
  struct sigaction sa;

  try
    {
      sa.__sigaction_handler.sa_sigaction = mono_sigchld_signal_handler;
      sigemptyset (&sa.sa_mask);
      sa.sa_flags = 5;
      D.14453 = sigaction (17, &sa, &previous_chld_sa);
      D.14454 = D.14453 == -1;
      D.14455 = (long int) D.14454;
      D.14456 = __builtin_expect (D.14455, 0);
      if (D.14456 != 0) goto <D.14457>; else goto <D.14458>;
      <D.14457>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 2887, "sigaction (SIGCHLD, &sa, &previous_chld_sa) != -1");
      <D.14458>:
    }
  finally
    {
      sa = {CLOBBER};
    }
}


mono_sigchld_signal_handler (int _dummy, struct siginfo_t * info, void * context)
{
  int * D.14460;
  int D.14461;
  int D.14463;
  int status.37;
  union MonoSemType * D.14467;
  int status;
  int pid;
  struct MonoProcess * p;

  try
    {
      InterlockedIncrement (&mono_processes_read_lock);
      <D.13904>:
      <D.13898>:
      pid = waitpid (-1, &status, 1);
      if (pid == -1) goto <D.14459>; else goto <D.13899>;
      <D.14459>:
      D.14460 = __errno_location ();
      D.14461 = *D.14460;
      if (D.14461 == 4) goto <D.13898>; else goto <D.13899>;
      <D.13899>:
      if (pid <= 0) goto <D.13900>; else goto <D.14462>;
      <D.14462>:
      p = mono_processes;
      goto <D.13903>;
      <D.13902>:
      D.14463 = p->pid;
      if (D.14463 == pid) goto <D.14464>; else goto <D.14465>;
      <D.14464>:
      p->pid = 0;
      status.37 = status;
      p->status = status.37;
      D.14467 = &p->exit_sem;
      mono_sem_post (D.14467);
      goto <D.13901>;
      <D.14465>:
      p = p->next;
      <D.13903>:
      if (p != 0B) goto <D.13902>; else goto <D.13901>;
      <D.13901>:
      goto <D.13904>;
      <D.13900>:
      InterlockedDecrement (&mono_processes_read_lock);
    }
  finally
    {
      status = {CLOBBER};
    }
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.14468;
  unsigned int D.14469;

  D.14469 = __sync_add_and_fetch_4 (val, 1);
  D.14468 = (gint32) D.14469;
  return D.14468;
}


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


switchDirectorySeparators (gchar * path)
{
  gchar * D.14471;
  char D.14472;
  unsigned int D.14475;
  sizetype D.14478;
  gchar * D.14479;
  char D.14480;
  size_t i;
  size_t pathLength;

  pathLength = strlen (path);
  i = 0;
  goto <D.13426>;
  <D.13425>:
  D.14471 = path + i;
  D.14472 = *D.14471;
  if (D.14472 == 92) goto <D.14473>; else goto <D.14474>;
  <D.14473>:
  D.14475 = pathLength + 4294967295;
  if (D.14475 > i) goto <D.14476>; else goto <D.14477>;
  <D.14476>:
  D.14478 = i + 1;
  D.14479 = path + D.14478;
  D.14480 = *D.14479;
  if (D.14480 != 39) goto <D.14481>; else goto <D.14482>;
  <D.14481>:
  D.14471 = path + i;
  *D.14471 = 47;
  <D.14482>:
  <D.14477>:
  <D.14474>:
  i = i + 1;
  <D.13426>:
  if (i < pathLength) goto <D.13425>; else goto <D.13427>;
  <D.13427>:
}


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

  D.14484 = __builtin_object_size (__dest, 0);
  D.14483 = __builtin___memmove_chk (__dest, __src, __len, D.14484);
  return D.14483;
}


is_executable (const char * prog)
{
  int D.14486;
  gboolean D.14489;
  int D.14490;
  unsigned int D.14493;
  unsigned int D.14494;
  struct stat buf;

  try
    {
      D.14486 = access (prog, 1);
      if (D.14486 != 0) goto <D.14487>; else goto <D.14488>;
      <D.14487>:
      D.14489 = 0;
      return D.14489;
      <D.14488>:
      D.14490 = stat (prog, &buf);
      if (D.14490 != 0) goto <D.14491>; else goto <D.14492>;
      <D.14491>:
      D.14489 = 0;
      return D.14489;
      <D.14492>:
      D.14493 = buf.st_mode;
      D.14494 = D.14493 & 61440;
      if (D.14494 == 32768) goto <D.14495>; else goto <D.14496>;
      <D.14495>:
      D.14489 = 1;
      return D.14489;
      <D.14496>:
      D.14489 = 0;
      return D.14489;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


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

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


is_managed_binary (const gchar * filename)
{
  int * D.14501;
  gboolean D.14504;
  unsigned char D.14507;
  unsigned char D.14509;
  int D.14513;
  int D.14514;
  int D.14515;
  int D.14516;
  unsigned char D.14517;
  int D.14518;
  int D.14519;
  int D.14520;
  unsigned char D.14521;
  int D.14522;
  int D.14523;
  int D.14524;
  long long int D.14525;
  long long int D.14533;
  long long int D.14537;
  unsigned char * D.14539;
  unsigned char * D.14540;
  _Bool D.14541;
  _Bool D.14542;
  _Bool D.14543;
  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.14501 = __errno_location ();
      original_errno = *D.14501;
      file = open (filename, 131072);
      managed = 0;
      if (file < 0) goto <D.14502>; else goto <D.14503>;
      <D.14502>:
      D.14501 = __errno_location ();
      *D.14501 = original_errno;
      D.14504 = 0;
      return D.14504;
      <D.14503>:
      file_size = lseek (file, 0, 2);
      lseek (file, 0, 0);
      if (file_size <= 63) goto leave; else goto <D.14505>;
      <D.14505>:
      num_read = read (file, &buffer, 2);
      if (num_read != 2) goto leave; else goto <D.14506>;
      <D.14506>:
      D.14507 = buffer[0];
      if (D.14507 != 77) goto leave; else goto <D.14508>;
      <D.14508>:
      D.14509 = buffer[1];
      if (D.14509 != 90) goto leave; else goto <D.14510>;
      <D.14510>:
      new_offset = lseek (file, 60, 0);
      if (new_offset != 60) goto leave; else goto <D.14511>;
      <D.14511>:
      num_read = read (file, &buffer, 4);
      if (num_read != 4) goto leave; else goto <D.14512>;
      <D.14512>:
      D.14507 = buffer[0];
      D.14513 = (int) D.14507;
      D.14509 = buffer[1];
      D.14514 = (int) D.14509;
      D.14515 = D.14514 << 8;
      D.14516 = D.14513 | D.14515;
      D.14517 = buffer[2];
      D.14518 = (int) D.14517;
      D.14519 = D.14518 << 16;
      D.14520 = D.14516 | D.14519;
      D.14521 = buffer[3];
      D.14522 = (int) D.14521;
      D.14523 = D.14522 << 24;
      D.14524 = D.14520 | D.14523;
      pe_header_offset = (off_t) D.14524;
      D.14525 = pe_header_offset + 23;
      if (D.14525 >= file_size) goto leave; else goto <D.14526>;
      <D.14526>:
      new_offset = lseek (file, pe_header_offset, 0);
      if (new_offset != pe_header_offset) goto leave; else goto <D.14527>;
      <D.14527>:
      num_read = read (file, &buffer, 4);
      if (num_read != 4) goto leave; else goto <D.14528>;
      <D.14528>:
      D.14507 = buffer[0];
      if (D.14507 != 80) goto leave; else goto <D.14529>;
      <D.14529>:
      D.14509 = buffer[1];
      if (D.14509 != 69) goto leave; else goto <D.14530>;
      <D.14530>:
      D.14517 = buffer[2];
      if (D.14517 != 0) goto leave; else goto <D.14531>;
      <D.14531>:
      D.14521 = buffer[3];
      if (D.14521 != 0) goto leave; else goto <D.14532>;
      <D.14532>:
      D.14533 = pe_header_offset + 20;
      new_offset = lseek (file, D.14533, 0);
      D.14533 = pe_header_offset + 20;
      if (D.14533 != new_offset) goto leave; else goto <D.14534>;
      <D.14534>:
      num_read = read (file, &buffer, 2);
      if (num_read != 2) goto leave; else goto <D.14535>;
      <D.14535>:
      D.14507 = buffer[0];
      D.14513 = (int) D.14507;
      D.14509 = buffer[1];
      D.14514 = (int) D.14509;
      D.14515 = D.14514 << 8;
      D.14516 = D.14513 | D.14515;
      if (D.14516 <= 215) goto leave; else goto <D.14536>;
      <D.14536>:
      optional_header_offset = pe_header_offset + 24;
      D.14537 = optional_header_offset + 208;
      new_offset = lseek (file, D.14537, 0);
      D.14537 = optional_header_offset + 208;
      if (D.14537 != new_offset) goto leave; else goto <D.14538>;
      <D.14538>:
      num_read = read (file, &buffer, 8);
      D.14539 = &buffer[0];
      first_word = MEM[(guint32 *)D.14539];
      D.14540 = &buffer[4];
      second_word = MEM[(guint32 *)D.14540];
      D.14541 = num_read != 8;
      D.14542 = first_word == 0;
      D.14543 = D.14541 | D.14542;
      if (D.14543 != 0) goto leave; else goto <D.14544>;
      <D.14544>:
      if (second_word == 0) goto leave; else goto <D.14545>;
      <D.14545>:
      managed = 1;
      leave:
      close (file);
      D.14501 = __errno_location ();
      *D.14501 = original_errno;
      D.14504 = managed;
      return D.14504;
    }
  finally
    {
      buffer = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.14548;
  int D.14551;
  int D.14556;
  int D.14558;
  int D.14559;
  int D.14562;
  int D.14563;

  D.14548 = __builtin_va_arg_pack_len ();
  if (D.14548 > 1) goto <D.14549>; else goto <D.14550>;
  <D.14549>:
  __open_too_many_args ();
  <D.14550>:
  D.14551 = __builtin_constant_p (__oflag);
  if (D.14551 != 0) goto <D.14552>; else goto <D.14553>;
  <D.14552>:
  D.14556 = __oflag & 64;
  if (D.14556 != 0) goto <D.14554>; else goto <D.14557>;
  <D.14557>:
  D.14558 = __oflag & 4210688;
  if (D.14558 == 4210688) goto <D.14554>; else goto <D.14555>;
  <D.14554>:
  D.14559 = __builtin_va_arg_pack_len ();
  if (D.14559 <= 0) goto <D.14560>; else goto <D.14561>;
  <D.14560>:
  __open_missing_mode ();
  D.14562 = __open_2 (__path, __oflag);
  return D.14562;
  <D.14561>:
  <D.14555>:
  D.14562 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.14562;
  <D.14553>:
  D.14563 = __builtin_va_arg_pack_len ();
  if (D.14563 <= 0) goto <D.14564>; else goto <D.14565>;
  <D.14564>:
  D.14562 = __open_2 (__path, __oflag);
  return D.14562;
  <D.14565>:
  D.14562 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.14562;
}


process_set_defaults (struct _WapiHandle_process * process_handle)
{
  long int D.14567;
  struct WapiFileTime * D.14568;

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


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

  if (str != 0B) goto <D.14569>; else goto <D.14570>;
  <D.14569>:
  D.14571 = __strdup (str);
  return D.14571;
  <D.14570>:
  D.14571 = 0B;
  return D.14571;
}


read (int __fd, void * __buf, size_t __nbytes)
{
  unsigned int D.14573;
  int D.14576;
  ssize_t D.14579;
  unsigned int D.14580;
  unsigned int D.14581;
  unsigned int D.14584;

  D.14573 = __builtin_object_size (__buf, 0);
  if (D.14573 != 4294967295) goto <D.14574>; else goto <D.14575>;
  <D.14574>:
  D.14576 = __builtin_constant_p (__nbytes);
  if (D.14576 == 0) goto <D.14577>; else goto <D.14578>;
  <D.14577>:
  D.14580 = __builtin_object_size (__buf, 0);
  D.14579 = __read_chk (__fd, __buf, __nbytes, D.14580);
  return D.14579;
  <D.14578>:
  D.14581 = __builtin_object_size (__buf, 0);
  if (D.14581 < __nbytes) goto <D.14582>; else goto <D.14583>;
  <D.14582>:
  D.14584 = __builtin_object_size (__buf, 0);
  D.14579 = __read_chk_warn (__fd, __buf, __nbytes, D.14584);
  return D.14579;
  <D.14583>:
  <D.14575>:
  D.14579 = __read_alias (__fd, __buf, __nbytes);
  return D.14579;
}


_wapi_process_duplicate ()
{
  void * current_process.38;
  void * D.14587;

  mono_once (&process_current_once, process_set_current);
  current_process.38 = current_process;
  _wapi_handle_ref (current_process.38);
  D.14587 = current_process;
  return D.14587;
}


process_set_current ()
{
  int D.14591;
  unsigned int D.14592;
  void * current_process.39;
  void * current_process.40;
  struct _WapiHandle_process * process_handlep.41;
  int D.14598;
  int D.13534;
  int iftmp.42;
  int D.13533;
  const char[5] * D.14604;
  unsigned char D.14605;
  int D.14606;
  unsigned char D.14607;
  int D.14608;
  _Bool D.14609;
  _Bool D.14610;
  _Bool D.14611;
  const unsigned char * D.14614;
  unsigned char D.14615;
  int D.14616;
  const unsigned char * D.14617;
  unsigned char D.14618;
  int D.14619;
  _Bool D.14620;
  _Bool D.14621;
  const unsigned char * D.14624;
  unsigned char D.14625;
  int D.14626;
  const unsigned char * D.14627;
  unsigned char D.14628;
  int D.14629;
  _Bool D.14630;
  _Bool D.14631;
  const unsigned char * D.14634;
  unsigned char D.14635;
  int D.14636;
  const unsigned char * D.14637;
  unsigned char D.14638;
  int D.14639;
  void * current_process.43;
  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.14589>; else goto <D.14590>;
      <D.14589>:
      {
        struct _WapiHandle_process * process_handlep;
        gchar * procname;
        gboolean ok;

        try
          {
            procname = 0B;
            D.14591 = atoi (handle_env);
            D.14592 = (unsigned int) D.14591;
            current_process.39 = _wapi_handle_new_from_offset (9, D.14592, 1);
            current_process = current_process.39;
            current_process.40 = current_process;
            ok = _wapi_lookup_handle (current_process.40, 9, &process_handlep);
            if (ok != 0) goto <D.14595>; else goto <D.14596>;
            <D.14595>:
            process_handlep.41 = process_handlep;
            D.14598 = process_handlep.41->id;
            if (D.14598 == pid) goto <D.14599>; else goto <D.14600>;
            <D.14599>:
            process_handlep.41 = process_handlep;
            procname = &process_handlep.41->proc_name;
            {
              size_t __s1_len;
              size_t __s2_len;

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

                __s2 = procname;
                D.14604 = "mono";
                D.14605 = MEM[(const unsigned char *)D.14604];
                D.14606 = (int) D.14605;
                D.14607 = *__s2;
                D.14608 = (int) D.14607;
                __result = D.14606 - D.14608;
                {
                  D.14609 = __s2_len != 0;
                  D.14610 = __result == 0;
                  D.14611 = D.14609 & D.14610;
                  if (D.14611 != 0) goto <D.14612>; else goto <D.14613>;
                  <D.14612>:
                  D.14614 = &MEM[(void *)"mono" + 1B];
                  D.14615 = *D.14614;
                  D.14616 = (int) D.14615;
                  D.14617 = __s2 + 1;
                  D.14618 = *D.14617;
                  D.14619 = (int) D.14618;
                  __result = D.14616 - D.14619;
                  D.14620 = __s2_len > 1;
                  D.14610 = __result == 0;
                  D.14621 = D.14620 & D.14610;
                  if (D.14621 != 0) goto <D.14622>; else goto <D.14623>;
                  <D.14622>:
                  D.14624 = &MEM[(void *)"mono" + 2B];
                  D.14625 = *D.14624;
                  D.14626 = (int) D.14625;
                  D.14627 = __s2 + 2;
                  D.14628 = *D.14627;
                  D.14629 = (int) D.14628;
                  __result = D.14626 - D.14629;
                  D.14630 = __s2_len > 2;
                  D.14610 = __result == 0;
                  D.14631 = D.14630 & D.14610;
                  if (D.14631 != 0) goto <D.14632>; else goto <D.14633>;
                  <D.14632>:
                  D.14634 = &MEM[(void *)"mono" + 3B];
                  D.14635 = *D.14634;
                  D.14636 = (int) D.14635;
                  D.14637 = __s2 + 3;
                  D.14638 = *D.14637;
                  D.14639 = (int) D.14638;
                  __result = D.14636 - D.14639;
                  <D.14633>:
                  <D.14623>:
                  <D.14613>:
                }
                D.13533 = __result;
              }
              iftmp.42 = -D.13533;
              goto <D.14640>;
              <D.14603>:
              iftmp.42 = __builtin_strcmp (procname, "mono");
              <D.14640>:
              D.13534 = iftmp.42;
            }
            if (D.13534 == 0) goto <D.14641>; else goto <D.14642>;
            <D.14641>:
            process_handlep.41 = process_handlep;
            process_set_name (process_handlep.41);
            goto <D.14643>;
            <D.14642>:
            <D.14643>:
            return;
            <D.14600>:
            current_process.40 = current_process;
            _wapi_handle_unref (current_process.40);
            <D.14596>:
          }
        finally
          {
            process_handlep = {CLOBBER};
          }
      }
      <D.14590>:
      process_handle.id = pid;
      process_set_defaults (&process_handle);
      process_set_name (&process_handle);
      current_process.43 = _wapi_handle_new (9, &process_handle);
      current_process = current_process.43;
      current_process.40 = current_process;
      if (current_process.40 == 4294967295B) goto <D.14645>; else goto <D.14646>;
      <D.14645>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      return;
      <D.14646>:
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


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

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


process_set_name (struct _WapiHandle_process * process_handle)
{
  gchar[256] * D.14658;
  const gchar * D.14659;
  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.14654>; else goto <D.14655>;
  <D.14654>:
  slash = strrchr (utf8_progname, 47);
  if (slash != 0B) goto <D.14656>; else goto <D.14657>;
  <D.14656>:
  D.14658 = &process_handle->proc_name;
  D.14659 = slash + 1;
  monoeg_g_strlcpy (D.14658, D.14659, 255);
  goto <D.14660>;
  <D.14657>:
  D.14658 = &process_handle->proc_name;
  monoeg_g_strlcpy (D.14658, utf8_progname, 255);
  <D.14660>:
  monoeg_g_free (utf8_progname);
  <D.14655>:
}


GetCurrentProcess ()
{
  void * D.14661;

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


GetProcessId (void * handle)
{
  signed int handle.44;
  guint32 D.14666;
  unsigned int handle.45;
  struct _WapiHandle_process * process_handle.46;
  int D.14671;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.44 = (signed int) handle;
      if (handle.44 < 0) goto <D.14664>; else goto <D.14665>;
      <D.14664>:
      handle.45 = (unsigned int) handle;
      D.14666 = handle.45 & 2147483647;
      return D.14666;
      <D.14665>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.14668>; else goto <D.14669>;
      <D.14668>:
      SetLastError (6);
      D.14666 = 0;
      return D.14666;
      <D.14669>:
      process_handle.46 = process_handle;
      D.14671 = process_handle.46->id;
      D.14666 = (guint32) D.14671;
      return D.14666;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetCurrentProcessId ()
{
  guint32 D.14674;
  void * current_process.47;

  mono_once (&process_current_once, process_set_current);
  current_process.47 = current_process;
  D.14674 = GetProcessId (current_process.47);
  return D.14674;
}


EnumProcesses (guint32 * pids, guint32 len, guint32 * needed)
{
  gboolean D.14679;
  const short unsigned int * * D.14680;
  const short unsigned int * D.14681;
  char D.14682;
  unsigned int D.14683;
  unsigned int D.14684;
  const short unsigned int * D.14685;
  short unsigned int D.14686;
  int D.14687;
  int D.14688;
  char[256] * D.14691;
  char * endptr.48;
  char D.14693;
  unsigned int i.49;
  unsigned int D.14697;
  guint32 * D.14698;
  unsigned int pid.50;
  unsigned int D.14701;
  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.14677>; else goto <D.14678>;
  <D.14677>:
  D.14679 = 0;
  return D.14679;
  <D.14678>:
  i = 0;
  fit = len / 4;
  goto <D.13565>;
  <D.13566>:
  {
    pid_t pid;
    char * endptr;

    try
      {
        D.14680 = __ctype_b_loc ();
        D.14681 = *D.14680;
        D.14682 = entry->d_name[0];
        D.14683 = (unsigned int) D.14682;
        D.14684 = D.14683 * 2;
        D.14685 = D.14681 + D.14684;
        D.14686 = *D.14685;
        D.14687 = (int) D.14686;
        D.14688 = D.14687 & 2048;
        if (D.14688 == 0) goto <D.14689>; else goto <D.14690>;
        <D.14689>:
        // predicted unlikely by continue predictor.
        goto <D.13565>;
        <D.14690>:
        D.14691 = &entry->d_name;
        pid = strtol (D.14691, &endptr, 10);
        endptr.48 = endptr;
        D.14693 = *endptr.48;
        if (D.14693 == 0) goto <D.14694>; else goto <D.14695>;
        <D.14694>:
        i.49 = i;
        i = i.49 + 1;
        D.14697 = i.49 * 4;
        D.14698 = pids + D.14697;
        pid.50 = (unsigned int) pid;
        *D.14698 = pid.50;
        <D.14695>:
      }
    finally
      {
        endptr = {CLOBBER};
      }
  }
  <D.13565>:
  if (i < fit) goto <D.14700>; else goto <D.13567>;
  <D.14700>:
  entry = readdir (dir);
  if (entry != 0B) goto <D.13566>; else goto <D.13567>;
  <D.13567>:
  closedir (dir);
  D.14701 = i * 4;
  *needed = D.14701;
  D.14679 = 1;
  return D.14679;
}


CloseProcess (void * handle)
{
  signed int handle.51;
  gboolean D.14708;

  handle.51 = (signed int) handle;
  if (handle.51 < 0) goto <D.14706>; else goto <D.14707>;
  <D.14706>:
  D.14708 = 1;
  return D.14708;
  <D.14707>:
  D.14708 = CloseHandle (handle);
  return D.14708;
}


OpenProcess (guint32 req_access, gboolean inherit, guint32 pid)
{
  void * pid.52;
  int pid.53;
  int D.14714;
  void * D.14717;
  unsigned int D.14718;
  void * handle;

  handle = 0B;
  mono_once (&process_current_once, process_set_current);
  pid.52 = (void *) pid;
  handle = _wapi_search_handle (9, process_open_compare, pid.52, 0B, 1);
  if (handle == 0B) goto <D.14711>; else goto <D.14712>;
  <D.14711>:
  pid.53 = (int) pid;
  D.14714 = is_pid_valid (pid.53);
  if (D.14714 != 0) goto <D.14715>; else goto <D.14716>;
  <D.14715>:
  D.14718 = pid + 2147483648;
  D.14717 = (void *) D.14718;
  return D.14717;
  <D.14716>:
  SetLastError (127);
  D.14717 = 0B;
  return D.14717;
  <D.14712>:
  D.14717 = handle;
  return D.14717;
}


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

  checking_pid = signal_process_if_gone (handle);
  if (checking_pid == 0) goto <D.14720>; else goto <D.14721>;
  <D.14720>:
  D.14722 = 0;
  return D.14722;
  <D.14721>:
  wanted_pid = (pid_t) user_data;
  if (checking_pid == wanted_pid) goto <D.14724>; else goto <D.14723>;
  <D.14724>:
  D.14725 = _wapi_handle_issignalled (handle);
  if (D.14725 == 0) goto <D.14726>; else goto <D.14723>;
  <D.14726>:
  D.14722 = 1;
  return D.14722;
  <D.14723>:
  D.14722 = 0;
  return D.14722;
}


signal_process_if_gone (void * handle)
{
  signed int handle.54;
  _Bool D.14729;
  long int D.14730;
  long int D.14731;
  pid_t D.14736;
  struct _WapiHandle_process * process_handle.55;
  int D.14738;
  int D.14739;
  int * D.14742;
  int D.14743;
  _Bool D.14744;
  _Bool D.14745;
  _Bool D.14746;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.54 = (signed int) handle;
      D.14729 = handle.54 < 0;
      D.14730 = (long int) D.14729;
      D.14731 = __builtin_expect (D.14730, 0);
      if (D.14731 != 0) goto <D.14732>; else goto <D.14733>;
      <D.14732>:
      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.14733>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.14734>; else goto <D.14735>;
      <D.14734>:
      D.14736 = 0;
      return D.14736;
      <D.14735>:
      process_handle.55 = process_handle;
      D.14738 = process_handle.55->id;
      D.14739 = kill (D.14738, 0);
      if (D.14739 == -1) goto <D.14740>; else goto <D.14741>;
      <D.14740>:
      D.14742 = __errno_location ();
      D.14743 = *D.14742;
      D.14744 = D.14743 == 3;
      D.14745 = D.14743 == 1;
      D.14746 = D.14744 | D.14745;
      if (D.14746 != 0) goto <D.14747>; else goto <D.14748>;
      <D.14747>:
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.14748>:
      <D.14741>:
      process_handle.55 = process_handle;
      D.14736 = process_handle.55->id;
      return D.14736;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


_wapi_handle_issignalled (void * handle)
{
  gboolean D.14753;
  <unnamed type> D.14756;
  <unnamed type> D.14758;
  <unnamed type> D.14760;
  <unnamed type> D.14762;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.56;
  unsigned int handle.57;
  unsigned int D.14765;
  struct _WapiHandleUnshared * D.14766;
  unsigned int D.14767;
  unsigned int D.14768;
  struct _WapiHandleUnshared * D.14769;
  unsigned int D.14770;
  unsigned int D.14771;
  struct _WapiHandleUnshared * D.14772;
  unsigned int D.14773;
  unsigned int D.14774;
  struct _WapiHandleUnshared * D.14775;
  guint32 idx;

  idx = (guint32) handle;
  if (idx > 4194303) goto <D.14751>; else goto <D.14752>;
  <D.14751>:
  D.14753 = 0;
  return D.14753;
  <D.14752>:
  D.14756 = _wapi_handle_type (handle);
  if (D.14756 == 9) goto <D.14754>; else goto <D.14757>;
  <D.14757>:
  D.14758 = _wapi_handle_type (handle);
  if (D.14758 == 11) goto <D.14754>; else goto <D.14759>;
  <D.14759>:
  D.14760 = _wapi_handle_type (handle);
  if (D.14760 == 12) goto <D.14754>; else goto <D.14761>;
  <D.14761>:
  D.14762 = _wapi_handle_type (handle);
  if (D.14762 == 13) goto <D.14754>; else goto <D.14755>;
  <D.14754>:
  _wapi_shared_layout.56 = _wapi_shared_layout;
  handle.57 = (unsigned int) handle;
  D.14765 = handle.57 / 256;
  D.14766 = _wapi_private_handles[D.14765];
  handle.57 = (unsigned int) handle;
  D.14767 = handle.57 & 255;
  D.14768 = D.14767 * 144;
  D.14769 = D.14766 + D.14768;
  D.14770 = D.14769->u.shared.offset;
  D.14753 = _wapi_shared_layout.56->handles[D.14770].signalled;
  return D.14753;
  <D.14755>:
  D.14771 = idx / 256;
  D.14772 = _wapi_private_handles[D.14771];
  D.14773 = idx & 255;
  D.14774 = D.14773 * 144;
  D.14775 = D.14772 + D.14774;
  D.14753 = D.14775->signalled;
  return D.14753;
}


GetExitCodeProcess (void * process, guint32 * code)
{
  gboolean D.14779;
  unsigned int process.58;
  signed int process.59;
  int pid.60;
  int D.14785;
  int D.14790;
  struct _WapiHandle_process * process_handle.61;
  unsigned int D.14794;
  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.14777>; else goto <D.14778>;
      <D.14777>:
      D.14779 = 0;
      return D.14779;
      <D.14778>:
      process.58 = (unsigned int) process;
      pid = process.58 + 2147483648;
      process.59 = (signed int) process;
      if (process.59 < 0) goto <D.14782>; else goto <D.14783>;
      <D.14782>:
      pid.60 = (int) pid;
      D.14785 = is_pid_valid (pid.60);
      if (D.14785 != 0) goto <D.14786>; else goto <D.14787>;
      <D.14786>:
      *code = 259;
      D.14779 = 1;
      return D.14779;
      <D.14787>:
      D.14779 = 0;
      return D.14779;
      <D.14783>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.14788>; else goto <D.14789>;
      <D.14788>:
      D.14779 = 0;
      return D.14779;
      <D.14789>:
      process_wait (process, 0, 1);
      D.14790 = _wapi_handle_issignalled (process);
      if (D.14790 == 1) goto <D.14791>; else goto <D.14792>;
      <D.14791>:
      process_handle.61 = process_handle;
      D.14794 = process_handle.61->exitstatus;
      *code = D.14794;
      goto <D.14795>;
      <D.14792>:
      *code = 259;
      <D.14795>:
      D.14779 = 1;
      return D.14779;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetProcessTimes (void * process, struct WapiFileTime * create_time, struct WapiFileTime * exit_time, struct WapiFileTime * kernel_time, struct WapiFileTime * user_time)
{
  _Bool D.14800;
  _Bool D.14801;
  _Bool D.14802;
  _Bool D.14804;
  _Bool D.14805;
  _Bool D.14806;
  gboolean D.14807;
  signed int process.62;
  struct _WapiHandle_process * process_handle.63;
  int D.14814;
  int D.14817;
  int D.14818;
  int D.14821;
  long int D.14824;
  long int D.14825;
  long int D.14826;
  long int D.14827;
  long int D.14828;
  long int D.14829;
  long int D.14830;
  long int D.14831;
  long int D.14832;
  long int D.14833;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  gboolean ku_times_set;

  try
    {
      ku_times_set = 0;
      mono_once (&process_current_once, process_set_current);
      D.14800 = create_time == 0B;
      D.14801 = exit_time == 0B;
      D.14802 = D.14800 | D.14801;
      if (D.14802 != 0) goto <D.14798>; else goto <D.14803>;
      <D.14803>:
      D.14804 = kernel_time == 0B;
      D.14805 = user_time == 0B;
      D.14806 = D.14804 | D.14805;
      if (D.14806 != 0) goto <D.14798>; else goto <D.14799>;
      <D.14798>:
      D.14807 = 0;
      return D.14807;
      <D.14799>:
      process.62 = (signed int) process;
      if (process.62 < 0) goto <D.14809>; else goto <D.14810>;
      <D.14809>:
      D.14807 = 0;
      return D.14807;
      <D.14810>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.14811>; else goto <D.14812>;
      <D.14811>:
      D.14807 = 0;
      return D.14807;
      <D.14812>:
      process_handle.63 = process_handle;
      *create_time = process_handle.63->create_time;
      D.14814 = _wapi_handle_issignalled (process);
      if (D.14814 == 1) goto <D.14815>; else goto <D.14816>;
      <D.14815>:
      process_handle.63 = process_handle;
      *exit_time = process_handle.63->exit_time;
      <D.14816>:
      process_handle.63 = process_handle;
      D.14817 = process_handle.63->id;
      D.14818 = getpid ();
      if (D.14817 == D.14818) goto <D.14819>; else goto <D.14820>;
      <D.14819>:
      {
        struct rusage time_data;

        try
          {
            D.14821 = getrusage (0, &time_data);
            if (D.14821 == 0) goto <D.14822>; else goto <D.14823>;
            <D.14822>:
            {
              gint64 tick_val;
              gint64 * tick_val_ptr;

              ku_times_set = 1;
              D.14824 = time_data.ru_utime.tv_sec;
              D.14825 = D.14824 * 10000000;
              D.14826 = time_data.ru_utime.tv_usec;
              D.14827 = D.14826 * 10;
              D.14828 = D.14825 + D.14827;
              tick_val = (gint64) D.14828;
              tick_val_ptr = user_time;
              *tick_val_ptr = tick_val;
              D.14829 = time_data.ru_stime.tv_sec;
              D.14830 = D.14829 * 10000000;
              D.14831 = time_data.ru_stime.tv_usec;
              D.14832 = D.14831 * 10;
              D.14833 = D.14830 + D.14832;
              tick_val = (gint64) D.14833;
              tick_val_ptr = kernel_time;
              *tick_val_ptr = tick_val;
            }
            <D.14823>:
          }
        finally
          {
            time_data = {CLOBBER};
          }
      }
      <D.14820>:
      if (ku_times_set == 0) goto <D.14834>; else goto <D.14835>;
      <D.14834>:
      memset (kernel_time, 0, 8);
      memset (user_time, 0, 8);
      <D.14835>:
      D.14807 = 1;
      return D.14807;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.14840;
  int D.14845;
  void * D.14847;
  unsigned int D.14848;

  D.14840 = __builtin_constant_p (__len);
  if (D.14840 != 0) goto <D.14841>; else goto <D.14842>;
  <D.14841>:
  if (__len == 0) goto <D.14843>; else goto <D.14844>;
  <D.14843>:
  D.14845 = __builtin_constant_p (__ch);
  if (D.14845 == 0) goto <D.14838>; else goto <D.14846>;
  <D.14846>:
  if (__ch != 0) goto <D.14838>; else goto <D.14839>;
  <D.14838>:
  __warn_memset_zero_len ();
  D.14847 = __dest;
  return D.14847;
  <D.14839>:
  <D.14844>:
  <D.14842>:
  D.14848 = __builtin_object_size (__dest, 0);
  D.14847 = __builtin___memset_chk (__dest, __ch, __len, D.14848);
  return D.14847;
}


EnumProcessModules (void * process, void * * modules, guint32 size, guint32 * needed)
{
  gboolean D.14852;
  signed int process.64;
  int process.65;
  struct _WapiHandle_process * process_handle.66;
  unsigned int D.14864;
  unsigned int D.14865;
  unsigned int i.67;
  void * D.14867;
  unsigned int i.68;
  unsigned int D.14871;
  void * * D.14872;
  void * D.14873;
  gchar * D.14875;
  int D.14876;
  sizetype i.69;
  sizetype D.14881;
  sizetype D.14882;
  void * * D.14883;
  unsigned int i.70;
  unsigned int D.14885;
  void * D.14887;
  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.14850>; else goto <D.14851>;
      <D.14850>:
      D.14852 = 0;
      return D.14852;
      <D.14851>:
      process.64 = (signed int) process;
      if (process.64 < 0) goto <D.14854>; else goto <D.14855>;
      <D.14854>:
      process.65 = (int) process;
      pid = process.65 & 2147483647;
      goto <D.14857>;
      <D.14855>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.14858>; else goto <D.14859>;
      <D.14858>:
      D.14852 = 0;
      return D.14852;
      <D.14859>:
      process_handle.66 = process_handle;
      pid = process_handle.66->id;
      process_handle.66 = process_handle;
      proc_name = &process_handle.66->proc_name;
      <D.14857>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.14861>; else goto <D.14862>;
      <D.14861>:
      *modules = 0B;
      *needed = 4;
      goto <D.14863>;
      <D.14862>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      D.14864 = count + 1;
      D.14865 = D.14864 * 4;
      *needed = D.14865;
      *modules = 0B;
      i = 0;
      goto <D.13741>;
      <D.13740>:
      i.67 = (unsigned int) i;
      module = monoeg_g_slist_nth_data (mods, i.67);
      D.14867 = *modules;
      if (D.14867 != 0B) goto <D.14868>; else goto <D.14869>;
      <D.14868>:
      i.68 = (unsigned int) i;
      D.14871 = i.68 * 4;
      D.14872 = modules + D.14871;
      D.14873 = module->address_start;
      *D.14872 = D.14873;
      goto <D.14874>;
      <D.14869>:
      D.14875 = module->filename;
      D.14876 = match_procname_to_modulename (proc_name, D.14875);
      if (D.14876 != 0) goto <D.14877>; else goto <D.14878>;
      <D.14877>:
      D.14873 = module->address_start;
      *modules = D.14873;
      goto <D.14879>;
      <D.14878>:
      i.69 = (sizetype) i;
      D.14881 = i.69 + 1;
      D.14882 = D.14881 * 4;
      D.14883 = modules + D.14882;
      D.14873 = module->address_start;
      *D.14883 = D.14873;
      <D.14879>:
      <D.14874>:
      i = i + 1;
      <D.13741>:
      i.70 = (unsigned int) i;
      D.14885 = avail + 4294967295;
      if (i.70 < D.14885) goto <D.14886>; else goto <D.13742>;
      <D.14886>:
      i.70 = (unsigned int) i;
      if (i.70 < count) goto <D.13740>; else goto <D.13742>;
      <D.13742>:
      i = 0;
      goto <D.13744>;
      <D.13743>:
      i.67 = (unsigned int) i;
      D.14887 = monoeg_g_slist_nth_data (mods, i.67);
      free_procmodule (D.14887);
      i = i + 1;
      <D.13744>:
      i.70 = (unsigned int) i;
      if (i.70 < count) goto <D.13743>; else goto <D.13745>;
      <D.13745>:
      monoeg_g_slist_free (mods);
      <D.14863>:
      D.14852 = 1;
      return D.14852;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


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

  try
    {
      fp = 0B;
      proc_path = *.LC3;
      i = 0;
      goto <D.13722>;
      <D.13721>:
      D.14893 = proc_path[i];
      filename = monoeg_g_strdup_printf (D.14893, pid);
      fp = fopen (filename, mode);
      monoeg_g_free (filename);
      i = i + 1;
      <D.13722>:
      if (fp == 0B) goto <D.14894>; else goto <D.13723>;
      <D.14894>:
      D.14893 = proc_path[i];
      if (D.14893 != 0B) goto <D.13721>; else goto <D.13723>;
      <D.13723>:
      D.14895 = fp;
      return D.14895;
    }
  finally
    {
      proc_path = {CLOBBER};
    }
}


load_modules (struct FILE * fp)
{
  const short unsigned int * * D.14898;
  const short unsigned int * D.14899;
  char D.14900;
  unsigned int D.14901;
  unsigned int D.14902;
  const short unsigned int * D.14903;
  short unsigned int D.14904;
  int D.14905;
  int D.14906;
  char D.14907;
  unsigned int D.14908;
  unsigned int D.14909;
  const short unsigned int * D.14910;
  short unsigned int D.14911;
  int D.14912;
  int D.14913;
  long unsigned int D.14916;
  char D.14919;
  unsigned int D.14920;
  unsigned int D.14921;
  const short unsigned int * D.14922;
  short unsigned int D.14923;
  int D.14924;
  int D.14925;
  long unsigned int D.14928;
  char D.14931;
  _Bool D.14932;
  _Bool D.14933;
  _Bool D.14934;
  char D.14937;
  unsigned int D.14938;
  unsigned int D.14939;
  const short unsigned int * D.14940;
  short unsigned int D.14941;
  int D.14942;
  int D.14943;
  long unsigned int D.14946;
  char D.14949;
  unsigned int D.14950;
  unsigned int D.14951;
  const short unsigned int * D.14952;
  short unsigned int D.14953;
  int D.14954;
  int D.14955;
  char D.14960;
  unsigned int D.14961;
  unsigned int D.14962;
  const short unsigned int * D.14963;
  short unsigned int D.14964;
  int D.14965;
  int D.14966;
  char D.14971;
  unsigned int D.14972;
  unsigned int D.14973;
  const short unsigned int * D.14974;
  short unsigned int D.14975;
  int D.14976;
  int D.14977;
  long int D.14980;
  _Bool D.14983;
  _Bool D.14984;
  _Bool D.14985;
  gchar * D.14988;
  gchar * D.14989;
  gchar * D.14990;
  gchar * D.14991;
  struct GSList * D.14992;
  char * D.14996;
  struct GSList * D.14997;
  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.13647>;
      <D.13666>:
      p = &buf;
      goto <D.13645>;
      <D.13644>:
      p = p + 1;
      <D.13645>:
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 != 0) goto <D.13644>; else goto <D.13646>;
      <D.13646>:
      start_start = p;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14907 = *start_start;
      D.14908 = (unsigned int) D.14907;
      D.14909 = D.14908 * 2;
      D.14910 = D.14899 + D.14909;
      D.14911 = *D.14910;
      D.14912 = (int) D.14911;
      D.14913 = D.14912 & 4096;
      if (D.14913 == 0) goto <D.14914>; else goto <D.14915>;
      <D.14914>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14915>:
      D.14916 = strtoul (start_start, &endp, 16);
      address_start = (void *) D.14916;
      p = endp;
      D.14900 = *p;
      if (D.14900 != 45) goto <D.14917>; else goto <D.14918>;
      <D.14917>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14918>:
      p = p + 1;
      end_start = p;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14919 = *end_start;
      D.14920 = (unsigned int) D.14919;
      D.14921 = D.14920 * 2;
      D.14922 = D.14899 + D.14921;
      D.14923 = *D.14922;
      D.14924 = (int) D.14923;
      D.14925 = D.14924 & 4096;
      if (D.14925 == 0) goto <D.14926>; else goto <D.14927>;
      <D.14926>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14927>:
      D.14928 = strtoul (end_start, &endp, 16);
      address_end = (void *) D.14928;
      p = endp;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 == 0) goto <D.14929>; else goto <D.14930>;
      <D.14929>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14930>:
      goto <D.13649>;
      <D.13648>:
      p = p + 1;
      <D.13649>:
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 != 0) goto <D.13648>; else goto <D.13650>;
      <D.13650>:
      prot_start = p;
      D.14931 = *prot_start;
      D.14932 = D.14931 != 114;
      D.14933 = D.14931 != 45;
      D.14934 = D.14932 & D.14933;
      if (D.14934 != 0) goto <D.14935>; else goto <D.14936>;
      <D.14935>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14936>:
      memcpy (&prot_buf, prot_start, 4);
      prot_buf[4] = 0;
      goto <D.13652>;
      <D.13651>:
      p = p + 1;
      <D.13652>:
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 == 0) goto <D.13651>; else goto <D.13653>;
      <D.13653>:
      goto <D.13655>;
      <D.13654>:
      p = p + 1;
      <D.13655>:
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 != 0) goto <D.13654>; else goto <D.13656>;
      <D.13656>:
      offset_start = p;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14937 = *offset_start;
      D.14938 = (unsigned int) D.14937;
      D.14939 = D.14938 * 2;
      D.14940 = D.14899 + D.14939;
      D.14941 = *D.14940;
      D.14942 = (int) D.14941;
      D.14943 = D.14942 & 4096;
      if (D.14943 == 0) goto <D.14944>; else goto <D.14945>;
      <D.14944>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14945>:
      D.14946 = strtoul (offset_start, &endp, 16);
      address_offset = (void *) D.14946;
      p = endp;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 == 0) goto <D.14947>; else goto <D.14948>;
      <D.14947>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14948>:
      goto <D.13658>;
      <D.13657>:
      p = p + 1;
      <D.13658>:
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 != 0) goto <D.13657>; else goto <D.13659>;
      <D.13659>:
      maj_dev_start = p;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14949 = *maj_dev_start;
      D.14950 = (unsigned int) D.14949;
      D.14951 = D.14950 * 2;
      D.14952 = D.14899 + D.14951;
      D.14953 = *D.14952;
      D.14954 = (int) D.14953;
      D.14955 = D.14954 & 4096;
      if (D.14955 == 0) goto <D.14956>; else goto <D.14957>;
      <D.14956>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14957>:
      maj_dev = strtoul (maj_dev_start, &endp, 16);
      p = endp;
      D.14900 = *p;
      if (D.14900 != 58) goto <D.14958>; else goto <D.14959>;
      <D.14958>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14959>:
      p = p + 1;
      min_dev_start = p;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14960 = *min_dev_start;
      D.14961 = (unsigned int) D.14960;
      D.14962 = D.14961 * 2;
      D.14963 = D.14899 + D.14962;
      D.14964 = *D.14963;
      D.14965 = (int) D.14964;
      D.14966 = D.14965 & 4096;
      if (D.14966 == 0) goto <D.14967>; else goto <D.14968>;
      <D.14967>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14968>:
      min_dev = strtoul (min_dev_start, &endp, 16);
      p = endp;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 == 0) goto <D.14969>; else goto <D.14970>;
      <D.14969>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14970>:
      goto <D.13661>;
      <D.13660>:
      p = p + 1;
      <D.13661>:
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 != 0) goto <D.13660>; else goto <D.13662>;
      <D.13662>:
      inode_start = p;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14971 = *inode_start;
      D.14972 = (unsigned int) D.14971;
      D.14973 = D.14972 * 2;
      D.14974 = D.14899 + D.14973;
      D.14975 = *D.14974;
      D.14976 = (int) D.14975;
      D.14977 = D.14976 & 4096;
      if (D.14977 == 0) goto <D.14978>; else goto <D.14979>;
      <D.14978>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14979>:
      D.14980 = strtol (inode_start, &endp, 10);
      inode = (ino_t) D.14980;
      p = endp;
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 == 0) goto <D.14981>; else goto <D.14982>;
      <D.14981>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14982>:
      device = gnu_dev_makedev (maj_dev, min_dev);
      D.14983 = device == 0;
      D.14984 = inode == 0;
      D.14985 = D.14983 & D.14984;
      if (D.14985 != 0) goto <D.14986>; else goto <D.14987>;
      <D.14986>:
      // predicted unlikely by continue predictor.
      goto <D.13647>;
      <D.14987>:
      goto <D.13664>;
      <D.13663>:
      p = p + 1;
      <D.13664>:
      D.14898 = __ctype_b_loc ();
      D.14899 = *D.14898;
      D.14900 = *p;
      D.14901 = (unsigned int) D.14900;
      D.14902 = D.14901 * 2;
      D.14903 = D.14899 + D.14902;
      D.14904 = *D.14903;
      D.14905 = (int) D.14904;
      D.14906 = D.14905 & 8192;
      if (D.14906 != 0) goto <D.13663>; else goto <D.13665>;
      <D.13665>:
      mod = monoeg_malloc0 (40);
      mod->address_start = address_start;
      mod->address_end = address_end;
      D.14988 = monoeg_strdup (&prot_buf);
      mod->perms = D.14988;
      mod->address_offset = address_offset;
      mod->device = device;
      mod->inode = inode;
      D.14989 = monoeg_g_strchomp (p);
      D.14990 = monoeg_g_strchug (D.14989);
      D.14991 = monoeg_strdup (D.14990);
      mod->filename = D.14991;
      D.14992 = monoeg_g_slist_find_custom (ret, mod, find_procmodule);
      if (D.14992 == 0B) goto <D.14993>; else goto <D.14994>;
      <D.14993>:
      ret = monoeg_g_slist_prepend (ret, mod);
      goto <D.14995>;
      <D.14994>:
      free_procmodule (mod);
      <D.14995>:
      <D.13647>:
      D.14996 = fgets (&buf, 4097, fp);
      if (D.14996 != 0B) goto <D.13666>; else goto <D.13667>;
      <D.13667>:
      ret = monoeg_g_slist_reverse (ret);
      D.14997 = ret;
      return D.14997;
    }
  finally
    {
      buf = {CLOBBER};
      endp = {CLOBBER};
      prot_buf = {CLOBBER};
    }
}


find_procmodule (const void * a, const void * b)
{
  long long unsigned int D.15001;
  long long unsigned int D.15002;
  long long unsigned int D.15004;
  long long unsigned int D.15005;
  gint D.15007;
  struct WapiProcModule * want;
  struct WapiProcModule * compare;

  want = a;
  compare = b;
  D.15001 = want->device;
  D.15002 = compare->device;
  if (D.15001 == D.15002) goto <D.15003>; else goto <D.15000>;
  <D.15003>:
  D.15004 = want->inode;
  D.15005 = compare->inode;
  if (D.15004 == D.15005) goto <D.15006>; else goto <D.15000>;
  <D.15006>:
  D.15007 = 0;
  return D.15007;
  <D.15000>:
  D.15007 = 1;
  return D.15007;
}


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

  D.15010 = __builtin_object_size (__dest, 0);
  D.15009 = __builtin___memcpy_chk (__dest, __src, __len, D.15010);
  return D.15009;
}


gnu_dev_makedev (unsigned int __major, unsigned int __minor)
{
  long long unsigned int D.15012;
  long long unsigned int D.15013;
  long long unsigned int D.15014;
  long long unsigned int D.15015;
  long long unsigned int D.15016;
  long long unsigned int D.15017;
  long long unsigned int D.15018;
  long long unsigned int D.15019;
  __dev_t D.15020;
  __dev_t __dev;

  D.15012 = (long long unsigned int) __major;
  D.15013 = D.15012 & 4095;
  __dev = D.15013 << 8;
  D.15012 = (long long unsigned int) __major;
  D.15014 = D.15012 & 4294963200;
  D.15015 = D.15014 << 32;
  __dev = D.15015 | __dev;
  D.15016 = (long long unsigned int) __minor;
  D.15017 = D.15016 & 255;
  __dev = D.15017 | __dev;
  D.15016 = (long long unsigned int) __minor;
  D.15018 = D.15016 & 4294967040;
  D.15019 = D.15018 << 12;
  __dev = D.15019 | __dev;
  D.15020 = __dev;
  return D.15020;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  unsigned int D.15022;
  int D.15027;
  char * D.15029;
  unsigned int D.15030;
  unsigned int __n.71;
  unsigned int D.15032;
  unsigned int D.15035;

  D.15022 = __builtin_object_size (__s, 1);
  if (D.15022 != 4294967295) goto <D.15023>; else goto <D.15024>;
  <D.15023>:
  D.15027 = __builtin_constant_p (__n);
  if (D.15027 == 0) goto <D.15025>; else goto <D.15028>;
  <D.15028>:
  if (__n <= 0) goto <D.15025>; else goto <D.15026>;
  <D.15025>:
  D.15030 = __builtin_object_size (__s, 1);
  D.15029 = __fgets_chk (__s, D.15030, __n, __stream);
  return D.15029;
  <D.15026>:
  __n.71 = (unsigned int) __n;
  D.15032 = __builtin_object_size (__s, 1);
  if (__n.71 > D.15032) goto <D.15033>; else goto <D.15034>;
  <D.15033>:
  D.15035 = __builtin_object_size (__s, 1);
  D.15029 = __fgets_chk_warn (__s, D.15035, __n, __stream);
  return D.15029;
  <D.15034>:
  <D.15024>:
  D.15029 = __fgets_alias (__s, __n, __stream);
  return D.15029;
}


match_procname_to_modulename (gchar * procname, gchar * modulename)
{
  _Bool D.15037;
  _Bool D.15038;
  _Bool D.15039;
  gboolean D.15042;
  int D.13685;
  int D.13694;
  const char * D.15049;
  int D.13703;
  const char * D.15058;
  int D.13712;
  char * lastsep;
  char * lastsep2;
  char * pname;
  char * mname;
  gboolean result;

  lastsep = 0B;
  lastsep2 = 0B;
  pname = 0B;
  mname = 0B;
  result = 0;
  D.15037 = procname == 0B;
  D.15038 = modulename == 0B;
  D.15039 = D.15037 | D.15038;
  if (D.15039 != 0) goto <D.15040>; else goto <D.15041>;
  <D.15040>:
  D.15042 = 0;
  return D.15042;
  <D.15041>:
  pname = mono_path_resolve_symlinks (procname);
  mname = mono_path_resolve_symlinks (modulename);
  {
    size_t __s1_len;
    size_t __s2_len;

    D.13685 = __builtin_strcmp (pname, mname);
  }
  if (D.13685 == 0) goto <D.15043>; else goto <D.15044>;
  <D.15043>:
  result = 1;
  <D.15044>:
  if (result == 0) goto <D.15045>; else goto <D.15046>;
  <D.15045>:
  lastsep = strrchr (mname, 47);
  if (lastsep != 0B) goto <D.15047>; else goto <D.15048>;
  <D.15047>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.15049 = lastsep + 1;
    D.13694 = __builtin_strcmp (D.15049, pname);
  }
  if (D.13694 == 0) goto <D.15050>; else goto <D.15051>;
  <D.15050>:
  result = 1;
  <D.15051>:
  <D.15048>:
  if (result == 0) goto <D.15052>; else goto <D.15053>;
  <D.15052>:
  lastsep2 = strrchr (pname, 47);
  if (lastsep2 != 0B) goto <D.15054>; else goto <D.15055>;
  <D.15054>:
  if (lastsep != 0B) goto <D.15056>; else goto <D.15057>;
  <D.15056>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.15049 = lastsep + 1;
    D.15058 = lastsep2 + 1;
    D.13703 = __builtin_strcmp (D.15049, D.15058);
  }
  if (D.13703 == 0) goto <D.15059>; else goto <D.15060>;
  <D.15059>:
  result = 1;
  <D.15060>:
  goto <D.15061>;
  <D.15057>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.15058 = lastsep2 + 1;
    D.13712 = __builtin_strcmp (mname, D.15058);
  }
  if (D.13712 == 0) goto <D.15062>; else goto <D.15063>;
  <D.15062>:
  result = 1;
  <D.15063>:
  <D.15061>:
  <D.15055>:
  <D.15053>:
  <D.15046>:
  monoeg_g_free (pname);
  monoeg_g_free (mname);
  D.15042 = result;
  return D.15042;
}


free_procmodule (struct WapiProcModule * mod)
{
  gchar * D.15065;
  gchar * D.15068;

  D.15065 = mod->perms;
  if (D.15065 != 0B) goto <D.15066>; else goto <D.15067>;
  <D.15066>:
  D.15065 = mod->perms;
  monoeg_g_free (D.15065);
  <D.15067>:
  D.15068 = mod->filename;
  if (D.15068 != 0B) goto <D.15069>; else goto <D.15070>;
  <D.15069>:
  D.15068 = mod->filename;
  monoeg_g_free (D.15068);
  <D.15070>:
  monoeg_g_free (mod);
}


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

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


get_module_name (void * process, void * module, gunichar2 * basename, guint32 size, gboolean base)
{
  _Bool D.15073;
  _Bool D.15074;
  _Bool D.15075;
  guint32 D.15078;
  signed int process.72;
  int process.73;
  struct _WapiHandle_process * process_handle.74;
  gchar[256] * D.15087;
  int * D.15092;
  int D.15093;
  _Bool D.15095;
  _Bool D.15096;
  _Bool D.15097;
  unsigned int i.75;
  gchar * D.15107;
  int D.15108;
  void * D.15110;
  unsigned int i.76;
  unsigned int bytes.77;
  unsigned int D.15122;
  unsigned int bytes.78;
  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;
      D.15073 = basename == 0B;
      D.15074 = size == 0;
      D.15075 = D.15073 | D.15074;
      if (D.15075 != 0) goto <D.15076>; else goto <D.15077>;
      <D.15076>:
      D.15078 = 0;
      return D.15078;
      <D.15077>:
      process.72 = (signed int) process;
      if (process.72 < 0) goto <D.15080>; else goto <D.15081>;
      <D.15080>:
      process.73 = (int) process;
      pid = process.73 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.15083>;
      <D.15081>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.15084>; else goto <D.15085>;
      <D.15084>:
      D.15078 = 0;
      return D.15078;
      <D.15085>:
      process_handle.74 = process_handle;
      pid = process_handle.74->id;
      process_handle.74 = process_handle;
      D.15087 = &process_handle.74->proc_name;
      proc_name = monoeg_strdup (D.15087);
      <D.15083>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.15088>; else goto <D.15089>;
      <D.15088>:
      D.15092 = __errno_location ();
      D.15093 = *D.15092;
      if (D.15093 == 13) goto <D.15094>; else goto <D.15090>;
      <D.15094>:
      D.15095 = module == 0B;
      D.15096 = base == 1;
      D.15097 = D.15095 & D.15096;
      if (D.15097 != 0) goto <D.15098>; else goto <D.15090>;
      <D.15098>:
      procname_ext = get_process_name_from_proc (pid);
      goto <D.15091>;
      <D.15090>:
      monoeg_g_free (proc_name);
      D.15078 = 0;
      return D.15078;
      <D.15091>:
      goto <D.15099>;
      <D.15089>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.13776>;
      <D.13775>:
      i.75 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.75);
      if (procname_ext == 0B) goto <D.15104>; else goto <D.15105>;
      <D.15104>:
      if (module == 0B) goto <D.15106>; else goto <D.15101>;
      <D.15106>:
      D.15107 = found_module->filename;
      D.15108 = match_procname_to_modulename (proc_name, D.15107);
      if (D.15108 != 0) goto <D.15102>; else goto <D.15101>;
      <D.15101>:
      if (module != 0B) goto <D.15109>; else goto <D.15103>;
      <D.15109>:
      D.15110 = found_module->address_start;
      if (D.15110 == module) goto <D.15102>; else goto <D.15103>;
      <D.15102>:
      if (base != 0) goto <D.15111>; else goto <D.15112>;
      <D.15111>:
      D.15107 = found_module->filename;
      procname_ext = monoeg_g_path_get_basename (D.15107);
      goto <D.15113>;
      <D.15112>:
      D.15107 = found_module->filename;
      procname_ext = monoeg_strdup (D.15107);
      <D.15113>:
      <D.15103>:
      <D.15105>:
      free_procmodule (found_module);
      i = i + 1;
      <D.13776>:
      i.76 = (unsigned int) i;
      if (i.76 < count) goto <D.13775>; else goto <D.13777>;
      <D.13777>:
      if (procname_ext == 0B) goto <D.15115>; else goto <D.15116>;
      <D.15115>:
      procname_ext = get_process_name_from_proc (pid);
      <D.15116>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      <D.15099>:
      if (procname_ext != 0B) goto <D.15117>; else goto <D.15118>;
      <D.15117>:
      procname = mono_unicode_from_external (procname_ext, &bytes);
      if (procname == 0B) goto <D.15119>; else goto <D.15120>;
      <D.15119>:
      monoeg_g_free (procname_ext);
      D.15078 = 0;
      return D.15078;
      <D.15120>:
      bytes.77 = bytes;
      D.15122 = bytes.77 / 2;
      len = (glong) D.15122;
      bytes.77 = bytes;
      bytes.78 = bytes.77 + 2;
      bytes = bytes.78;
      bytes.77 = bytes;
      if (size < bytes.77) goto <D.15124>; else goto <D.15125>;
      <D.15124>:
      memcpy (basename, procname, size);
      goto <D.15126>;
      <D.15125>:
      bytes.77 = bytes;
      memcpy (basename, procname, bytes.77);
      <D.15126>:
      monoeg_g_free (procname);
      monoeg_g_free (procname_ext);
      D.15078 = (guint32) len;
      return D.15078;
      <D.15118>:
      D.15078 = 0;
      return D.15078;
    }
  finally
    {
      process_handle = {CLOBBER};
      bytes = {CLOBBER};
    }
}


get_process_name_from_proc (pid_t pid)
{
  int D.15129;
  gchar * D.15134;
  char * D.15137;
  char * D.15144;
  const char * D.15149;
  const gchar * D.15152;
  int end.79;
  int start.80;
  int D.15155;
  int D.15156;
  unsigned int D.15157;
  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.15129 = readlink (filename, &buf, 255);
      if (D.15129 > 0) goto <D.15130>; else goto <D.15131>;
      <D.15130>:
      ret = monoeg_strdup (&buf);
      <D.15131>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.15132>; else goto <D.15133>;
      <D.15132>:
      D.15134 = ret;
      return D.15134;
      <D.15133>:
      filename = monoeg_g_strdup_printf ("/proc/%d/cmdline", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.15135>; else goto <D.15136>;
      <D.15135>:
      D.15137 = fgets (&buf, 256, fp);
      if (D.15137 != 0B) goto <D.15138>; else goto <D.15139>;
      <D.15138>:
      ret = monoeg_strdup (&buf);
      <D.15139>:
      fclose (fp);
      <D.15136>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.15140>; else goto <D.15141>;
      <D.15140>:
      D.15134 = ret;
      return D.15134;
      <D.15141>:
      filename = monoeg_g_strdup_printf ("/proc/%d/stat", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.15142>; else goto <D.15143>;
      <D.15142>:
      D.15144 = fgets (&buf, 256, fp);
      if (D.15144 != 0B) goto <D.15145>; else goto <D.15146>;
      <D.15145>:
      {
        gchar * start;
        gchar * end;

        start = __builtin_strchr (&buf, 40);
        if (start != 0B) goto <D.15147>; else goto <D.15148>;
        <D.15147>:
        D.15149 = start + 1;
        end = __builtin_strchr (D.15149, 41);
        if (end != 0B) goto <D.15150>; else goto <D.15151>;
        <D.15150>:
        D.15152 = start + 1;
        end.79 = (int) end;
        start.80 = (int) start;
        D.15155 = end.79 - start.80;
        D.15156 = D.15155 + -1;
        D.15157 = (unsigned int) D.15156;
        ret = monoeg_g_strndup (D.15152, D.15157);
        <D.15151>:
        <D.15148>:
      }
      <D.15146>:
      fclose (fp);
      <D.15143>:
      monoeg_g_free (filename);
      D.15134 = ret;
      return D.15134;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


readlink (const char * restrict __path, char * restrict __buf, size_t __len)
{
  unsigned int D.15160;
  int D.15163;
  ssize_t D.15166;
  unsigned int D.15167;
  unsigned int D.15168;
  unsigned int D.15171;

  D.15160 = __builtin_object_size (__buf, 1);
  if (D.15160 != 4294967295) goto <D.15161>; else goto <D.15162>;
  <D.15161>:
  D.15163 = __builtin_constant_p (__len);
  if (D.15163 == 0) goto <D.15164>; else goto <D.15165>;
  <D.15164>:
  D.15167 = __builtin_object_size (__buf, 1);
  D.15166 = __readlink_chk (__path, __buf, __len, D.15167);
  return D.15166;
  <D.15165>:
  D.15168 = __builtin_object_size (__buf, 1);
  if (D.15168 < __len) goto <D.15169>; else goto <D.15170>;
  <D.15169>:
  D.15171 = __builtin_object_size (__buf, 1);
  D.15166 = __readlink_chk_warn (__path, __buf, __len, D.15171);
  return D.15166;
  <D.15170>:
  <D.15162>:
  D.15166 = __readlink_alias (__path, __buf, __len);
  return D.15166;
}


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

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


GetModuleInformation (void * process, void * module, struct WapiModuleInfo * modinfo, guint32 size)
{
  _Bool D.15175;
  _Bool D.15176;
  _Bool D.15177;
  gboolean D.15180;
  signed int process.81;
  int process.82;
  struct _WapiHandle_process * process_handle.83;
  gchar[256] * D.15189;
  unsigned int i.84;
  gchar * D.15199;
  int D.15200;
  void * D.15202;
  void * D.15203;
  unsigned int D.15204;
  unsigned int D.15205;
  unsigned int D.15206;
  void * D.15207;
  unsigned int i.85;
  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);
      D.15175 = modinfo == 0B;
      D.15176 = size <= 11;
      D.15177 = D.15175 | D.15176;
      if (D.15177 != 0) goto <D.15178>; else goto <D.15179>;
      <D.15178>:
      D.15180 = 0;
      return D.15180;
      <D.15179>:
      process.81 = (signed int) process;
      if (process.81 < 0) goto <D.15182>; else goto <D.15183>;
      <D.15182>:
      process.82 = (int) process;
      pid = process.82 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.15185>;
      <D.15183>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.15186>; else goto <D.15187>;
      <D.15186>:
      D.15180 = 0;
      return D.15180;
      <D.15187>:
      process_handle.83 = process_handle;
      pid = process_handle.83->id;
      process_handle.83 = process_handle;
      D.15189 = &process_handle.83->proc_name;
      proc_name = monoeg_strdup (D.15189);
      <D.15185>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.15190>; else goto <D.15191>;
      <D.15190>:
      monoeg_g_free (proc_name);
      D.15180 = 0;
      return D.15180;
      <D.15191>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.13807>;
      <D.13806>:
      i.84 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.84);
      if (ret == 0) goto <D.15196>; else goto <D.15197>;
      <D.15196>:
      if (module == 0B) goto <D.15198>; else goto <D.15193>;
      <D.15198>:
      D.15199 = found_module->filename;
      D.15200 = match_procname_to_modulename (proc_name, D.15199);
      if (D.15200 != 0) goto <D.15194>; else goto <D.15193>;
      <D.15193>:
      if (module != 0B) goto <D.15201>; else goto <D.15195>;
      <D.15201>:
      D.15202 = found_module->address_start;
      if (D.15202 == module) goto <D.15194>; else goto <D.15195>;
      <D.15194>:
      D.15202 = found_module->address_start;
      modinfo->lpBaseOfDll = D.15202;
      D.15203 = found_module->address_end;
      D.15204 = (unsigned int) D.15203;
      D.15202 = found_module->address_start;
      D.15205 = (unsigned int) D.15202;
      D.15206 = D.15204 - D.15205;
      modinfo->SizeOfImage = D.15206;
      D.15207 = found_module->address_offset;
      modinfo->EntryPoint = D.15207;
      ret = 1;
      <D.15195>:
      <D.15197>:
      free_procmodule (found_module);
      i = i + 1;
      <D.13807>:
      i.85 = (unsigned int) i;
      if (i.85 < count) goto <D.13806>; else goto <D.13808>;
      <D.13808>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      D.15180 = ret;
      return D.15180;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetProcessWorkingSetSize (void * process, size_t * min, size_t * max)
{
  _Bool D.15211;
  _Bool D.15212;
  _Bool D.15213;
  gboolean D.15216;
  signed int process.86;
  struct _WapiHandle_process * process_handle.87;
  unsigned int D.15223;
  unsigned int D.15224;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      D.15211 = min == 0B;
      D.15212 = max == 0B;
      D.15213 = D.15211 | D.15212;
      if (D.15213 != 0) goto <D.15214>; else goto <D.15215>;
      <D.15214>:
      D.15216 = 0;
      return D.15216;
      <D.15215>:
      process.86 = (signed int) process;
      if (process.86 < 0) goto <D.15218>; else goto <D.15219>;
      <D.15218>:
      D.15216 = 0;
      return D.15216;
      <D.15219>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.15220>; else goto <D.15221>;
      <D.15220>:
      D.15216 = 0;
      return D.15216;
      <D.15221>:
      process_handle.87 = process_handle;
      D.15223 = process_handle.87->min_working_set;
      *min = D.15223;
      process_handle.87 = process_handle;
      D.15224 = process_handle.87->max_working_set;
      *max = D.15224;
      D.15216 = 1;
      return D.15216;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetProcessWorkingSetSize (void * process, size_t min, size_t max)
{
  signed int process.88;
  gboolean D.15230;
  struct _WapiHandle_process * process_handle.89;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      process.88 = (signed int) process;
      if (process.88 < 0) goto <D.15228>; else goto <D.15229>;
      <D.15228>:
      D.15230 = 0;
      return D.15230;
      <D.15229>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.15231>; else goto <D.15232>;
      <D.15231>:
      D.15230 = 0;
      return D.15230;
      <D.15232>:
      process_handle.89 = process_handle;
      process_handle.89->min_working_set = min;
      process_handle.89 = process_handle;
      process_handle.89->max_working_set = max;
      D.15230 = 1;
      return D.15230;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


TerminateProcess (void * process, gint32 exitCode)
{
  signed int process.90;
  int process.91;
  gboolean D.15243;
  struct _WapiHandle_process * process_handle.92;
  int iftmp.93;
  int * D.15251;
  int D.15252;
  _Bool D.15253;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int signo;
  int ret;
  pid_t pid;

  try
    {
      process.90 = (signed int) process;
      if (process.90 < 0) goto <D.15237>; else goto <D.15238>;
      <D.15237>:
      process.91 = (int) process;
      pid = process.91 & 2147483647;
      goto <D.15240>;
      <D.15238>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.15241>; else goto <D.15242>;
      <D.15241>:
      SetLastError (6);
      D.15243 = 0;
      return D.15243;
      <D.15242>:
      process_handle.92 = process_handle;
      pid = process_handle.92->id;
      <D.15240>:
      if (exitCode == -1) goto <D.15246>; else goto <D.15247>;
      <D.15246>:
      iftmp.93 = 9;
      goto <D.15248>;
      <D.15247>:
      iftmp.93 = 15;
      <D.15248>:
      signo = iftmp.93;
      ret = kill (pid, signo);
      if (ret == -1) goto <D.15249>; else goto <D.15250>;
      <D.15249>:
      D.15251 = __errno_location ();
      D.15252 = *D.15251;
      switch (D.15252) <default: <D.13836>, case 1: <D.13834>, case 3: <D.13835>, case 22: <D.13832>>
      <D.13832>:
      SetLastError (87);
      goto <D.13833>;
      <D.13834>:
      SetLastError (5);
      goto <D.13833>;
      <D.13835>:
      SetLastError (127);
      goto <D.13833>;
      <D.13836>:
      SetLastError (31);
      <D.13833>:
      <D.15250>:
      D.15253 = ret == 0;
      D.15243 = (gboolean) D.15253;
      return D.15243;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetPriorityClass (void * process)
{
  signed int process.94;
  int process.95;
  guint32 D.15263;
  struct _WapiHandle_process * process_handle.96;
  int * D.15265;
  unsigned int pid.97;
  int D.15269;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  pid_t pid;

  try
    {
      process.94 = (signed int) process;
      if (process.94 < 0) goto <D.15257>; else goto <D.15258>;
      <D.15257>:
      process.95 = (int) process;
      pid = process.95 & 2147483647;
      goto <D.15260>;
      <D.15258>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.15261>; else goto <D.15262>;
      <D.15261>:
      SetLastError (6);
      D.15263 = 0;
      return D.15263;
      <D.15262>:
      process_handle.96 = process_handle;
      pid = process_handle.96->id;
      <D.15260>:
      D.15265 = __errno_location ();
      *D.15265 = 0;
      pid.97 = (unsigned int) pid;
      ret = getpriority (0, pid.97);
      if (ret == -1) goto <D.15267>; else goto <D.15268>;
      <D.15267>:
      D.15265 = __errno_location ();
      D.15269 = *D.15265;
      if (D.15269 != 0) goto <D.15270>; else goto <D.15271>;
      <D.15270>:
      D.15265 = __errno_location ();
      D.15269 = *D.15265;
      switch (D.15269) <default: <D.13848>, case 1: <D.13844>, case 3: <D.13847>, case 13: <D.13845>>
      <D.13844>:
      <D.13845>:
      SetLastError (5);
      goto <D.13846>;
      <D.13847>:
      SetLastError (127);
      goto <D.13846>;
      <D.13848>:
      SetLastError (31);
      <D.13846>:
      D.15263 = 0;
      return D.15263;
      <D.15271>:
      <D.15268>:
      if (ret == 0) goto <D.15272>; else goto <D.15273>;
      <D.15272>:
      D.15263 = 32;
      return D.15263;
      <D.15273>:
      if (ret < -15) goto <D.15274>; else goto <D.15275>;
      <D.15274>:
      D.15263 = 256;
      return D.15263;
      <D.15275>:
      if (ret < -10) goto <D.15276>; else goto <D.15277>;
      <D.15276>:
      D.15263 = 128;
      return D.15263;
      <D.15277>:
      if (ret < 0) goto <D.15278>; else goto <D.15279>;
      <D.15278>:
      D.15263 = 32768;
      return D.15263;
      <D.15279>:
      if (ret > 10) goto <D.15280>; else goto <D.15281>;
      <D.15280>:
      D.15263 = 64;
      return D.15263;
      <D.15281>:
      if (ret > 0) goto <D.15282>; else goto <D.15283>;
      <D.15282>:
      D.15263 = 16384;
      return D.15263;
      <D.15283>:
      D.15263 = 32;
      return D.15263;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetPriorityClass (void * process, guint32 priority_class)
{
  signed int process.98;
  int process.99;
  gboolean D.15293;
  struct _WapiHandle_process * process_handle.100;
  unsigned int pid.101;
  int * D.15298;
  int D.15299;
  _Bool D.15300;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  int prio;
  pid_t pid;

  try
    {
      process.98 = (signed int) process;
      if (process.98 < 0) goto <D.15287>; else goto <D.15288>;
      <D.15287>:
      process.99 = (int) process;
      pid = process.99 & 2147483647;
      goto <D.15290>;
      <D.15288>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.15291>; else goto <D.15292>;
      <D.15291>:
      SetLastError (6);
      D.15293 = 0;
      return D.15293;
      <D.15292>:
      process_handle.100 = process_handle;
      pid = process_handle.100->id;
      <D.15290>:
      switch (priority_class) <default: <D.13865>, case 32: <D.13861>, case 64: <D.13858>, case 128: <D.13863>, case 256: <D.13864>, case 16384: <D.13860>, case 32768: <D.13862>>
      <D.13858>:
      prio = 19;
      goto <D.13859>;
      <D.13860>:
      prio = 10;
      goto <D.13859>;
      <D.13861>:
      prio = 0;
      goto <D.13859>;
      <D.13862>:
      prio = -5;
      goto <D.13859>;
      <D.13863>:
      prio = -11;
      goto <D.13859>;
      <D.13864>:
      prio = -20;
      goto <D.13859>;
      <D.13865>:
      SetLastError (87);
      D.15293 = 0;
      return D.15293;
      <D.13859>:
      pid.101 = (unsigned int) pid;
      ret = setpriority (0, pid.101, prio);
      if (ret == -1) goto <D.15296>; else goto <D.15297>;
      <D.15296>:
      D.15298 = __errno_location ();
      D.15299 = *D.15298;
      switch (D.15299) <default: <D.13870>, case 1: <D.13866>, case 3: <D.13869>, case 13: <D.13867>>
      <D.13866>:
      <D.13867>:
      SetLastError (5);
      goto <D.13868>;
      <D.13869>:
      SetLastError (127);
      goto <D.13868>;
      <D.13870>:
      SetLastError (31);
      <D.13868>:
      <D.15297>:
      D.15300 = ret == 0;
      D.15293 = (gboolean) D.15300;
      return D.15293;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


