process_wait (void * handle, guint32 timeout, gboolean alertable)
{
  long unsigned int D.11731;
  guint32 D.11734;
  long int handle.0;
  signed int D.11736;
  _Bool D.11737;
  long int D.11738;
  long int D.11739;
  struct _WapiHandle_process * process_handle.1;
  int D.11745;
  int D.11750;
  int D.11751;
  _Bool D.11754;
  unsigned int D.11759;
  unsigned int D.11760;
  union MonoSemType * D.11761;
  int * D.11765;
  int D.11766;
  int D.11774;
  unsigned int D.11778;
  unsigned int D.11783;
  int D.11786;
  _Bool D.11789;
  long int D.11790;
  long int D.11791;
  int iftmp.2;
  union 
{
  int __in;
  int __i;
} D.11721;
  int D.11798;
  unsigned char D.11799;
  unsigned char D.11800;
  unsigned char D.11801;
  signed char D.11802;
  signed char D.11803;
  union 
{
  int __in;
  int __i;
} D.11725;
  int D.11806;
  int D.11807;
  int D.11808;
  unsigned int D.11809;
  union 
{
  int __in;
  int __i;
} D.11729;
  int D.11811;
  int D.11812;
  int D.11813;
  unsigned int D.11814;
  struct WapiFileTime * D.11815;
  long int D.11816;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  pid_t pid;
  pid_t ret;
  int status;
  guint32 start;
  guint32 now;
  struct MonoProcess * mp;
  gboolean spin;
  void * current_thread;
  static const char __func__[13] = "process_wait";
  typedef union 
{
  int __in;
  int __i;
} unionunion 
{
  int __in;
  int __i;
};

  try
    {
      D.11731 = pthread_self ();
      current_thread = _wapi_thread_handle_from_id (D.11731);
      if (current_thread == 0B) goto <D.11732>; else goto <D.11733>;
      <D.11732>:
      SetLastError (6);
      D.11734 = 4294967295;
      return D.11734;
      <D.11733>:
      handle.0 = (long int) handle;
      D.11736 = (signed int) handle.0;
      D.11737 = D.11736 < 0;
      D.11738 = (long int) D.11737;
      D.11739 = __builtin_expect (D.11738, 0);
      if (D.11739 != 0) goto <D.11740>; else goto <D.11741>;
      <D.11740>:
      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.11741>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.11742>; else goto <D.11743>;
      <D.11742>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      D.11734 = 4294967295;
      return D.11734;
      <D.11743>:
      process_handle.1 = process_handle;
      D.11745 = process_handle.1->exited;
      if (D.11745 != 0) goto <D.11746>; else goto <D.11747>;
      <D.11746>:
      D.11734 = 0;
      return D.11734;
      <D.11747>:
      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.11748>; else goto <D.11749>;
      <D.11748>:
      process_handle.1 = process_handle;
      D.11750 = process_handle.1->self;
      D.11751 = _wapi_getpid ();
      if (D.11750 != D.11751) goto <D.11752>; else goto <D.11753>;
      <D.11752>:
      mp = 0B;
      <D.11753>:
      <D.11749>:
      start = mono_msec_ticks ();
      now = start;
      D.11754 = mp == 0B;
      spin = (gboolean) D.11754;
      <D.11717>:
      if (mp != 0B) goto <D.11755>; else goto <D.11756>;
      <D.11755>:
      if (timeout != 4294967295) goto <D.11757>; else goto <D.11758>;
      <D.11757>:
      D.11759 = start - now;
      D.11760 = D.11759 + timeout;
      D.11761 = &mp->exit_sem;
      ret = mono_sem_timedwait (D.11761, D.11760, alertable);
      goto <D.11762>;
      <D.11758>:
      D.11761 = &mp->exit_sem;
      ret = mono_sem_wait (D.11761, alertable);
      <D.11762>:
      if (ret == -1) goto <D.11763>; else goto <D.11764>;
      <D.11763>:
      D.11765 = __errno_location ();
      D.11766 = *D.11765;
      if (D.11766 != 4) goto <D.11767>; else goto <D.11768>;
      <D.11767>:
      D.11765 = __errno_location ();
      D.11766 = *D.11765;
      if (D.11766 != 110) goto <D.11769>; else goto <D.11770>;
      <D.11769>:
      <D.11770>:
      <D.11768>:
      <D.11764>:
      if (ret == 0) goto <D.11771>; else goto <D.11772>;
      <D.11771>:
      D.11761 = &mp->exit_sem;
      mono_sem_post (D.11761);
      goto <D.11716>;
      <D.11772>:
      goto <D.11773>;
      <D.11756>:
      D.11774 = is_pid_valid (pid);
      if (D.11774 == 0) goto <D.11716>; else goto <D.11775>;
      <D.11775>:
      <D.11773>:
      if (timeout == 0) goto <D.11776>; else goto <D.11777>;
      <D.11776>:
      D.11734 = 258;
      return D.11734;
      <D.11777>:
      now = mono_msec_ticks ();
      D.11778 = now - start;
      if (D.11778 >= timeout) goto <D.11779>; else goto <D.11780>;
      <D.11779>:
      D.11734 = 258;
      return D.11734;
      <D.11780>:
      if (spin != 0) goto <D.11781>; else goto <D.11782>;
      <D.11781>:
      D.11759 = start - now;
      D.11760 = D.11759 + timeout;
      D.11783 = MIN_EXPR <D.11760, 100>;
      _wapi_handle_spin (D.11783);
      <D.11782>:
      if (alertable != 0) goto <D.11784>; else goto <D.11785>;
      <D.11784>:
      D.11786 = _wapi_thread_apc_pending (current_thread);
      if (D.11786 != 0) goto <D.11787>; else goto <D.11788>;
      <D.11787>:
      D.11734 = 192;
      return D.11734;
      <D.11788>:
      <D.11785>:
      goto <D.11717>;
      <D.11716>:
      ret = _wapi_handle_lock_shared_handles ();
      D.11789 = ret != 0;
      D.11790 = (long int) D.11789;
      D.11791 = __builtin_expect (D.11790, 0);
      if (D.11791 != 0) goto <D.11792>; else goto <D.11793>;
      <D.11792>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 3006, "ret == 0");
      <D.11793>:
      if (mp != 0B) goto <D.11795>; else goto <D.11796>;
      <D.11795>:
      iftmp.2 = mp->status;
      goto <D.11797>;
      <D.11796>:
      iftmp.2 = 0;
      <D.11797>:
      status = iftmp.2;
      D.11721.__in = status;
      D.11798 = D.11721.__i;
      D.11799 = (unsigned char) D.11798;
      D.11800 = D.11799 & 127;
      D.11801 = D.11800 + 1;
      D.11802 = (signed char) D.11801;
      D.11803 = D.11802 >> 1;
      if (D.11803 > 0) goto <D.11804>; else goto <D.11805>;
      <D.11804>:
      {
        typedef union 
      {
        int __in;
        int __i;
      } unionunion 
      {
        int __in;
        int __i;
      };

        process_handle.1 = process_handle;
        D.11725.__in = status;
        D.11806 = D.11725.__i;
        D.11807 = D.11806 & 127;
        D.11808 = D.11807 + 128;
        D.11809 = (unsigned int) D.11808;
        process_handle.1->exitstatus = D.11809;
      }
      goto <D.11810>;
      <D.11805>:
      {
        typedef union 
      {
        int __in;
        int __i;
      } unionunion 
      {
        int __in;
        int __i;
      };

        process_handle.1 = process_handle;
        D.11729.__in = status;
        D.11811 = D.11729.__i;
        D.11812 = D.11811 & 65280;
        D.11813 = D.11812 >> 8;
        D.11814 = (unsigned int) D.11813;
        process_handle.1->exitstatus = D.11814;
      }
      <D.11810>:
      process_handle.1 = process_handle;
      D.11815 = &process_handle.1->exit_time;
      D.11816 = time (0B);
      _wapi_time_t_to_filetime (D.11816, D.11815);
      process_handle.1 = process_handle;
      process_handle.1->exited = 1;
      _wapi_shared_handle_set_signal_state (handle, 1);
      _wapi_handle_unlock_shared_handles ();
      D.11734 = 0;
      return D.11734;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


is_pid_valid (pid_t pid)
{
  int D.11819;
  gboolean D.11822;
  gboolean result;
  gchar * dir;

  result = 0;
  dir = monoeg_g_strdup_printf ("/proc/%d", pid);
  D.11819 = access (dir, 0);
  if (D.11819 == 0) goto <D.11820>; else goto <D.11821>;
  <D.11820>:
  result = 1;
  <D.11821>:
  monoeg_g_free (dir);
  D.11822 = result;
  return D.11822;
}


_wapi_handle_spin (guint32 ms)
{
  _Bool D.11824;
  long int D.11825;
  long int D.11826;
  unsigned int D.11829;
  long int D.11830;
  struct timespec sleepytime;

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


_wapi_handle_lock_shared_handles ()
{
  int D.11831;

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


_wapi_shared_handle_set_signal_state (void * handle, gboolean state)
{
  long int handle.3;
  int iftmp.4;
  <unnamed type> D.11839;
  <unnamed type> D.11841;
  <unnamed type> D.11843;
  <unnamed type> D.11845;
  _Bool D.11847;
  long int D.11848;
  long int D.11849;
  unsigned int D.11852;
  struct _WapiHandleUnshared * D.11853;
  long unsigned int D.11854;
  long unsigned int D.11855;
  long unsigned int D.11856;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.5;
  unsigned int D.11858;
  guint32 idx;
  struct _WapiHandleUnshared * handle_data;
  struct _WapiHandle_shared_ref * ref;
  struct _WapiHandleShared * shared_data;

  handle.3 = (long int) handle;
  idx = (guint32) handle.3;
  if (idx > 4194303) goto <D.11834>; else goto <D.11835>;
  <D.11834>:
  return;
  <D.11835>:
  D.11839 = _wapi_handle_type (handle);
  if (D.11839 != 9) goto <D.11840>; else goto <D.11837>;
  <D.11840>:
  D.11841 = _wapi_handle_type (handle);
  if (D.11841 != 11) goto <D.11842>; else goto <D.11837>;
  <D.11842>:
  D.11843 = _wapi_handle_type (handle);
  if (D.11843 != 12) goto <D.11844>; else goto <D.11837>;
  <D.11844>:
  D.11845 = _wapi_handle_type (handle);
  if (D.11845 != 13) goto <D.11846>; else goto <D.11837>;
  <D.11846>:
  iftmp.4 = 1;
  goto <D.11838>;
  <D.11837>:
  iftmp.4 = 0;
  <D.11838>:
  D.11847 = iftmp.4 != 0;
  D.11848 = (long int) D.11847;
  D.11849 = __builtin_expect (D.11848, 0);
  if (D.11849 != 0) goto <D.11850>; else goto <D.11851>;
  <D.11850>:
  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.11851>:
  D.11852 = idx / 256;
  D.11853 = _wapi_private_handles[D.11852];
  D.11854 = (long unsigned int) idx;
  D.11855 = D.11854 & 255;
  D.11856 = D.11855 * 200;
  handle_data = D.11853 + D.11856;
  ref = &handle_data->u.shared;
  _wapi_shared_layout.5 = _wapi_shared_layout;
  D.11858 = ref->offset;
  shared_data = &_wapi_shared_layout.5->handles[D.11858];
  shared_data->signalled = state;
}


_wapi_handle_type (void * handle)
{
  long int handle.6;
  unsigned int D.11864;
  struct _WapiHandleUnshared * D.11865;
  WapiHandleType D.11866;
  unsigned int D.11867;
  struct _WapiHandleUnshared * D.11868;
  long unsigned int D.11869;
  long unsigned int D.11870;
  long unsigned int D.11871;
  struct _WapiHandleUnshared * D.11872;
  guint32 idx;

  handle.6 = (long int) handle;
  idx = (guint32) handle.6;
  if (idx > 4194303) goto <D.11861>; else goto <D.11863>;
  <D.11863>:
  D.11864 = idx / 256;
  D.11865 = _wapi_private_handles[D.11864];
  if (D.11865 == 0B) goto <D.11861>; else goto <D.11862>;
  <D.11861>:
  D.11866 = 0;
  return D.11866;
  <D.11862>:
  D.11867 = idx / 256;
  D.11868 = _wapi_private_handles[D.11867];
  D.11869 = (long unsigned int) idx;
  D.11870 = D.11869 & 255;
  D.11871 = D.11870 * 200;
  D.11872 = D.11868 + D.11871;
  D.11866 = D.11872->type;
  return D.11866;
}


_wapi_handle_unlock_shared_handles ()
{
  int D.11874;

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


process_close (void * handle, void * data)
{
  struct MonoProcess * D.11876;
  int D.11879;
  int D.11880;
  gint32 * D.11883;
  struct _WapiHandle_process * process_handle;

  process_handle = data;
  D.11876 = process_handle->mono_process;
  if (D.11876 != 0B) goto <D.11877>; else goto <D.11878>;
  <D.11877>:
  D.11879 = process_handle->self;
  D.11880 = _wapi_getpid ();
  if (D.11879 == D.11880) goto <D.11881>; else goto <D.11882>;
  <D.11881>:
  D.11876 = process_handle->mono_process;
  D.11883 = &D.11876->handle_count;
  InterlockedDecrement (D.11883);
  <D.11882>:
  <D.11878>:
  mono_processes_cleanup ();
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.11884;
  unsigned int D.11885;

  D.11885 = __sync_sub_and_fetch_4 (val, 1);
  D.11884 = (gint32) D.11885;
  return D.11884;
}


mono_processes_cleanup ()
{
  int D.11887;
  int D.11890;
  void * D.11893;
  int D.11901;
  unsigned int spin.7;
  struct MonoProcess * mono_processes.8;
  struct MonoProcess * mono_processes.9;
  int mono_processes_read_lock.10;
  union MonoSemType * D.11922;
  struct MonoProcess * mp;
  struct MonoProcess * prev;
  struct MonoProcess * candidate;
  void * unref_handle;
  int spin;

  prev = 0B;
  candidate = 0B;
  D.11887 = InterlockedCompareExchange (&mono_processes_cleaning_up, 1, 0);
  if (D.11887 != 0) goto <D.11888>; else goto <D.11889>;
  <D.11888>:
  return;
  <D.11889>:
  mp = mono_processes;
  goto <D.11670>;
  <D.11671>:
  D.11890 = mp->pid;
  if (D.11890 == 0) goto <D.11891>; else goto <D.11892>;
  <D.11891>:
  D.11893 = mp->handle;
  if (D.11893 != 0B) goto <D.11894>; else goto <D.11895>;
  <D.11894>:
  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.11896>; else goto <D.11897>;
  <D.11896>:
  _wapi_handle_unref (unref_handle);
  <D.11897>:
  // predicted unlikely by continue predictor.
  goto <D.11670>;
  <D.11895>:
  <D.11892>:
  mp = mp->next;
  <D.11670>:
  if (mp != 0B) goto <D.11671>; else goto <D.11672>;
  <D.11672>:
  mp = mono_processes;
  spin = 0;
  goto <D.11674>;
  <D.11675>:
  D.11901 = mp->handle_count;
  if (D.11901 == 0) goto <D.11902>; else goto <D.11898>;
  <D.11902>:
  D.11890 = mp->pid;
  if (D.11890 == 0) goto <D.11899>; else goto <D.11898>;
  <D.11898>:
  if (candidate != 0B) goto <D.11899>; else goto <D.11900>;
  <D.11899>:
  if (spin > 0) goto <D.11903>; else goto <D.11904>;
  <D.11903>:
  spin.7 = (unsigned int) spin;
  _wapi_handle_spin (spin.7);
  spin = spin << 1;
  <D.11904>:
  pthread_mutex_lock (&mono_processes_mutex);
  if (candidate == 0B) goto <D.11906>; else goto <D.11907>;
  <D.11906>:
  mono_processes.8 = mono_processes;
  if (mp == mono_processes.8) goto <D.11909>; else goto <D.11910>;
  <D.11909>:
  mono_processes.9 = mp->next;
  mono_processes = mono_processes.9;
  goto <D.11912>;
  <D.11910>:
  mono_processes.9 = mp->next;
  prev->next = mono_processes.9;
  <D.11912>:
  candidate = mp;
  <D.11907>:
  mono_memory_barrier ();
  mono_processes_read_lock.10 = mono_processes_read_lock;
  if (mono_processes_read_lock.10 != 0) goto <D.11914>; else goto <D.11915>;
  <D.11914>:
  if (spin == 0) goto <D.11916>; else goto <D.11917>;
  <D.11916>:
  spin = 1;
  goto <D.11918>;
  <D.11917>:
  if (spin > 7) goto <D.11919>; else goto <D.11920>;
  <D.11919>:
  pthread_mutex_unlock (&mono_processes_mutex);
  goto <D.11673>;
  <D.11920>:
  <D.11918>:
  goto <D.11921>;
  <D.11915>:
  mp = candidate->next;
  D.11922 = &candidate->exit_sem;
  sem_destroy (D.11922);
  monoeg_g_free (candidate);
  candidate = 0B;
  <D.11921>:
  pthread_mutex_unlock (&mono_processes_mutex);
  // predicted unlikely by continue predictor.
  goto <D.11674>;
  <D.11900>:
  spin = 0;
  prev = mp;
  mp = mp->next;
  <D.11674>:
  if (mp != 0B) goto <D.11675>; else goto <D.11673>;
  <D.11673>:
  InterlockedDecrement (&mono_processes_cleaning_up);
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.11924;
  unsigned int exch.11;
  unsigned int comp.12;
  unsigned int D.11927;

  exch.11 = (unsigned int) exch;
  comp.12 = (unsigned int) comp;
  D.11927 = __sync_val_compare_and_swap_4 (dest, comp.12, exch.11);
  D.11924 = (gint32) D.11927;
  return D.11924;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


ShellExecuteEx (struct WapiShellExecuteInfo * sei)
{
  gboolean D.11931;
  const gunichar2 * D.11932;
  const gunichar2 * D.11935;
  const gunichar2 * iftmp.13;
  const gunichar2 * utf16_quote.14;
  const gunichar2 * D.11943;
  unsigned int D.11946;
  gunichar2 * handler_utf16.15;
  gchar * handler.16;
  char * handler.17;
  gchar * handler.18;
  gchar * handler.19;
  gchar * handler.20;
  gunichar2 * handler_utf16.21;
  const gunichar2 * iftmp.22;
  const gunichar2 * utf16_space.23;
  unsigned int D.11975;
  void * D.11978;
  <unnamed type> D.11979;
  unsigned int D.11980;
  gboolean ret;
  struct WapiProcessInformation process_info;
  gunichar2 * args;

  try
    {
      if (sei == 0B) goto <D.11929>; else goto <D.11930>;
      <D.11929>:
      SetLastError (87);
      D.11931 = 0;
      return D.11931;
      <D.11930>:
      D.11932 = sei->lpFile;
      if (D.11932 == 0B) goto <D.11933>; else goto <D.11934>;
      <D.11933>:
      D.11931 = 1;
      return D.11931;
      <D.11934>:
      D.11935 = sei->lpParameters;
      D.11935 = sei->lpParameters;
      if (D.11935 != 0B) goto <D.11937>; else goto <D.11938>;
      <D.11937>:
      iftmp.13 = utf16_space;
      goto <D.11939>;
      <D.11938>:
      iftmp.13 = 0B;
      <D.11939>:
      utf16_quote.14 = utf16_quote;
      D.11932 = sei->lpFile;
      utf16_quote.14 = utf16_quote;
      args = utf16_concat (utf16_quote.14, D.11932, utf16_quote.14, iftmp.13, D.11935, 0B);
      if (args == 0B) goto <D.11941>; else goto <D.11942>;
      <D.11941>:
      SetLastError (13);
      D.11931 = 0;
      return D.11931;
      <D.11942>:
      D.11943 = sei->lpDirectory;
      ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.11943, 0B, &process_info);
      monoeg_g_free (args);
      if (ret == 0) goto <D.11944>; else goto <D.11945>;
      <D.11944>:
      D.11946 = GetLastError ();
      if (D.11946 == 14) goto <D.11947>; else goto <D.11948>;
      <D.11947>:
      D.11931 = ret;
      return D.11931;
      <D.11948>:
      <D.11945>:
      if (ret == 0) goto <D.11949>; else goto <D.11950>;
      <D.11949>:
      {
        static char * handler;
        static gunichar2 * handler_utf16;

        handler_utf16.15 = handler_utf16;
        if (handler_utf16.15 == -1B) goto <D.11952>; else goto <D.11953>;
        <D.11952>:
        D.11931 = 0;
        return D.11931;
        <D.11953>:
        handler.16 = monoeg_g_find_program_in_path ("xdg-open");
        handler = handler.16;
        handler.17 = handler;
        if (handler.17 == 0B) goto <D.11956>; else goto <D.11957>;
        <D.11956>:
        handler.18 = monoeg_g_find_program_in_path ("gnome-open");
        handler = handler.18;
        handler.17 = handler;
        if (handler.17 == 0B) goto <D.11959>; else goto <D.11960>;
        <D.11959>:
        handler.19 = monoeg_g_find_program_in_path ("kfmclient");
        handler = handler.19;
        handler.17 = handler;
        if (handler.17 == 0B) goto <D.11962>; else goto <D.11963>;
        <D.11962>:
        handler_utf16 = -1B;
        D.11931 = 0;
        return D.11931;
        <D.11963>:
        {
          char * old;

          old = handler;
          handler.20 = monoeg_g_strconcat (old, " exec", 0B);
          handler = handler.20;
          monoeg_g_free (old);
        }
        <D.11960>:
        <D.11957>:
        handler.17 = handler;
        handler_utf16.21 = monoeg_g_utf8_to_utf16 (handler.17, -1, 0B, 0B, 0B);
        handler_utf16 = handler_utf16.21;
        handler.17 = handler;
        monoeg_g_free (handler.17);
        D.11935 = sei->lpParameters;
        D.11935 = sei->lpParameters;
        if (D.11935 != 0B) goto <D.11967>; else goto <D.11968>;
        <D.11967>:
        iftmp.22 = utf16_space;
        goto <D.11969>;
        <D.11968>:
        iftmp.22 = 0B;
        <D.11969>:
        utf16_quote.14 = utf16_quote;
        D.11932 = sei->lpFile;
        utf16_quote.14 = utf16_quote;
        utf16_space.23 = utf16_space;
        handler_utf16.15 = handler_utf16;
        args = utf16_concat (handler_utf16.15, utf16_space.23, utf16_quote.14, D.11932, utf16_quote.14, iftmp.22, D.11935, 0B);
        if (args == 0B) goto <D.11971>; else goto <D.11972>;
        <D.11971>:
        SetLastError (13);
        D.11931 = 0;
        return D.11931;
        <D.11972>:
        D.11943 = sei->lpDirectory;
        ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.11943, 0B, &process_info);
        monoeg_g_free (args);
        if (ret == 0) goto <D.11973>; else goto <D.11974>;
        <D.11973>:
        D.11975 = GetLastError ();
        if (D.11975 != 14) goto <D.11976>; else goto <D.11977>;
        <D.11976>:
        SetLastError (13);
        <D.11977>:
        D.11931 = 0;
        return D.11931;
        <D.11974>:
        D.11978 = process_info.hProcess;
        CloseHandle (D.11978);
        process_info.hProcess = 0B;
      }
      <D.11950>:
      D.11979 = sei->fMask;
      D.11980 = D.11979 & 64;
      if (D.11980 != 0) goto <D.11981>; else goto <D.11982>;
      <D.11981>:
      D.11978 = process_info.hProcess;
      sei->hProcess = D.11978;
      goto <D.11983>;
      <D.11982>:
      D.11978 = process_info.hProcess;
      CloseHandle (D.11978);
      <D.11983>:
      D.11931 = ret;
      return D.11931;
    }
  finally
    {
      process_info = {CLOBBER};
    }
}


utf16_concat (const gunichar2 * first)
{
  int D.11986;
  void * addr.24;
  unsigned int D.11990;
  void * D.11992;
  sizetype D.11993;
  unsigned int D.11994;
  void * D.11995;
  void * D.11996;
  int D.11997;
  void * addr.25;
  unsigned int D.12001;
  sizetype D.12003;
  unsigned int D.12004;
  int D.12005;
  long unsigned int D.12006;
  long unsigned int D.12007;
  gunichar2 * D.12010;
  long unsigned int D.12011;
  long unsigned int D.12012;
  gunichar2 * D.12013;
  int i.26;
  long unsigned int D.12015;
  long unsigned int D.12016;
  gunichar2 * D.12017;
  short unsigned int D.12018;
  void * addr.27;
  unsigned int D.12022;
  sizetype D.12024;
  unsigned int D.12025;
  int i.28;
  long unsigned int D.12027;
  long unsigned int D.12028;
  gunichar2 * D.12029;
  short unsigned int D.12030;
  void * addr.29;
  unsigned int D.12034;
  sizetype D.12036;
  unsigned int D.12037;
  struct  args[1];
  int total;
  int i;
  const gunichar2 * s;
  gunichar2 * ret;

  try
    {
      total = 0;
      __builtin_va_start (&args, 0);
      D.11986 = len16 (first);
      total = D.11986 + total;
      D.11990 = args.gp_offset;
      if (D.11990 >= 48) goto <D.11988>; else goto <D.11991>;
      <D.11991>:
      D.11992 = args.reg_save_area;
      D.11990 = args.gp_offset;
      D.11993 = (sizetype) D.11990;
      addr.24 = D.11992 + D.11993;
      D.11990 = args.gp_offset;
      D.11994 = D.11990 + 8;
      args.gp_offset = D.11994;
      goto <D.11989>;
      <D.11988>:
      D.11995 = args.overflow_arg_area;
      addr.24 = D.11995;
      D.11996 = D.11995 + 8;
      args.overflow_arg_area = D.11996;
      <D.11989>:
      s = MEM[(gunichar2 * * {ref-all})addr.24];
      goto <D.11154>;
      <D.11153>:
      D.11997 = len16 (s);
      total = D.11997 + total;
      D.12001 = args.gp_offset;
      if (D.12001 >= 48) goto <D.11999>; else goto <D.12002>;
      <D.12002>:
      D.11992 = args.reg_save_area;
      D.12001 = args.gp_offset;
      D.12003 = (sizetype) D.12001;
      addr.25 = D.11992 + D.12003;
      D.12001 = args.gp_offset;
      D.12004 = D.12001 + 8;
      args.gp_offset = D.12004;
      goto <D.12000>;
      <D.11999>:
      D.11995 = args.overflow_arg_area;
      addr.25 = D.11995;
      D.11996 = D.11995 + 8;
      args.overflow_arg_area = D.11996;
      <D.12000>:
      s = MEM[(gunichar2 * * {ref-all})addr.25];
      <D.11154>:
      if (s != 0B) goto <D.11153>; else goto <D.11155>;
      <D.11155>:
      __builtin_va_end (&args);
      D.12005 = total + 1;
      D.12006 = (long unsigned int) D.12005;
      D.12007 = D.12006 * 2;
      ret = monoeg_malloc (D.12007);
      if (ret == 0B) goto <D.12008>; else goto <D.12009>;
      <D.12008>:
      D.12010 = 0B;
      return D.12010;
      <D.12009>:
      D.12011 = (long unsigned int) total;
      D.12012 = D.12011 * 2;
      D.12013 = ret + D.12012;
      *D.12013 = 0;
      i = 0;
      s = first;
      goto <D.11157>;
      <D.11156>:
      i.26 = i;
      i = i.26 + 1;
      D.12015 = (long unsigned int) i.26;
      D.12016 = D.12015 * 2;
      D.12017 = ret + D.12016;
      D.12018 = *s;
      *D.12017 = D.12018;
      s = s + 2;
      <D.11157>:
      D.12018 = *s;
      if (D.12018 != 0) goto <D.11156>; else goto <D.11158>;
      <D.11158>:
      __builtin_va_start (&args, 0);
      D.12022 = args.gp_offset;
      if (D.12022 >= 48) goto <D.12020>; else goto <D.12023>;
      <D.12023>:
      D.11992 = args.reg_save_area;
      D.12022 = args.gp_offset;
      D.12024 = (sizetype) D.12022;
      addr.27 = D.11992 + D.12024;
      D.12022 = args.gp_offset;
      D.12025 = D.12022 + 8;
      args.gp_offset = D.12025;
      goto <D.12021>;
      <D.12020>:
      D.11995 = args.overflow_arg_area;
      addr.27 = D.11995;
      D.11996 = D.11995 + 8;
      args.overflow_arg_area = D.11996;
      <D.12021>:
      s = MEM[(gunichar2 * * {ref-all})addr.27];
      goto <D.11164>;
      <D.11163>:
      {
        const gunichar2 * p;

        p = s;
        goto <D.11161>;
        <D.11160>:
        i.28 = i;
        i = i.28 + 1;
        D.12027 = (long unsigned int) i.28;
        D.12028 = D.12027 * 2;
        D.12029 = ret + D.12028;
        D.12030 = *p;
        *D.12029 = D.12030;
        p = p + 2;
        <D.11161>:
        D.12030 = *p;
        if (D.12030 != 0) goto <D.11160>; else goto <D.11162>;
        <D.11162>:
      }
      D.12034 = args.gp_offset;
      if (D.12034 >= 48) goto <D.12032>; else goto <D.12035>;
      <D.12035>:
      D.11992 = args.reg_save_area;
      D.12034 = args.gp_offset;
      D.12036 = (sizetype) D.12034;
      addr.29 = D.11992 + D.12036;
      D.12034 = args.gp_offset;
      D.12037 = D.12034 + 8;
      args.gp_offset = D.12037;
      goto <D.12033>;
      <D.12032>:
      D.11995 = args.overflow_arg_area;
      addr.29 = D.11995;
      D.11996 = D.11995 + 8;
      args.overflow_arg_area = D.11996;
      <D.12033>:
      s = MEM[(gunichar2 * * {ref-all})addr.29];
      <D.11164>:
      if (s != 0B) goto <D.11163>; else goto <D.11165>;
      <D.11165>:
      __builtin_va_end (&args);
      D.12010 = ret;
      return D.12010;
    }
  finally
    {
      args = {CLOBBER};
    }
}


len16 (const gunichar2 * str)
{
  const gunichar2 * str.30;
  short unsigned int D.12041;
  int D.12042;
  int len;

  len = 0;
  goto <D.11143>;
  <D.11142>:
  len = len + 1;
  <D.11143>:
  str.30 = str;
  str = str.30 + 2;
  D.12041 = *str.30;
  if (D.12041 != 0) goto <D.11142>; else goto <D.11144>;
  <D.11144>:
  D.12042 = len;
  return D.12042;
}


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

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


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.12060;
  const short unsigned int * D.12061;
  char D.12062;
  long unsigned int D.12063;
  long unsigned int D.12064;
  const short unsigned int * D.12065;
  short unsigned int D.12066;
  int D.12067;
  int D.12068;
  gchar * D.12071;
  char D.12072;
  long unsigned int D.12075;
  long unsigned int D.12076;
  const void * D.12077;
  long unsigned int D.12078;
  sizetype D.12079;
  gchar * D.12080;
  char D.12081;
  int D.12084;
  int D.12088;
  char D.12092;
  _Bool D.12093;
  _Bool D.12094;
  _Bool D.12095;
  sizetype D.12098;
  gchar * D.12099;
  char D.12100;
  unsigned int D.12104;
  sizetype D.12105;
  gchar * D.12106;
  char D.12107;
  long unsigned int D.12109;
  long unsigned int D.12110;
  const short unsigned int * D.12111;
  short unsigned int D.12112;
  int D.12113;
  int D.12114;
  unsigned int D.12115;
  long unsigned int D.12116;
  const gchar * D.12117;
  sizetype D.12118;
  gchar * D.12119;
  long unsigned int D.12122;
  long unsigned int D.12123;
  const short unsigned int * D.12124;
  short unsigned int D.12125;
  int D.12126;
  int D.12127;
  long unsigned int D.12130;
  char D.12133;
  char D.12138;
  long unsigned int D.12139;
  long unsigned int D.12140;
  const short unsigned int * D.12141;
  short unsigned int D.12142;
  int D.12143;
  int D.12144;
  gchar * D.12147;
  char D.12148;
  long unsigned int D.12151;
  long unsigned int D.12152;
  const void * D.12153;
  long unsigned int D.12154;
  sizetype D.12155;
  gchar * D.12156;
  int D.12159;
  int D.12163;
  int D.12168;
  const gunichar2 * utf16_space.31;
  char D.12182;
  struct GError * gerr.32;
  gchar * D.12187;
  <unnamed type> D.12191;
  unsigned int D.12192;
  void * D.12194;
  long int D.12195;
  void * D.12196;
  long int D.12197;
  void * D.12198;
  long int D.12199;
  void * D.12200;
  long int D.12201;
  void * D.12202;
  long int D.12203;
  void * D.12204;
  long int D.12205;
  short unsigned int D.12210;
  unsigned int D.12211;
  long unsigned int D.12212;
  long unsigned int D.12213;
  long unsigned int D.12214;
  long unsigned int D.12215;
  gchar * * D.12216;
  gchar * D.12217;
  char * * environ.33;
  long unsigned int D.12220;
  long unsigned int D.12221;
  char * * D.12222;
  char * D.12223;
  gchar * D.12224;
  long int handle.34;
  unsigned int D.12228;
  unsigned int D.12229;
  struct _WapiHandleUnshared * D.12230;
  long unsigned int D.12231;
  long unsigned int D.12232;
  long unsigned int D.12233;
  unsigned int D.12234;
  gchar * D.12235;
  int D.12236;
  int D.12239;
  _Bool D.12240;
  long int D.12241;
  long int D.12242;
  int D.12249;
  int D.12254;
  int D.12255;
  int i.35;
  int D.12259;
  gchar * * argv.36;
  gchar * D.12263;
  struct _WapiHandle_process * process_handle_data.37;
  union MonoSemType * D.12267;
  int D.12268;
  int * D.12271;
  int D.12272;
  char * D.12273;
  int D.12275;
  struct MonoProcess * mono_processes.38;
  unsigned int pid.39;
  gboolean D.12298;
  gchar * cmd;
  gchar * prog;
  gchar * full_prog;
  gchar * args;
  gchar * args_after_prog;
  gchar * dir;
  gchar * * env_strings;
  gchar * * argv;
  guint32 i;
  guint32 env_count;
  gboolean ret;
  void * handle;
  struct _WapiHandle_process process_handle;
  struct _WapiHandle_process * process_handle_data;
  struct GError * gerr;
  int in_fd;
  int out_fd;
  int err_fd;
  pid_t pid;
  int thr_ret;
  int startup_pipe[2];
  int dummy;
  struct MonoProcess * mono_process;
  gboolean fork_failed;
  void free_strings = <<< error >>>;
  static const char __func__[14] = "CreateProcess";
  void cleanup = <<< error >>>;

  try
    {
      cmd = 0B;
      prog = 0B;
      full_prog = 0B;
      args = 0B;
      args_after_prog = 0B;
      dir = 0B;
      env_strings = 0B;
      argv = 0B;
      env_count = 0;
      ret = 0;
      process_handle = {};
      gerr = 0B;
      startup_pipe[0] = -1;
      startup_pipe[1] = -1;
      fork_failed = 0;
      mono_once (&process_ops_once, process_ops_init);
      mono_once (&process_sig_chld_once, process_add_sigchld_handler);
      if (appname != 0B) goto <D.12046>; else goto <D.12047>;
      <D.12046>:
      cmd = mono_unicode_to_external (appname);
      if (cmd == 0B) goto <D.12048>; else goto <D.12049>;
      <D.12048>:
      SetLastError (3);
      goto free_strings;
      <D.12049>:
      switchDirectorySeparators (cmd);
      <D.12047>:
      if (cmdline != 0B) goto <D.12050>; else goto <D.12051>;
      <D.12050>:
      args = mono_unicode_to_external (cmdline);
      if (args == 0B) goto <D.12052>; else goto <D.12053>;
      <D.12052>:
      SetLastError (3);
      goto free_strings;
      <D.12053>:
      <D.12051>:
      if (cwd != 0B) goto <D.12054>; else goto <D.12055>;
      <D.12054>:
      dir = mono_unicode_to_external (cwd);
      if (dir == 0B) goto <D.12056>; else goto <D.12057>;
      <D.12056>:
      SetLastError (3);
      goto free_strings;
      <D.12057>:
      switchDirectorySeparators (dir);
      <D.12055>:
      if (cmd != 0B) goto <D.12058>; else goto <D.12059>;
      <D.12058>:
      {
        gchar * unquoted;

        D.12060 = __ctype_b_loc ();
        D.12061 = *D.12060;
        D.12062 = *cmd;
        D.12063 = (long unsigned int) D.12062;
        D.12064 = D.12063 * 2;
        D.12065 = D.12061 + D.12064;
        D.12066 = *D.12065;
        D.12067 = (int) D.12066;
        D.12068 = D.12067 & 1024;
        if (D.12068 != 0) goto <D.12069>; else goto <D.12070>;
        <D.12069>:
        D.12071 = cmd + 1;
        D.12072 = *D.12071;
        if (D.12072 == 58) goto <D.12073>; else goto <D.12074>;
        <D.12073>:
        D.12075 = strlen (cmd);
        D.12076 = D.12075 + 18446744073709551614;
        D.12077 = cmd + 2;
        memmove (cmd, D.12077, D.12076);
        D.12078 = strlen (cmd);
        D.12079 = D.12078 + 18446744073709551614;
        D.12080 = cmd + D.12079;
        *D.12080 = 0;
        <D.12074>:
        <D.12070>:
        unquoted = monoeg_g_shell_unquote (cmd, 0B);
        D.12081 = *unquoted;
        if (D.12081 == 47) goto <D.12082>; else goto <D.12083>;
        <D.12082>:
        prog = monoeg_strdup (unquoted);
        D.12084 = is_executable (prog);
        if (D.12084 == 0) goto <D.12085>; else goto <D.12086>;
        <D.12085>:
        monoeg_g_free (unquoted);
        SetLastError (2);
        goto free_strings;
        <D.12086>:
        goto <D.12087>;
        <D.12083>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, unquoted);
          monoeg_g_free (curdir);
          D.12088 = is_executable (prog);
          if (D.12088 == 0) goto <D.12089>; else goto <D.12090>;
          <D.12089>:
          monoeg_g_free (unquoted);
          SetLastError (2);
          goto free_strings;
          <D.12090>:
        }
        <D.12087>:
        monoeg_g_free (unquoted);
        args_after_prog = args;
      }
      goto <D.12091>;
      <D.12059>:
      {
        gchar * token;
        char quote;

        token = 0B;
        args = monoeg_g_strchug (args);
        args_after_prog = args;
        D.12092 = *args;
        D.12093 = D.12092 == 34;
        D.12094 = D.12092 == 39;
        D.12095 = D.12093 | D.12094;
        if (D.12095 != 0) goto <D.12096>; else goto <D.12097>;
        <D.12096>:
        quote = *args;
        i = 1;
        goto <D.11261>;
        <D.11260>:
        i = i + 1;
        <D.11261>:
        D.12098 = (sizetype) i;
        D.12099 = args + D.12098;
        D.12100 = *D.12099;
        if (D.12100 != 0) goto <D.12101>; else goto <D.11262>;
        <D.12101>:
        D.12098 = (sizetype) i;
        D.12099 = args + D.12098;
        D.12100 = *D.12099;
        if (D.12100 != quote) goto <D.11260>; else goto <D.11262>;
        <D.11262>:
        D.12104 = i + 1;
        D.12105 = (sizetype) D.12104;
        D.12106 = args + D.12105;
        D.12107 = *D.12106;
        if (D.12107 == 0) goto <D.12102>; else goto <D.12108>;
        <D.12108>:
        D.12060 = __ctype_b_loc ();
        D.12061 = *D.12060;
        D.12104 = i + 1;
        D.12105 = (sizetype) D.12104;
        D.12106 = args + D.12105;
        D.12107 = *D.12106;
        D.12109 = (long unsigned int) D.12107;
        D.12110 = D.12109 * 2;
        D.12111 = D.12061 + D.12110;
        D.12112 = *D.12111;
        D.12113 = (int) D.12112;
        D.12114 = D.12113 & 8192;
        if (D.12114 != 0) goto <D.12102>; else goto <D.12103>;
        <D.12102>:
        D.12115 = i + 4294967295;
        D.12116 = (long unsigned int) D.12115;
        D.12117 = args + 1;
        token = monoeg_g_strndup (D.12117, D.12116);
        D.12098 = (sizetype) i;
        D.12118 = D.12098 + 1;
        D.12119 = args + D.12118;
        args_after_prog = monoeg_g_strchug (D.12119);
        <D.12103>:
        <D.12097>:
        if (token == 0B) goto <D.12120>; else goto <D.12121>;
        <D.12120>:
        i = 0;
        goto <D.11265>;
        <D.11264>:
        D.12060 = __ctype_b_loc ();
        D.12061 = *D.12060;
        D.12098 = (sizetype) i;
        D.12099 = args + D.12098;
        D.12100 = *D.12099;
        D.12122 = (long unsigned int) D.12100;
        D.12123 = D.12122 * 2;
        D.12124 = D.12061 + D.12123;
        D.12125 = *D.12124;
        D.12126 = (int) D.12125;
        D.12127 = D.12126 & 8192;
        if (D.12127 != 0) goto <D.12128>; else goto <D.12129>;
        <D.12128>:
        D.12130 = (long unsigned int) i;
        token = monoeg_g_strndup (args, D.12130);
        D.12098 = (sizetype) i;
        D.12118 = D.12098 + 1;
        args_after_prog = args + D.12118;
        goto <D.11263>;
        <D.12129>:
        i = i + 1;
        <D.11265>:
        D.12098 = (sizetype) i;
        D.12099 = args + D.12098;
        D.12100 = *D.12099;
        if (D.12100 != 0) goto <D.11264>; else goto <D.11263>;
        <D.11263>:
        <D.12121>:
        if (token == 0B) goto <D.12131>; else goto <D.12132>;
        <D.12131>:
        D.12133 = *args;
        if (D.12133 != 0) goto <D.12134>; else goto <D.12135>;
        <D.12134>:
        token = monoeg_strdup (args);
        args_after_prog = 0B;
        <D.12135>:
        <D.12132>:
        if (token == 0B) goto <D.12136>; else goto <D.12137>;
        <D.12136>:
        SetLastError (3);
        goto free_strings;
        <D.12137>:
        switchDirectorySeparators (token);
        D.12060 = __ctype_b_loc ();
        D.12061 = *D.12060;
        D.12138 = *token;
        D.12139 = (long unsigned int) D.12138;
        D.12140 = D.12139 * 2;
        D.12141 = D.12061 + D.12140;
        D.12142 = *D.12141;
        D.12143 = (int) D.12142;
        D.12144 = D.12143 & 1024;
        if (D.12144 != 0) goto <D.12145>; else goto <D.12146>;
        <D.12145>:
        D.12147 = token + 1;
        D.12148 = *D.12147;
        if (D.12148 == 58) goto <D.12149>; else goto <D.12150>;
        <D.12149>:
        D.12151 = strlen (token);
        D.12152 = D.12151 + 18446744073709551614;
        D.12153 = token + 2;
        memmove (token, D.12153, D.12152);
        D.12154 = strlen (token);
        D.12155 = D.12154 + 18446744073709551614;
        D.12156 = token + D.12155;
        *D.12156 = 0;
        <D.12150>:
        <D.12146>:
        D.12138 = *token;
        if (D.12138 == 47) goto <D.12157>; else goto <D.12158>;
        <D.12157>:
        prog = monoeg_strdup (token);
        D.12159 = is_executable (prog);
        if (D.12159 == 0) goto <D.12160>; else goto <D.12161>;
        <D.12160>:
        monoeg_g_free (token);
        SetLastError (2);
        goto free_strings;
        <D.12161>:
        goto <D.12162>;
        <D.12158>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, token);
          monoeg_g_free (curdir);
          D.12163 = is_executable (prog);
          if (D.12163 == 0) goto <D.12164>; else goto <D.12165>;
          <D.12164>:
          monoeg_g_free (prog);
          prog = monoeg_g_find_program_in_path (token);
          if (prog == 0B) goto <D.12166>; else goto <D.12167>;
          <D.12166>:
          monoeg_g_free (token);
          SetLastError (2);
          goto free_strings;
          <D.12167>:
          <D.12165>:
        }
        <D.12162>:
        monoeg_g_free (token);
      }
      <D.12091>:
      D.12168 = is_managed_binary (prog);
      if (D.12168 != 0) goto <D.12169>; else goto <D.12170>;
      <D.12169>:
      {
        gunichar2 * newapp;
        gunichar2 * newcmd;
        gsize bytes_ignored;

        try
          {
            newapp = mono_unicode_from_external ("mono", &bytes_ignored);
            if (newapp != 0B) goto <D.12171>; else goto <D.12172>;
            <D.12171>:
            if (appname != 0B) goto <D.12173>; else goto <D.12174>;
            <D.12173>:
            utf16_space.31 = utf16_space;
            utf16_space.31 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.31, appname, utf16_space.31, cmdline, 0B);
            goto <D.12176>;
            <D.12174>:
            utf16_space.31 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.31, cmdline, 0B);
            <D.12176>:
            monoeg_g_free (newapp);
            if (newcmd != 0B) goto <D.12177>; else goto <D.12178>;
            <D.12177>:
            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.12178>:
            <D.12172>:
          }
        finally
          {
            bytes_ignored = {CLOBBER};
          }
      }
      <D.12170>:
      if (args_after_prog != 0B) goto <D.12181>; else goto <D.12179>;
      <D.12181>:
      D.12182 = *args_after_prog;
      if (D.12182 != 0) goto <D.12183>; else goto <D.12179>;
      <D.12183>:
      {
        gchar * qprog;

        qprog = monoeg_g_shell_quote (prog);
        full_prog = monoeg_g_strconcat (qprog, " ", args_after_prog, 0B);
        monoeg_g_free (qprog);
      }
      goto <D.12180>;
      <D.12179>:
      full_prog = monoeg_g_shell_quote (prog);
      <D.12180>:
      ret = monoeg_g_shell_parse_argv (full_prog, 0B, &argv, &gerr);
      if (ret == 0) goto <D.12184>; else goto <D.12185>;
      <D.12184>:
      gerr.32 = gerr;
      D.12187 = gerr.32->message;
      monoeg_g_log (0B, 32, "CreateProcess: %s\n", D.12187);
      gerr.32 = gerr;
      monoeg_g_error_free (gerr.32);
      gerr = 0B;
      goto free_strings;
      <D.12185>:
      if (startup != 0B) goto <D.12190>; else goto <D.12188>;
      <D.12190>:
      D.12191 = startup->dwFlags;
      D.12192 = D.12191 & 256;
      if (D.12192 != 0) goto <D.12193>; else goto <D.12188>;
      <D.12193>:
      D.12194 = startup->hStdInput;
      D.12195 = (long int) D.12194;
      in_fd = (int) D.12195;
      D.12196 = startup->hStdOutput;
      D.12197 = (long int) D.12196;
      out_fd = (int) D.12197;
      D.12198 = startup->hStdError;
      D.12199 = (long int) D.12198;
      err_fd = (int) D.12199;
      goto <D.12189>;
      <D.12188>:
      D.12200 = GetStdHandle (-10);
      D.12201 = (long int) D.12200;
      in_fd = (int) D.12201;
      D.12202 = GetStdHandle (-11);
      D.12203 = (long int) D.12202;
      out_fd = (int) D.12203;
      D.12204 = GetStdHandle (-12);
      D.12205 = (long int) D.12204;
      err_fd = (int) D.12205;
      <D.12189>:
      monoeg_g_strlcpy (&process_handle.proc_name, prog, 255);
      process_set_defaults (&process_handle);
      handle = _wapi_handle_new (9, &process_handle);
      if (handle == -1B) goto <D.12206>; else goto <D.12207>;
      <D.12206>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      ret = 0;
      SetLastError (14);
      goto free_strings;
      <D.12207>:
      if (new_environ != 0B) goto <D.12208>; else goto <D.12209>;
      <D.12208>:
      {
        gunichar2 * new_environp;

        new_environp = new_environ;
        goto <D.11277>;
        <D.11276>:
        env_count = env_count + 1;
        goto <D.11274>;
        <D.11273>:
        new_environp = new_environp + 2;
        <D.11274>:
        D.12210 = *new_environp;
        if (D.12210 != 0) goto <D.11273>; else goto <D.11275>;
        <D.11275>:
        new_environp = new_environp + 2;
        <D.11277>:
        D.12210 = *new_environp;
        if (D.12210 != 0) goto <D.11276>; else goto <D.11278>;
        <D.11278>:
        D.12211 = env_count + 2;
        D.12212 = (long unsigned int) D.12211;
        D.12213 = D.12212 * 8;
        env_strings = monoeg_malloc0 (D.12213);
        env_count = 0;
        new_environp = new_environ;
        goto <D.11283>;
        <D.11282>:
        D.12214 = (long unsigned int) env_count;
        D.12215 = D.12214 * 8;
        D.12216 = env_strings + D.12215;
        D.12217 = mono_unicode_to_external (new_environp);
        *D.12216 = D.12217;
        env_count = env_count + 1;
        goto <D.11280>;
        <D.11279>:
        new_environp = new_environp + 2;
        <D.11280>:
        D.12210 = *new_environp;
        if (D.12210 != 0) goto <D.11279>; else goto <D.11281>;
        <D.11281>:
        new_environp = new_environp + 2;
        <D.11283>:
        D.12210 = *new_environp;
        if (D.12210 != 0) goto <D.11282>; else goto <D.11284>;
        <D.11284>:
      }
      goto <D.12218>;
      <D.12209>:
      i = 0;
      goto <D.11286>;
      <D.11285>:
      env_count = env_count + 1;
      i = i + 1;
      <D.11286>:
      environ.33 = environ;
      D.12220 = (long unsigned int) i;
      D.12221 = D.12220 * 8;
      D.12222 = environ.33 + D.12221;
      D.12223 = *D.12222;
      if (D.12223 != 0B) goto <D.11285>; else goto <D.11287>;
      <D.11287>:
      D.12211 = env_count + 2;
      D.12212 = (long unsigned int) D.12211;
      D.12213 = D.12212 * 8;
      env_strings = monoeg_malloc0 (D.12213);
      env_count = 0;
      i = 0;
      goto <D.11289>;
      <D.11288>:
      D.12214 = (long unsigned int) env_count;
      D.12215 = D.12214 * 8;
      D.12216 = env_strings + D.12215;
      environ.33 = environ;
      D.12220 = (long unsigned int) i;
      D.12221 = D.12220 * 8;
      D.12222 = environ.33 + D.12221;
      D.12223 = *D.12222;
      D.12224 = monoeg_strdup (D.12223);
      *D.12216 = D.12224;
      env_count = env_count + 1;
      i = i + 1;
      <D.11289>:
      environ.33 = environ;
      D.12220 = (long unsigned int) i;
      D.12221 = D.12220 * 8;
      D.12222 = environ.33 + D.12221;
      D.12223 = *D.12222;
      if (D.12223 != 0B) goto <D.11288>; else goto <D.11290>;
      <D.11290>:
      <D.12218>:
      if (env_strings != 0B) goto <D.12225>; else goto <D.12226>;
      <D.12225>:
      {
        struct _WapiHandleUnshared * handle_data;
        struct _WapiHandle_shared_ref * ref;

        handle.34 = (long int) handle;
        D.12228 = (unsigned int) handle.34;
        D.12229 = D.12228 / 256;
        D.12230 = _wapi_private_handles[D.12229];
        handle.34 = (long int) handle;
        D.12228 = (unsigned int) handle.34;
        D.12231 = (long unsigned int) D.12228;
        D.12232 = D.12231 & 255;
        D.12233 = D.12232 * 200;
        handle_data = D.12230 + D.12233;
        ref = &handle_data->u.shared;
        D.12214 = (long unsigned int) env_count;
        D.12215 = D.12214 * 8;
        D.12216 = env_strings + D.12215;
        D.12234 = ref->offset;
        D.12235 = monoeg_g_strdup_printf ("_WAPI_PROCESS_HANDLE_OFFSET=%d", D.12234);
        *D.12216 = D.12235;
      }
      <D.12226>:
      D.12236 = pipe (&startup_pipe);
      if (D.12236 == -1) goto <D.12237>; else goto <D.12238>;
      <D.12237>:
      startup_pipe[1] = -1;
      D.12239 = startup_pipe[1];
      startup_pipe[0] = D.12239;
      <D.12238>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.12240 = thr_ret != 0;
      D.12241 = (long int) D.12240;
      D.12242 = __builtin_expect (D.12241, 0);
      if (D.12242 != 0) goto <D.12243>; else goto <D.12244>;
      <D.12243>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 965, "thr_ret == 0");
      <D.12244>:
      pid = fork ();
      if (pid == -1) goto <D.12245>; else goto <D.12246>;
      <D.12245>:
      SetLastError (14);
      ret = 0;
      fork_failed = 1;
      goto cleanup;
      <D.12246>:
      if (pid == 0) goto <D.12247>; else goto <D.12248>;
      <D.12247>:
      D.12249 = startup_pipe[0];
      if (D.12249 != -1) goto <D.12250>; else goto <D.12251>;
      <D.12250>:
      {
        ssize_t _i;

        D.12249 = startup_pipe[0];
        _i = read (D.12249, &dummy, 1);
        D.12249 = startup_pipe[0];
        close (D.12249);
        D.12239 = startup_pipe[1];
        close (D.12239);
      }
      <D.12251>:
      dup2 (in_fd, 0);
      dup2 (out_fd, 1);
      dup2 (err_fd, 2);
      if (inherit_handles != 1) goto <D.12252>; else goto <D.12253>;
      <D.12252>:
      <D.12253>:
      D.12254 = getdtablesize ();
      D.12255 = D.12254 + -1;
      i = (guint32) D.12255;
      goto <D.11296>;
      <D.11295>:
      i.35 = (int) i;
      close (i.35);
      i = i + 4294967295;
      <D.11296>:
      if (i > 2) goto <D.11295>; else goto <D.11297>;
      <D.11297>:
      if (dir != 0B) goto <D.12257>; else goto <D.12258>;
      <D.12257>:
      D.12259 = chdir (dir);
      if (D.12259 == -1) goto <D.12260>; else goto <D.12261>;
      <D.12260>:
      _exit (-1);
      <D.12261>:
      <D.12258>:
      argv.36 = argv;
      argv.36 = argv;
      D.12263 = *argv.36;
      execve (D.12263, argv.36, env_strings);
      _exit (-1);
      <D.12248>:
      ret = _wapi_lookup_handle (handle, 9, &process_handle_data);
      if (ret == 0) goto <D.12264>; else goto <D.12265>;
      <D.12264>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      _wapi_handle_unref (handle);
      goto cleanup;
      <D.12265>:
      process_handle_data.37 = process_handle_data;
      process_handle_data.37->id = pid;
      mono_process = monoeg_malloc0 (64);
      mono_process->pid = pid;
      mono_process->handle_count = 1;
      D.12267 = &mono_process->exit_sem;
      D.12268 = sem_init (D.12267, 0, 0);
      if (D.12268 != 0) goto <D.12269>; else goto <D.12270>;
      <D.12269>:
      D.12271 = __errno_location ();
      D.12272 = *D.12271;
      D.12273 = strerror (D.12272);
      monoeg_g_log (0B, 16, "%s: could not create exit semaphore for process.", D.12273);
      monoeg_g_free (mono_process);
      goto <D.12274>;
      <D.12270>:
      _wapi_handle_ref (handle);
      mono_process->handle = handle;
      process_handle_data.37 = process_handle_data;
      D.12275 = _wapi_getpid ();
      process_handle_data.37->self = D.12275;
      process_handle_data.37 = process_handle_data;
      process_handle_data.37->mono_process = mono_process;
      pthread_mutex_lock (&mono_processes_mutex);
      mono_processes.38 = mono_processes;
      mono_process->next = mono_processes.38;
      mono_processes = mono_process;
      pthread_mutex_unlock (&mono_processes_mutex);
      <D.12274>:
      if (process_info != 0B) goto <D.12277>; else goto <D.12278>;
      <D.12277>:
      process_info->hProcess = handle;
      pid.39 = (unsigned int) pid;
      process_info->dwProcessId = pid.39;
      process_info->hThread = -1B;
      process_info->dwThreadId = 0;
      <D.12278>:
      cleanup:
      _wapi_handle_unlock_shared_handles ();
      if (fork_failed != 0) goto <D.12280>; else goto <D.12281>;
      <D.12280>:
      _wapi_handle_unref (handle);
      <D.12281>:
      D.12239 = startup_pipe[1];
      if (D.12239 != -1) goto <D.12282>; else goto <D.12283>;
      <D.12282>:
      {
        ssize_t _i;

        D.12239 = startup_pipe[1];
        _i = write (D.12239, &startup_pipe, 1);
        D.12249 = startup_pipe[0];
        close (D.12249);
        D.12239 = startup_pipe[1];
        close (D.12239);
      }
      <D.12283>:
      free_strings:
      if (cmd != 0B) goto <D.12284>; else goto <D.12285>;
      <D.12284>:
      monoeg_g_free (cmd);
      <D.12285>:
      if (full_prog != 0B) goto <D.12286>; else goto <D.12287>;
      <D.12286>:
      monoeg_g_free (full_prog);
      <D.12287>:
      if (prog != 0B) goto <D.12288>; else goto <D.12289>;
      <D.12288>:
      monoeg_g_free (prog);
      <D.12289>:
      if (args != 0B) goto <D.12290>; else goto <D.12291>;
      <D.12290>:
      monoeg_g_free (args);
      <D.12291>:
      if (dir != 0B) goto <D.12292>; else goto <D.12293>;
      <D.12292>:
      monoeg_g_free (dir);
      <D.12293>:
      if (env_strings != 0B) goto <D.12294>; else goto <D.12295>;
      <D.12294>:
      monoeg_g_strfreev (env_strings);
      <D.12295>:
      argv.36 = argv;
      if (argv.36 != 0B) goto <D.12296>; else goto <D.12297>;
      <D.12296>:
      argv.36 = argv;
      monoeg_g_strfreev (argv.36);
      <D.12297>:
      mono_processes_cleanup ();
      D.12298 = ret;
      return D.12298;
    }
  finally
    {
      argv = {CLOBBER};
      process_handle = {CLOBBER};
      process_handle_data = {CLOBBER};
      gerr = {CLOBBER};
      startup_pipe = {CLOBBER};
      dummy = {CLOBBER};
    }
}


process_add_sigchld_handler ()
{
  int D.12303;
  _Bool D.12304;
  long int D.12305;
  long int D.12306;
  struct sigaction sa;

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


mono_sigchld_signal_handler (int _dummy, struct siginfo_t * info, void * context)
{
  int * D.12310;
  int D.12311;
  int D.12313;
  int status.40;
  union MonoSemType * D.12317;
  int status;
  int pid;
  struct MonoProcess * p;

  try
    {
      InterlockedIncrement (&mono_processes_read_lock);
      <D.11695>:
      <D.11689>:
      pid = waitpid (-1, &status, 1);
      if (pid == -1) goto <D.12309>; else goto <D.11690>;
      <D.12309>:
      D.12310 = __errno_location ();
      D.12311 = *D.12310;
      if (D.12311 == 4) goto <D.11689>; else goto <D.11690>;
      <D.11690>:
      if (pid <= 0) goto <D.11691>; else goto <D.12312>;
      <D.12312>:
      p = mono_processes;
      goto <D.11694>;
      <D.11693>:
      D.12313 = p->pid;
      if (D.12313 == pid) goto <D.12314>; else goto <D.12315>;
      <D.12314>:
      p->pid = 0;
      status.40 = status;
      p->status = status.40;
      D.12317 = &p->exit_sem;
      mono_sem_post (D.12317);
      goto <D.11692>;
      <D.12315>:
      p = p->next;
      <D.11694>:
      if (p != 0B) goto <D.11693>; else goto <D.11692>;
      <D.11692>:
      goto <D.11695>;
      <D.11691>:
      InterlockedDecrement (&mono_processes_read_lock);
    }
  finally
    {
      status = {CLOBBER};
    }
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.12318;
  unsigned int D.12319;

  D.12319 = __sync_add_and_fetch_4 (val, 1);
  D.12318 = (gint32) D.12319;
  return D.12318;
}


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


switchDirectorySeparators (gchar * path)
{
  gchar * D.12321;
  char D.12322;
  long unsigned int D.12325;
  sizetype D.12328;
  gchar * D.12329;
  char D.12330;
  size_t i;
  size_t pathLength;

  pathLength = strlen (path);
  i = 0;
  goto <D.11217>;
  <D.11216>:
  D.12321 = path + i;
  D.12322 = *D.12321;
  if (D.12322 == 92) goto <D.12323>; else goto <D.12324>;
  <D.12323>:
  D.12325 = pathLength + 18446744073709551615;
  if (D.12325 > i) goto <D.12326>; else goto <D.12327>;
  <D.12326>:
  D.12328 = i + 1;
  D.12329 = path + D.12328;
  D.12330 = *D.12329;
  if (D.12330 != 39) goto <D.12331>; else goto <D.12332>;
  <D.12331>:
  D.12321 = path + i;
  *D.12321 = 47;
  <D.12332>:
  <D.12327>:
  <D.12324>:
  i = i + 1;
  <D.11217>:
  if (i < pathLength) goto <D.11216>; else goto <D.11218>;
  <D.11218>:
}


memmove (void * __dest, const void * __src, size_t __len)
{
  void * D.12333;
  long unsigned int D.12334;

  D.12334 = __builtin_object_size (__dest, 0);
  D.12333 = __builtin___memmove_chk (__dest, __src, __len, D.12334);
  return D.12333;
}


is_executable (const char * prog)
{
  int D.12336;
  gboolean D.12339;
  int D.12340;
  unsigned int D.12343;
  unsigned int D.12344;
  struct stat buf;

  try
    {
      D.12336 = access (prog, 1);
      if (D.12336 != 0) goto <D.12337>; else goto <D.12338>;
      <D.12337>:
      D.12339 = 0;
      return D.12339;
      <D.12338>:
      D.12340 = stat (prog, &buf);
      if (D.12340 != 0) goto <D.12341>; else goto <D.12342>;
      <D.12341>:
      D.12339 = 0;
      return D.12339;
      <D.12342>:
      D.12343 = buf.st_mode;
      D.12344 = D.12343 & 61440;
      if (D.12344 == 32768) goto <D.12345>; else goto <D.12346>;
      <D.12345>:
      D.12339 = 1;
      return D.12339;
      <D.12346>:
      D.12339 = 0;
      return D.12339;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


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

  D.12349 = __xstat (1, __path, __statbuf);
  return D.12349;
}


is_managed_binary (const gchar * filename)
{
  int * D.12351;
  gboolean D.12354;
  long int D.12356;
  unsigned char D.12358;
  unsigned char D.12360;
  long int D.12363;
  int D.12365;
  int D.12366;
  int D.12367;
  int D.12368;
  unsigned char D.12369;
  int D.12370;
  int D.12371;
  int D.12372;
  unsigned char D.12373;
  int D.12374;
  int D.12375;
  int D.12376;
  long int D.12377;
  long int D.12380;
  long int D.12386;
  long int D.12388;
  long int D.12391;
  long int D.12393;
  unsigned char * D.12394;
  unsigned char * D.12395;
  _Bool D.12396;
  _Bool D.12397;
  _Bool D.12398;
  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.12351 = __errno_location ();
      original_errno = *D.12351;
      file = open (filename, 0);
      managed = 0;
      if (file < 0) goto <D.12352>; else goto <D.12353>;
      <D.12352>:
      D.12351 = __errno_location ();
      *D.12351 = original_errno;
      D.12354 = 0;
      return D.12354;
      <D.12353>:
      file_size = lseek (file, 0, 2);
      lseek (file, 0, 0);
      if (file_size <= 63) goto leave; else goto <D.12355>;
      <D.12355>:
      D.12356 = read (file, &buffer, 2);
      num_read = (int) D.12356;
      if (num_read != 2) goto leave; else goto <D.12357>;
      <D.12357>:
      D.12358 = buffer[0];
      if (D.12358 != 77) goto leave; else goto <D.12359>;
      <D.12359>:
      D.12360 = buffer[1];
      if (D.12360 != 90) goto leave; else goto <D.12361>;
      <D.12361>:
      new_offset = lseek (file, 60, 0);
      if (new_offset != 60) goto leave; else goto <D.12362>;
      <D.12362>:
      D.12363 = read (file, &buffer, 4);
      num_read = (int) D.12363;
      if (num_read != 4) goto leave; else goto <D.12364>;
      <D.12364>:
      D.12358 = buffer[0];
      D.12365 = (int) D.12358;
      D.12360 = buffer[1];
      D.12366 = (int) D.12360;
      D.12367 = D.12366 << 8;
      D.12368 = D.12365 | D.12367;
      D.12369 = buffer[2];
      D.12370 = (int) D.12369;
      D.12371 = D.12370 << 16;
      D.12372 = D.12368 | D.12371;
      D.12373 = buffer[3];
      D.12374 = (int) D.12373;
      D.12375 = D.12374 << 24;
      D.12376 = D.12372 | D.12375;
      pe_header_offset = (off_t) D.12376;
      D.12377 = pe_header_offset + 23;
      if (D.12377 >= file_size) goto leave; else goto <D.12378>;
      <D.12378>:
      new_offset = lseek (file, pe_header_offset, 0);
      if (new_offset != pe_header_offset) goto leave; else goto <D.12379>;
      <D.12379>:
      D.12380 = read (file, &buffer, 4);
      num_read = (int) D.12380;
      if (num_read != 4) goto leave; else goto <D.12381>;
      <D.12381>:
      D.12358 = buffer[0];
      if (D.12358 != 80) goto leave; else goto <D.12382>;
      <D.12382>:
      D.12360 = buffer[1];
      if (D.12360 != 69) goto leave; else goto <D.12383>;
      <D.12383>:
      D.12369 = buffer[2];
      if (D.12369 != 0) goto leave; else goto <D.12384>;
      <D.12384>:
      D.12373 = buffer[3];
      if (D.12373 != 0) goto leave; else goto <D.12385>;
      <D.12385>:
      D.12386 = pe_header_offset + 20;
      new_offset = lseek (file, D.12386, 0);
      D.12386 = pe_header_offset + 20;
      if (D.12386 != new_offset) goto leave; else goto <D.12387>;
      <D.12387>:
      D.12388 = read (file, &buffer, 2);
      num_read = (int) D.12388;
      if (num_read != 2) goto leave; else goto <D.12389>;
      <D.12389>:
      D.12358 = buffer[0];
      D.12365 = (int) D.12358;
      D.12360 = buffer[1];
      D.12366 = (int) D.12360;
      D.12367 = D.12366 << 8;
      D.12368 = D.12365 | D.12367;
      if (D.12368 <= 215) goto leave; else goto <D.12390>;
      <D.12390>:
      optional_header_offset = pe_header_offset + 24;
      D.12391 = optional_header_offset + 208;
      new_offset = lseek (file, D.12391, 0);
      D.12391 = optional_header_offset + 208;
      if (D.12391 != new_offset) goto leave; else goto <D.12392>;
      <D.12392>:
      D.12393 = read (file, &buffer, 8);
      num_read = (int) D.12393;
      D.12394 = &buffer[0];
      first_word = MEM[(guint32 *)D.12394];
      D.12395 = &buffer[4];
      second_word = MEM[(guint32 *)D.12395];
      D.12396 = num_read != 8;
      D.12397 = first_word == 0;
      D.12398 = D.12396 | D.12397;
      if (D.12398 != 0) goto leave; else goto <D.12399>;
      <D.12399>:
      if (second_word == 0) goto leave; else goto <D.12400>;
      <D.12400>:
      managed = 1;
      leave:
      close (file);
      D.12351 = __errno_location ();
      *D.12351 = original_errno;
      D.12354 = managed;
      return D.12354;
    }
  finally
    {
      buffer = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.12403;
  int D.12406;
  int D.12411;
  int D.12413;
  int D.12414;
  int D.12417;
  int D.12418;

  D.12403 = __builtin_va_arg_pack_len ();
  if (D.12403 > 1) goto <D.12404>; else goto <D.12405>;
  <D.12404>:
  __open_too_many_args ();
  <D.12405>:
  D.12406 = __builtin_constant_p (__oflag);
  if (D.12406 != 0) goto <D.12407>; else goto <D.12408>;
  <D.12407>:
  D.12411 = __oflag & 64;
  if (D.12411 != 0) goto <D.12409>; else goto <D.12412>;
  <D.12412>:
  D.12413 = __oflag & 4259840;
  if (D.12413 == 4259840) goto <D.12409>; else goto <D.12410>;
  <D.12409>:
  D.12414 = __builtin_va_arg_pack_len ();
  if (D.12414 <= 0) goto <D.12415>; else goto <D.12416>;
  <D.12415>:
  __open_missing_mode ();
  D.12417 = __open_2 (__path, __oflag);
  return D.12417;
  <D.12416>:
  <D.12410>:
  D.12417 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.12417;
  <D.12408>:
  D.12418 = __builtin_va_arg_pack_len ();
  if (D.12418 <= 0) goto <D.12419>; else goto <D.12420>;
  <D.12419>:
  D.12417 = __open_2 (__path, __oflag);
  return D.12417;
  <D.12420>:
  D.12417 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.12417;
}


process_set_defaults (struct _WapiHandle_process * process_handle)
{
  struct WapiFileTime * D.12422;
  long int D.12423;

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


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

  if (str != 0B) goto <D.12424>; else goto <D.12425>;
  <D.12424>:
  D.12426 = __strdup (str);
  return D.12426;
  <D.12425>:
  D.12426 = 0B;
  return D.12426;
}


read (int __fd, void * __buf, size_t __nbytes)
{
  long unsigned int D.12428;
  int D.12431;
  ssize_t D.12434;
  long unsigned int D.12435;
  long unsigned int D.12436;
  long unsigned int D.12439;

  D.12428 = __builtin_object_size (__buf, 0);
  if (D.12428 != 18446744073709551615) goto <D.12429>; else goto <D.12430>;
  <D.12429>:
  D.12431 = __builtin_constant_p (__nbytes);
  if (D.12431 == 0) goto <D.12432>; else goto <D.12433>;
  <D.12432>:
  D.12435 = __builtin_object_size (__buf, 0);
  D.12434 = __read_chk (__fd, __buf, __nbytes, D.12435);
  return D.12434;
  <D.12433>:
  D.12436 = __builtin_object_size (__buf, 0);
  if (D.12436 < __nbytes) goto <D.12437>; else goto <D.12438>;
  <D.12437>:
  D.12439 = __builtin_object_size (__buf, 0);
  D.12434 = __read_chk_warn (__fd, __buf, __nbytes, D.12439);
  return D.12434;
  <D.12438>:
  <D.12430>:
  D.12434 = __read_alias (__fd, __buf, __nbytes);
  return D.12434;
}


_wapi_process_duplicate ()
{
  void * current_process.41;
  void * D.12442;

  mono_once (&process_current_once, process_set_current);
  current_process.41 = current_process;
  _wapi_handle_ref (current_process.41);
  D.12442 = current_process;
  return D.12442;
}


process_set_current ()
{
  int D.12446;
  unsigned int D.12447;
  void * current_process.42;
  void * current_process.43;
  struct _WapiHandle_process * process_handlep.44;
  int D.12453;
  int D.11325;
  int iftmp.45;
  int D.11324;
  const char[5] * D.12459;
  unsigned char D.12460;
  int D.12461;
  unsigned char D.12462;
  int D.12463;
  _Bool D.12464;
  _Bool D.12465;
  _Bool D.12466;
  const unsigned char * D.12469;
  unsigned char D.12470;
  int D.12471;
  const unsigned char * D.12472;
  unsigned char D.12473;
  int D.12474;
  _Bool D.12475;
  _Bool D.12476;
  const unsigned char * D.12479;
  unsigned char D.12480;
  int D.12481;
  const unsigned char * D.12482;
  unsigned char D.12483;
  int D.12484;
  _Bool D.12485;
  _Bool D.12486;
  const unsigned char * D.12489;
  unsigned char D.12490;
  int D.12491;
  const unsigned char * D.12492;
  unsigned char D.12493;
  int D.12494;
  void * current_process.46;
  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.12444>; else goto <D.12445>;
      <D.12444>:
      {
        struct _WapiHandle_process * process_handlep;
        gchar * procname;
        gboolean ok;

        try
          {
            procname = 0B;
            D.12446 = atoi (handle_env);
            D.12447 = (unsigned int) D.12446;
            current_process.42 = _wapi_handle_new_from_offset (9, D.12447, 1);
            current_process = current_process.42;
            current_process.43 = current_process;
            ok = _wapi_lookup_handle (current_process.43, 9, &process_handlep);
            if (ok != 0) goto <D.12450>; else goto <D.12451>;
            <D.12450>:
            process_handlep.44 = process_handlep;
            D.12453 = process_handlep.44->id;
            if (D.12453 == pid) goto <D.12454>; else goto <D.12455>;
            <D.12454>:
            process_handlep.44 = process_handlep;
            procname = &process_handlep.44->proc_name;
            {
              size_t __s1_len;
              size_t __s2_len;

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

                __s2 = procname;
                D.12459 = "mono";
                D.12460 = MEM[(const unsigned char *)D.12459];
                D.12461 = (int) D.12460;
                D.12462 = *__s2;
                D.12463 = (int) D.12462;
                __result = D.12461 - D.12463;
                {
                  D.12464 = __s2_len != 0;
                  D.12465 = __result == 0;
                  D.12466 = D.12464 & D.12465;
                  if (D.12466 != 0) goto <D.12467>; else goto <D.12468>;
                  <D.12467>:
                  D.12469 = &MEM[(void *)"mono" + 1B];
                  D.12470 = *D.12469;
                  D.12471 = (int) D.12470;
                  D.12472 = __s2 + 1;
                  D.12473 = *D.12472;
                  D.12474 = (int) D.12473;
                  __result = D.12471 - D.12474;
                  D.12475 = __s2_len > 1;
                  D.12465 = __result == 0;
                  D.12476 = D.12475 & D.12465;
                  if (D.12476 != 0) goto <D.12477>; else goto <D.12478>;
                  <D.12477>:
                  D.12479 = &MEM[(void *)"mono" + 2B];
                  D.12480 = *D.12479;
                  D.12481 = (int) D.12480;
                  D.12482 = __s2 + 2;
                  D.12483 = *D.12482;
                  D.12484 = (int) D.12483;
                  __result = D.12481 - D.12484;
                  D.12485 = __s2_len > 2;
                  D.12465 = __result == 0;
                  D.12486 = D.12485 & D.12465;
                  if (D.12486 != 0) goto <D.12487>; else goto <D.12488>;
                  <D.12487>:
                  D.12489 = &MEM[(void *)"mono" + 3B];
                  D.12490 = *D.12489;
                  D.12491 = (int) D.12490;
                  D.12492 = __s2 + 3;
                  D.12493 = *D.12492;
                  D.12494 = (int) D.12493;
                  __result = D.12491 - D.12494;
                  <D.12488>:
                  <D.12478>:
                  <D.12468>:
                }
                D.11324 = __result;
              }
              iftmp.45 = -D.11324;
              goto <D.12495>;
              <D.12458>:
              iftmp.45 = __builtin_strcmp (procname, "mono");
              <D.12495>:
              D.11325 = iftmp.45;
            }
            if (D.11325 == 0) goto <D.12496>; else goto <D.12497>;
            <D.12496>:
            process_handlep.44 = process_handlep;
            process_set_name (process_handlep.44);
            goto <D.12498>;
            <D.12497>:
            <D.12498>:
            return;
            <D.12455>:
            current_process.43 = current_process;
            _wapi_handle_unref (current_process.43);
            <D.12451>:
          }
        finally
          {
            process_handlep = {CLOBBER};
          }
      }
      <D.12445>:
      process_handle.id = pid;
      process_set_defaults (&process_handle);
      process_set_name (&process_handle);
      current_process.46 = _wapi_handle_new (9, &process_handle);
      current_process = current_process.46;
      current_process.43 = current_process;
      if (current_process.43 == -1B) goto <D.12500>; else goto <D.12501>;
      <D.12500>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      return;
      <D.12501>:
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


atoi (const char * __nptr)
{
  int D.12507;
  long int D.12508;

  D.12508 = strtol (__nptr, 0B, 10);
  D.12507 = (int) D.12508;
  return D.12507;
}


process_set_name (struct _WapiHandle_process * process_handle)
{
  const gchar * D.12514;
  gchar[256] * D.12515;
  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.12510>; else goto <D.12511>;
  <D.12510>:
  slash = strrchr (utf8_progname, 47);
  if (slash != 0B) goto <D.12512>; else goto <D.12513>;
  <D.12512>:
  D.12514 = slash + 1;
  D.12515 = &process_handle->proc_name;
  monoeg_g_strlcpy (D.12515, D.12514, 255);
  goto <D.12516>;
  <D.12513>:
  D.12515 = &process_handle->proc_name;
  monoeg_g_strlcpy (D.12515, utf8_progname, 255);
  <D.12516>:
  monoeg_g_free (utf8_progname);
  <D.12511>:
}


GetCurrentProcess ()
{
  void * D.12517;

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


GetProcessId (void * handle)
{
  long int handle.47;
  signed int D.12520;
  guint32 D.12523;
  unsigned int D.12524;
  struct _WapiHandle_process * process_handle.48;
  int D.12528;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.47 = (long int) handle;
      D.12520 = (signed int) handle.47;
      if (D.12520 < 0) goto <D.12521>; else goto <D.12522>;
      <D.12521>:
      handle.47 = (long int) handle;
      D.12524 = (unsigned int) handle.47;
      D.12523 = D.12524 & 2147483647;
      return D.12523;
      <D.12522>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.12525>; else goto <D.12526>;
      <D.12525>:
      SetLastError (6);
      D.12523 = 0;
      return D.12523;
      <D.12526>:
      process_handle.48 = process_handle;
      D.12528 = process_handle.48->id;
      D.12523 = (guint32) D.12528;
      return D.12523;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetCurrentProcessId ()
{
  guint32 D.12531;
  void * current_process.49;

  mono_once (&process_current_once, process_set_current);
  current_process.49 = current_process;
  D.12531 = GetProcessId (current_process.49);
  return D.12531;
}


EnumProcesses (guint32 * pids, guint32 len, guint32 * needed)
{
  gboolean D.12536;
  const short unsigned int * * D.12537;
  const short unsigned int * D.12538;
  char D.12539;
  long unsigned int D.12540;
  long unsigned int D.12541;
  const short unsigned int * D.12542;
  short unsigned int D.12543;
  int D.12544;
  int D.12545;
  char[256] * D.12548;
  long int D.12549;
  char * endptr.50;
  char D.12551;
  unsigned int i.51;
  long unsigned int D.12555;
  long unsigned int D.12556;
  guint32 * D.12557;
  unsigned int pid.52;
  unsigned int D.12560;
  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.12534>; else goto <D.12535>;
  <D.12534>:
  D.12536 = 0;
  return D.12536;
  <D.12535>:
  i = 0;
  fit = len / 4;
  goto <D.11356>;
  <D.11357>:
  {
    pid_t pid;
    char * endptr;

    try
      {
        D.12537 = __ctype_b_loc ();
        D.12538 = *D.12537;
        D.12539 = entry->d_name[0];
        D.12540 = (long unsigned int) D.12539;
        D.12541 = D.12540 * 2;
        D.12542 = D.12538 + D.12541;
        D.12543 = *D.12542;
        D.12544 = (int) D.12543;
        D.12545 = D.12544 & 2048;
        if (D.12545 == 0) goto <D.12546>; else goto <D.12547>;
        <D.12546>:
        // predicted unlikely by continue predictor.
        goto <D.11356>;
        <D.12547>:
        D.12548 = &entry->d_name;
        D.12549 = strtol (D.12548, &endptr, 10);
        pid = (pid_t) D.12549;
        endptr.50 = endptr;
        D.12551 = *endptr.50;
        if (D.12551 == 0) goto <D.12552>; else goto <D.12553>;
        <D.12552>:
        i.51 = i;
        i = i.51 + 1;
        D.12555 = (long unsigned int) i.51;
        D.12556 = D.12555 * 4;
        D.12557 = pids + D.12556;
        pid.52 = (unsigned int) pid;
        *D.12557 = pid.52;
        <D.12553>:
      }
    finally
      {
        endptr = {CLOBBER};
      }
  }
  <D.11356>:
  if (i < fit) goto <D.12559>; else goto <D.11358>;
  <D.12559>:
  entry = readdir (dir);
  if (entry != 0B) goto <D.11357>; else goto <D.11358>;
  <D.11358>:
  closedir (dir);
  D.12560 = i * 4;
  *needed = D.12560;
  D.12536 = 1;
  return D.12536;
}


CloseProcess (void * handle)
{
  long int handle.53;
  signed int D.12565;
  gboolean D.12568;

  handle.53 = (long int) handle;
  D.12565 = (signed int) handle.53;
  if (D.12565 < 0) goto <D.12566>; else goto <D.12567>;
  <D.12566>:
  D.12568 = 1;
  return D.12568;
  <D.12567>:
  D.12568 = CloseHandle (handle);
  return D.12568;
}


OpenProcess (guint32 req_access, gboolean inherit, guint32 pid)
{
  long unsigned int D.12570;
  void * D.12571;
  int pid.54;
  int D.12575;
  void * D.12578;
  unsigned int D.12579;
  long int D.12580;
  void * handle;

  handle = 0B;
  mono_once (&process_current_once, process_set_current);
  D.12570 = (long unsigned int) pid;
  D.12571 = (void *) D.12570;
  handle = _wapi_search_handle (9, process_open_compare, D.12571, 0B, 1);
  if (handle == 0B) goto <D.12572>; else goto <D.12573>;
  <D.12572>:
  pid.54 = (int) pid;
  D.12575 = is_pid_valid (pid.54);
  if (D.12575 != 0) goto <D.12576>; else goto <D.12577>;
  <D.12576>:
  D.12579 = pid + 2147483648;
  D.12580 = (long int) D.12579;
  D.12578 = (void *) D.12580;
  return D.12578;
  <D.12577>:
  SetLastError (127);
  D.12578 = 0B;
  return D.12578;
  <D.12573>:
  D.12578 = handle;
  return D.12578;
}


process_open_compare (void * handle, void * user_data)
{
  gboolean D.12584;
  long int user_data.55;
  int D.12588;
  pid_t wanted_pid;
  pid_t checking_pid;

  checking_pid = signal_process_if_gone (handle);
  if (checking_pid == 0) goto <D.12582>; else goto <D.12583>;
  <D.12582>:
  D.12584 = 0;
  return D.12584;
  <D.12583>:
  user_data.55 = (long int) user_data;
  wanted_pid = (pid_t) user_data.55;
  if (checking_pid == wanted_pid) goto <D.12587>; else goto <D.12586>;
  <D.12587>:
  D.12588 = _wapi_handle_issignalled (handle);
  if (D.12588 == 0) goto <D.12589>; else goto <D.12586>;
  <D.12589>:
  D.12584 = 1;
  return D.12584;
  <D.12586>:
  D.12584 = 0;
  return D.12584;
}


signal_process_if_gone (void * handle)
{
  long int handle.56;
  signed int D.12592;
  _Bool D.12593;
  long int D.12594;
  long int D.12595;
  pid_t D.12600;
  struct _WapiHandle_process * process_handle.57;
  int D.12602;
  int D.12603;
  int * D.12606;
  int D.12607;
  _Bool D.12608;
  _Bool D.12609;
  _Bool D.12610;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.56 = (long int) handle;
      D.12592 = (signed int) handle.56;
      D.12593 = D.12592 < 0;
      D.12594 = (long int) D.12593;
      D.12595 = __builtin_expect (D.12594, 0);
      if (D.12595 != 0) goto <D.12596>; else goto <D.12597>;
      <D.12596>:
      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.12597>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.12598>; else goto <D.12599>;
      <D.12598>:
      D.12600 = 0;
      return D.12600;
      <D.12599>:
      process_handle.57 = process_handle;
      D.12602 = process_handle.57->id;
      D.12603 = kill (D.12602, 0);
      if (D.12603 == -1) goto <D.12604>; else goto <D.12605>;
      <D.12604>:
      D.12606 = __errno_location ();
      D.12607 = *D.12606;
      D.12608 = D.12607 == 3;
      D.12609 = D.12607 == 1;
      D.12610 = D.12608 | D.12609;
      if (D.12610 != 0) goto <D.12611>; else goto <D.12612>;
      <D.12611>:
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.12612>:
      <D.12605>:
      process_handle.57 = process_handle;
      D.12600 = process_handle.57->id;
      return D.12600;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


_wapi_handle_issignalled (void * handle)
{
  long int handle.58;
  gboolean D.12618;
  <unnamed type> D.12621;
  <unnamed type> D.12623;
  <unnamed type> D.12625;
  <unnamed type> D.12627;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.59;
  unsigned int D.12629;
  unsigned int D.12630;
  struct _WapiHandleUnshared * D.12631;
  long unsigned int D.12632;
  long unsigned int D.12633;
  long unsigned int D.12634;
  struct _WapiHandleUnshared * D.12635;
  unsigned int D.12636;
  unsigned int D.12637;
  struct _WapiHandleUnshared * D.12638;
  long unsigned int D.12639;
  long unsigned int D.12640;
  long unsigned int D.12641;
  struct _WapiHandleUnshared * D.12642;
  guint32 idx;

  handle.58 = (long int) handle;
  idx = (guint32) handle.58;
  if (idx > 4194303) goto <D.12616>; else goto <D.12617>;
  <D.12616>:
  D.12618 = 0;
  return D.12618;
  <D.12617>:
  D.12621 = _wapi_handle_type (handle);
  if (D.12621 == 9) goto <D.12619>; else goto <D.12622>;
  <D.12622>:
  D.12623 = _wapi_handle_type (handle);
  if (D.12623 == 11) goto <D.12619>; else goto <D.12624>;
  <D.12624>:
  D.12625 = _wapi_handle_type (handle);
  if (D.12625 == 12) goto <D.12619>; else goto <D.12626>;
  <D.12626>:
  D.12627 = _wapi_handle_type (handle);
  if (D.12627 == 13) goto <D.12619>; else goto <D.12620>;
  <D.12619>:
  _wapi_shared_layout.59 = _wapi_shared_layout;
  handle.58 = (long int) handle;
  D.12629 = (unsigned int) handle.58;
  D.12630 = D.12629 / 256;
  D.12631 = _wapi_private_handles[D.12630];
  handle.58 = (long int) handle;
  D.12629 = (unsigned int) handle.58;
  D.12632 = (long unsigned int) D.12629;
  D.12633 = D.12632 & 255;
  D.12634 = D.12633 * 200;
  D.12635 = D.12631 + D.12634;
  D.12636 = D.12635->u.shared.offset;
  D.12618 = _wapi_shared_layout.59->handles[D.12636].signalled;
  return D.12618;
  <D.12620>:
  D.12637 = idx / 256;
  D.12638 = _wapi_private_handles[D.12637];
  D.12639 = (long unsigned int) idx;
  D.12640 = D.12639 & 255;
  D.12641 = D.12640 * 200;
  D.12642 = D.12638 + D.12641;
  D.12618 = D.12642->signalled;
  return D.12618;
}


GetExitCodeProcess (void * process, guint32 * code)
{
  gboolean D.12646;
  long int process.60;
  unsigned int D.12648;
  signed int D.12649;
  int pid.61;
  int D.12653;
  int D.12658;
  struct _WapiHandle_process * process_handle.62;
  unsigned int D.12662;
  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.12644>; else goto <D.12645>;
      <D.12644>:
      D.12646 = 0;
      return D.12646;
      <D.12645>:
      process.60 = (long int) process;
      D.12648 = (unsigned int) process.60;
      pid = D.12648 + 2147483648;
      process.60 = (long int) process;
      D.12649 = (signed int) process.60;
      if (D.12649 < 0) goto <D.12650>; else goto <D.12651>;
      <D.12650>:
      pid.61 = (int) pid;
      D.12653 = is_pid_valid (pid.61);
      if (D.12653 != 0) goto <D.12654>; else goto <D.12655>;
      <D.12654>:
      *code = 259;
      D.12646 = 1;
      return D.12646;
      <D.12655>:
      D.12646 = 0;
      return D.12646;
      <D.12651>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12656>; else goto <D.12657>;
      <D.12656>:
      D.12646 = 0;
      return D.12646;
      <D.12657>:
      process_wait (process, 0, 1);
      D.12658 = _wapi_handle_issignalled (process);
      if (D.12658 == 1) goto <D.12659>; else goto <D.12660>;
      <D.12659>:
      process_handle.62 = process_handle;
      D.12662 = process_handle.62->exitstatus;
      *code = D.12662;
      goto <D.12663>;
      <D.12660>:
      *code = 259;
      <D.12663>:
      D.12646 = 1;
      return D.12646;
    }
  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.12668;
  _Bool D.12669;
  _Bool D.12670;
  _Bool D.12672;
  _Bool D.12673;
  _Bool D.12674;
  gboolean D.12675;
  long int process.63;
  signed int D.12677;
  struct _WapiHandle_process * process_handle.64;
  int D.12683;
  int D.12686;
  int D.12687;
  int D.12690;
  long int D.12693;
  long int D.12694;
  long int D.12695;
  long int D.12696;
  long int D.12697;
  long int D.12698;
  long int D.12699;
  long int D.12700;
  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.12668 = create_time == 0B;
      D.12669 = exit_time == 0B;
      D.12670 = D.12668 | D.12669;
      if (D.12670 != 0) goto <D.12666>; else goto <D.12671>;
      <D.12671>:
      D.12672 = kernel_time == 0B;
      D.12673 = user_time == 0B;
      D.12674 = D.12672 | D.12673;
      if (D.12674 != 0) goto <D.12666>; else goto <D.12667>;
      <D.12666>:
      D.12675 = 0;
      return D.12675;
      <D.12667>:
      process.63 = (long int) process;
      D.12677 = (signed int) process.63;
      if (D.12677 < 0) goto <D.12678>; else goto <D.12679>;
      <D.12678>:
      D.12675 = 0;
      return D.12675;
      <D.12679>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12680>; else goto <D.12681>;
      <D.12680>:
      D.12675 = 0;
      return D.12675;
      <D.12681>:
      process_handle.64 = process_handle;
      *create_time = process_handle.64->create_time;
      D.12683 = _wapi_handle_issignalled (process);
      if (D.12683 == 1) goto <D.12684>; else goto <D.12685>;
      <D.12684>:
      process_handle.64 = process_handle;
      *exit_time = process_handle.64->exit_time;
      <D.12685>:
      process_handle.64 = process_handle;
      D.12686 = process_handle.64->id;
      D.12687 = getpid ();
      if (D.12686 == D.12687) goto <D.12688>; else goto <D.12689>;
      <D.12688>:
      {
        struct rusage time_data;

        try
          {
            D.12690 = getrusage (0, &time_data);
            if (D.12690 == 0) goto <D.12691>; else goto <D.12692>;
            <D.12691>:
            {
              gint64 tick_val;
              gint64 * tick_val_ptr;

              ku_times_set = 1;
              D.12693 = time_data.ru_utime.tv_sec;
              D.12694 = D.12693 * 10000000;
              D.12695 = time_data.ru_utime.tv_usec;
              D.12696 = D.12695 * 10;
              tick_val = D.12694 + D.12696;
              tick_val_ptr = user_time;
              *tick_val_ptr = tick_val;
              D.12697 = time_data.ru_stime.tv_sec;
              D.12698 = D.12697 * 10000000;
              D.12699 = time_data.ru_stime.tv_usec;
              D.12700 = D.12699 * 10;
              tick_val = D.12698 + D.12700;
              tick_val_ptr = kernel_time;
              *tick_val_ptr = tick_val;
            }
            <D.12692>:
          }
        finally
          {
            time_data = {CLOBBER};
          }
      }
      <D.12689>:
      if (ku_times_set == 0) goto <D.12701>; else goto <D.12702>;
      <D.12701>:
      memset (kernel_time, 0, 8);
      memset (user_time, 0, 8);
      <D.12702>:
      D.12675 = 1;
      return D.12675;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.12707;
  int D.12712;
  void * D.12714;
  long unsigned int D.12715;

  D.12707 = __builtin_constant_p (__len);
  if (D.12707 != 0) goto <D.12708>; else goto <D.12709>;
  <D.12708>:
  if (__len == 0) goto <D.12710>; else goto <D.12711>;
  <D.12710>:
  D.12712 = __builtin_constant_p (__ch);
  if (D.12712 == 0) goto <D.12705>; else goto <D.12713>;
  <D.12713>:
  if (__ch != 0) goto <D.12705>; else goto <D.12706>;
  <D.12705>:
  __warn_memset_zero_len ();
  D.12714 = __dest;
  return D.12714;
  <D.12706>:
  <D.12711>:
  <D.12709>:
  D.12715 = __builtin_object_size (__dest, 0);
  D.12714 = __builtin___memset_chk (__dest, __ch, __len, D.12715);
  return D.12714;
}


EnumProcessModules (void * process, void * * modules, guint32 size, guint32 * needed)
{
  gboolean D.12719;
  long int process.65;
  signed int D.12721;
  int D.12724;
  struct _WapiHandle_process * process_handle.66;
  unsigned int D.12732;
  unsigned int D.12733;
  unsigned int i.67;
  void * D.12735;
  long unsigned int D.12738;
  long unsigned int D.12739;
  void * * D.12740;
  void * D.12741;
  gchar * D.12743;
  int D.12744;
  sizetype D.12748;
  sizetype D.12749;
  sizetype D.12750;
  void * * D.12751;
  unsigned int i.68;
  unsigned int D.12753;
  void * D.12755;
  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 / 8;
      proc_name = 0B;
      if (size <= 7) goto <D.12717>; else goto <D.12718>;
      <D.12717>:
      D.12719 = 0;
      return D.12719;
      <D.12718>:
      process.65 = (long int) process;
      D.12721 = (signed int) process.65;
      if (D.12721 < 0) goto <D.12722>; else goto <D.12723>;
      <D.12722>:
      process.65 = (long int) process;
      D.12724 = (int) process.65;
      pid = D.12724 & 2147483647;
      goto <D.12725>;
      <D.12723>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12726>; else goto <D.12727>;
      <D.12726>:
      D.12719 = 0;
      return D.12719;
      <D.12727>:
      process_handle.66 = process_handle;
      pid = process_handle.66->id;
      process_handle.66 = process_handle;
      proc_name = &process_handle.66->proc_name;
      <D.12725>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.12729>; else goto <D.12730>;
      <D.12729>:
      *modules = 0B;
      *needed = 8;
      goto <D.12731>;
      <D.12730>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      D.12732 = count + 1;
      D.12733 = D.12732 * 8;
      *needed = D.12733;
      *modules = 0B;
      i = 0;
      goto <D.11532>;
      <D.11531>:
      i.67 = (unsigned int) i;
      module = monoeg_g_slist_nth_data (mods, i.67);
      D.12735 = *modules;
      if (D.12735 != 0B) goto <D.12736>; else goto <D.12737>;
      <D.12736>:
      D.12738 = (long unsigned int) i;
      D.12739 = D.12738 * 8;
      D.12740 = modules + D.12739;
      D.12741 = module->address_start;
      *D.12740 = D.12741;
      goto <D.12742>;
      <D.12737>:
      D.12743 = module->filename;
      D.12744 = match_procname_to_modulename (proc_name, D.12743);
      if (D.12744 != 0) goto <D.12745>; else goto <D.12746>;
      <D.12745>:
      D.12741 = module->address_start;
      *modules = D.12741;
      goto <D.12747>;
      <D.12746>:
      D.12748 = (sizetype) i;
      D.12749 = D.12748 + 1;
      D.12750 = D.12749 * 8;
      D.12751 = modules + D.12750;
      D.12741 = module->address_start;
      *D.12751 = D.12741;
      <D.12747>:
      <D.12742>:
      i = i + 1;
      <D.11532>:
      i.68 = (unsigned int) i;
      D.12753 = avail + 4294967295;
      if (i.68 < D.12753) goto <D.12754>; else goto <D.11533>;
      <D.12754>:
      i.68 = (unsigned int) i;
      if (i.68 < count) goto <D.11531>; else goto <D.11533>;
      <D.11533>:
      i = 0;
      goto <D.11535>;
      <D.11534>:
      i.67 = (unsigned int) i;
      D.12755 = monoeg_g_slist_nth_data (mods, i.67);
      free_procmodule (D.12755);
      i = i + 1;
      <D.11535>:
      i.68 = (unsigned int) i;
      if (i.68 < count) goto <D.11534>; else goto <D.11536>;
      <D.11536>:
      monoeg_g_slist_free (mods);
      <D.12731>:
      D.12719 = 1;
      return D.12719;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


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

  try
    {
      fp = 0B;
      proc_path[0] = "/proc/%d/maps";
      proc_path[1] = "/proc/%d/map";
      proc_path[2] = 0B;
      i = 0;
      goto <D.11513>;
      <D.11512>:
      D.12758 = proc_path[i];
      filename = monoeg_g_strdup_printf (D.12758, pid);
      fp = fopen (filename, mode);
      monoeg_g_free (filename);
      i = i + 1;
      <D.11513>:
      if (fp == 0B) goto <D.12759>; else goto <D.11514>;
      <D.12759>:
      D.12758 = proc_path[i];
      if (D.12758 != 0B) goto <D.11512>; else goto <D.11514>;
      <D.11514>:
      D.12760 = fp;
      return D.12760;
    }
  finally
    {
      proc_path = {CLOBBER};
    }
}


load_modules (struct FILE * fp)
{
  const short unsigned int * * D.12763;
  const short unsigned int * D.12764;
  char D.12765;
  long unsigned int D.12766;
  long unsigned int D.12767;
  const short unsigned int * D.12768;
  short unsigned int D.12769;
  int D.12770;
  int D.12771;
  char D.12772;
  long unsigned int D.12773;
  long unsigned int D.12774;
  const short unsigned int * D.12775;
  short unsigned int D.12776;
  int D.12777;
  int D.12778;
  long unsigned int D.12781;
  char D.12784;
  long unsigned int D.12785;
  long unsigned int D.12786;
  const short unsigned int * D.12787;
  short unsigned int D.12788;
  int D.12789;
  int D.12790;
  long unsigned int D.12793;
  char D.12796;
  _Bool D.12797;
  _Bool D.12798;
  _Bool D.12799;
  char D.12802;
  long unsigned int D.12803;
  long unsigned int D.12804;
  const short unsigned int * D.12805;
  short unsigned int D.12806;
  int D.12807;
  int D.12808;
  long unsigned int D.12811;
  char D.12814;
  long unsigned int D.12815;
  long unsigned int D.12816;
  const short unsigned int * D.12817;
  short unsigned int D.12818;
  int D.12819;
  int D.12820;
  long unsigned int D.12823;
  char D.12826;
  long unsigned int D.12827;
  long unsigned int D.12828;
  const short unsigned int * D.12829;
  short unsigned int D.12830;
  int D.12831;
  int D.12832;
  long unsigned int D.12835;
  char D.12838;
  long unsigned int D.12839;
  long unsigned int D.12840;
  const short unsigned int * D.12841;
  short unsigned int D.12842;
  int D.12843;
  int D.12844;
  long int D.12847;
  _Bool D.12850;
  _Bool D.12851;
  _Bool D.12852;
  gchar * D.12855;
  gchar * D.12856;
  gchar * D.12857;
  gchar * D.12858;
  struct GSList * D.12859;
  char * D.12863;
  struct GSList * D.12864;
  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.11438>;
      <D.11457>:
      p = &buf;
      goto <D.11436>;
      <D.11435>:
      p = p + 1;
      <D.11436>:
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 != 0) goto <D.11435>; else goto <D.11437>;
      <D.11437>:
      start_start = p;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12772 = *start_start;
      D.12773 = (long unsigned int) D.12772;
      D.12774 = D.12773 * 2;
      D.12775 = D.12764 + D.12774;
      D.12776 = *D.12775;
      D.12777 = (int) D.12776;
      D.12778 = D.12777 & 4096;
      if (D.12778 == 0) goto <D.12779>; else goto <D.12780>;
      <D.12779>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12780>:
      D.12781 = strtoul (start_start, &endp, 16);
      address_start = (void *) D.12781;
      p = endp;
      D.12765 = *p;
      if (D.12765 != 45) goto <D.12782>; else goto <D.12783>;
      <D.12782>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12783>:
      p = p + 1;
      end_start = p;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12784 = *end_start;
      D.12785 = (long unsigned int) D.12784;
      D.12786 = D.12785 * 2;
      D.12787 = D.12764 + D.12786;
      D.12788 = *D.12787;
      D.12789 = (int) D.12788;
      D.12790 = D.12789 & 4096;
      if (D.12790 == 0) goto <D.12791>; else goto <D.12792>;
      <D.12791>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12792>:
      D.12793 = strtoul (end_start, &endp, 16);
      address_end = (void *) D.12793;
      p = endp;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 == 0) goto <D.12794>; else goto <D.12795>;
      <D.12794>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12795>:
      goto <D.11440>;
      <D.11439>:
      p = p + 1;
      <D.11440>:
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 != 0) goto <D.11439>; else goto <D.11441>;
      <D.11441>:
      prot_start = p;
      D.12796 = *prot_start;
      D.12797 = D.12796 != 114;
      D.12798 = D.12796 != 45;
      D.12799 = D.12797 & D.12798;
      if (D.12799 != 0) goto <D.12800>; else goto <D.12801>;
      <D.12800>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12801>:
      memcpy (&prot_buf, prot_start, 4);
      prot_buf[4] = 0;
      goto <D.11443>;
      <D.11442>:
      p = p + 1;
      <D.11443>:
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 == 0) goto <D.11442>; else goto <D.11444>;
      <D.11444>:
      goto <D.11446>;
      <D.11445>:
      p = p + 1;
      <D.11446>:
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 != 0) goto <D.11445>; else goto <D.11447>;
      <D.11447>:
      offset_start = p;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12802 = *offset_start;
      D.12803 = (long unsigned int) D.12802;
      D.12804 = D.12803 * 2;
      D.12805 = D.12764 + D.12804;
      D.12806 = *D.12805;
      D.12807 = (int) D.12806;
      D.12808 = D.12807 & 4096;
      if (D.12808 == 0) goto <D.12809>; else goto <D.12810>;
      <D.12809>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12810>:
      D.12811 = strtoul (offset_start, &endp, 16);
      address_offset = (void *) D.12811;
      p = endp;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 == 0) goto <D.12812>; else goto <D.12813>;
      <D.12812>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12813>:
      goto <D.11449>;
      <D.11448>:
      p = p + 1;
      <D.11449>:
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 != 0) goto <D.11448>; else goto <D.11450>;
      <D.11450>:
      maj_dev_start = p;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12814 = *maj_dev_start;
      D.12815 = (long unsigned int) D.12814;
      D.12816 = D.12815 * 2;
      D.12817 = D.12764 + D.12816;
      D.12818 = *D.12817;
      D.12819 = (int) D.12818;
      D.12820 = D.12819 & 4096;
      if (D.12820 == 0) goto <D.12821>; else goto <D.12822>;
      <D.12821>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12822>:
      D.12823 = strtoul (maj_dev_start, &endp, 16);
      maj_dev = (guint32) D.12823;
      p = endp;
      D.12765 = *p;
      if (D.12765 != 58) goto <D.12824>; else goto <D.12825>;
      <D.12824>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12825>:
      p = p + 1;
      min_dev_start = p;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12826 = *min_dev_start;
      D.12827 = (long unsigned int) D.12826;
      D.12828 = D.12827 * 2;
      D.12829 = D.12764 + D.12828;
      D.12830 = *D.12829;
      D.12831 = (int) D.12830;
      D.12832 = D.12831 & 4096;
      if (D.12832 == 0) goto <D.12833>; else goto <D.12834>;
      <D.12833>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12834>:
      D.12835 = strtoul (min_dev_start, &endp, 16);
      min_dev = (guint32) D.12835;
      p = endp;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 == 0) goto <D.12836>; else goto <D.12837>;
      <D.12836>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12837>:
      goto <D.11452>;
      <D.11451>:
      p = p + 1;
      <D.11452>:
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 != 0) goto <D.11451>; else goto <D.11453>;
      <D.11453>:
      inode_start = p;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12838 = *inode_start;
      D.12839 = (long unsigned int) D.12838;
      D.12840 = D.12839 * 2;
      D.12841 = D.12764 + D.12840;
      D.12842 = *D.12841;
      D.12843 = (int) D.12842;
      D.12844 = D.12843 & 4096;
      if (D.12844 == 0) goto <D.12845>; else goto <D.12846>;
      <D.12845>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12846>:
      D.12847 = strtol (inode_start, &endp, 10);
      inode = (ino_t) D.12847;
      p = endp;
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 == 0) goto <D.12848>; else goto <D.12849>;
      <D.12848>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12849>:
      device = gnu_dev_makedev (maj_dev, min_dev);
      D.12850 = device == 0;
      D.12851 = inode == 0;
      D.12852 = D.12850 & D.12851;
      if (D.12852 != 0) goto <D.12853>; else goto <D.12854>;
      <D.12853>:
      // predicted unlikely by continue predictor.
      goto <D.11438>;
      <D.12854>:
      goto <D.11455>;
      <D.11454>:
      p = p + 1;
      <D.11455>:
      D.12763 = __ctype_b_loc ();
      D.12764 = *D.12763;
      D.12765 = *p;
      D.12766 = (long unsigned int) D.12765;
      D.12767 = D.12766 * 2;
      D.12768 = D.12764 + D.12767;
      D.12769 = *D.12768;
      D.12770 = (int) D.12769;
      D.12771 = D.12770 & 8192;
      if (D.12771 != 0) goto <D.11454>; else goto <D.11456>;
      <D.11456>:
      mod = monoeg_malloc0 (56);
      mod->address_start = address_start;
      mod->address_end = address_end;
      D.12855 = monoeg_strdup (&prot_buf);
      mod->perms = D.12855;
      mod->address_offset = address_offset;
      mod->device = device;
      mod->inode = inode;
      D.12856 = monoeg_g_strchomp (p);
      D.12857 = monoeg_g_strchug (D.12856);
      D.12858 = monoeg_strdup (D.12857);
      mod->filename = D.12858;
      D.12859 = monoeg_g_slist_find_custom (ret, mod, find_procmodule);
      if (D.12859 == 0B) goto <D.12860>; else goto <D.12861>;
      <D.12860>:
      ret = monoeg_g_slist_prepend (ret, mod);
      goto <D.12862>;
      <D.12861>:
      free_procmodule (mod);
      <D.12862>:
      <D.11438>:
      D.12863 = fgets (&buf, 4097, fp);
      if (D.12863 != 0B) goto <D.11457>; else goto <D.11458>;
      <D.11458>:
      ret = monoeg_g_slist_reverse (ret);
      D.12864 = ret;
      return D.12864;
    }
  finally
    {
      buf = {CLOBBER};
      endp = {CLOBBER};
      prot_buf = {CLOBBER};
    }
}


find_procmodule (const void * a, const void * b)
{
  long unsigned int D.12868;
  long unsigned int D.12869;
  long unsigned int D.12871;
  long unsigned int D.12872;
  gint D.12874;
  struct WapiProcModule * want;
  struct WapiProcModule * compare;

  want = a;
  compare = b;
  D.12868 = want->device;
  D.12869 = compare->device;
  if (D.12868 == D.12869) goto <D.12870>; else goto <D.12867>;
  <D.12870>:
  D.12871 = want->inode;
  D.12872 = compare->inode;
  if (D.12871 == D.12872) goto <D.12873>; else goto <D.12867>;
  <D.12873>:
  D.12874 = 0;
  return D.12874;
  <D.12867>:
  D.12874 = 1;
  return D.12874;
}


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

  D.12877 = __builtin_object_size (__dest, 0);
  D.12876 = __builtin___memcpy_chk (__dest, __src, __len, D.12877);
  return D.12876;
}


gnu_dev_makedev (unsigned int __major, unsigned int __minor)
{
  long long unsigned int D.12879;
  unsigned int D.12880;
  unsigned int D.12881;
  unsigned int D.12882;
  unsigned int D.12883;
  long long unsigned int D.12884;
  long long unsigned int D.12885;
  long long unsigned int D.12886;
  long long unsigned int D.12887;
  long long unsigned int D.12888;
  long long unsigned int D.12889;
  long long unsigned int D.12890;
  long long unsigned int D.12891;

  D.12880 = __minor & 255;
  D.12881 = __major & 4095;
  D.12882 = D.12881 << 8;
  D.12883 = D.12880 | D.12882;
  D.12884 = (long long unsigned int) D.12883;
  D.12885 = (long long unsigned int) __minor;
  D.12886 = D.12885 & 4294967040;
  D.12887 = D.12886 << 12;
  D.12888 = D.12884 | D.12887;
  D.12889 = (long long unsigned int) __major;
  D.12890 = D.12889 & 4294963200;
  D.12891 = D.12890 << 32;
  D.12879 = D.12888 | D.12891;
  return D.12879;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  long unsigned int D.12893;
  int D.12898;
  char * D.12900;
  long unsigned int D.12901;
  long unsigned int D.12902;
  long unsigned int D.12903;
  long unsigned int D.12906;

  D.12893 = __builtin_object_size (__s, 1);
  if (D.12893 != 18446744073709551615) goto <D.12894>; else goto <D.12895>;
  <D.12894>:
  D.12898 = __builtin_constant_p (__n);
  if (D.12898 == 0) goto <D.12896>; else goto <D.12899>;
  <D.12899>:
  if (__n <= 0) goto <D.12896>; else goto <D.12897>;
  <D.12896>:
  D.12901 = __builtin_object_size (__s, 1);
  D.12900 = __fgets_chk (__s, D.12901, __n, __stream);
  return D.12900;
  <D.12897>:
  D.12902 = (long unsigned int) __n;
  D.12903 = __builtin_object_size (__s, 1);
  if (D.12902 > D.12903) goto <D.12904>; else goto <D.12905>;
  <D.12904>:
  D.12906 = __builtin_object_size (__s, 1);
  D.12900 = __fgets_chk_warn (__s, D.12906, __n, __stream);
  return D.12900;
  <D.12905>:
  <D.12895>:
  D.12900 = __fgets_alias (__s, __n, __stream);
  return D.12900;
}


match_procname_to_modulename (gchar * procname, gchar * modulename)
{
  _Bool D.12908;
  _Bool D.12909;
  _Bool D.12910;
  gboolean D.12913;
  int D.11476;
  int D.11485;
  const char * D.12920;
  int D.11494;
  const char * D.12929;
  int D.11503;
  char * lastsep;
  char * lastsep2;
  char * pname;
  char * mname;
  gboolean result;

  lastsep = 0B;
  lastsep2 = 0B;
  pname = 0B;
  mname = 0B;
  result = 0;
  D.12908 = procname == 0B;
  D.12909 = modulename == 0B;
  D.12910 = D.12908 | D.12909;
  if (D.12910 != 0) goto <D.12911>; else goto <D.12912>;
  <D.12911>:
  D.12913 = 0;
  return D.12913;
  <D.12912>:
  pname = mono_path_resolve_symlinks (procname);
  mname = mono_path_resolve_symlinks (modulename);
  {
    size_t __s1_len;
    size_t __s2_len;

    D.11476 = __builtin_strcmp (pname, mname);
  }
  if (D.11476 == 0) goto <D.12914>; else goto <D.12915>;
  <D.12914>:
  result = 1;
  <D.12915>:
  if (result == 0) goto <D.12916>; else goto <D.12917>;
  <D.12916>:
  lastsep = strrchr (mname, 47);
  if (lastsep != 0B) goto <D.12918>; else goto <D.12919>;
  <D.12918>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.12920 = lastsep + 1;
    D.11485 = __builtin_strcmp (D.12920, pname);
  }
  if (D.11485 == 0) goto <D.12921>; else goto <D.12922>;
  <D.12921>:
  result = 1;
  <D.12922>:
  <D.12919>:
  if (result == 0) goto <D.12923>; else goto <D.12924>;
  <D.12923>:
  lastsep2 = strrchr (pname, 47);
  if (lastsep2 != 0B) goto <D.12925>; else goto <D.12926>;
  <D.12925>:
  if (lastsep != 0B) goto <D.12927>; else goto <D.12928>;
  <D.12927>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.12929 = lastsep2 + 1;
    D.12920 = lastsep + 1;
    D.11494 = __builtin_strcmp (D.12920, D.12929);
  }
  if (D.11494 == 0) goto <D.12930>; else goto <D.12931>;
  <D.12930>:
  result = 1;
  <D.12931>:
  goto <D.12932>;
  <D.12928>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.12929 = lastsep2 + 1;
    D.11503 = __builtin_strcmp (mname, D.12929);
  }
  if (D.11503 == 0) goto <D.12933>; else goto <D.12934>;
  <D.12933>:
  result = 1;
  <D.12934>:
  <D.12932>:
  <D.12926>:
  <D.12924>:
  <D.12917>:
  monoeg_g_free (pname);
  monoeg_g_free (mname);
  D.12913 = result;
  return D.12913;
}


free_procmodule (struct WapiProcModule * mod)
{
  gchar * D.12936;
  gchar * D.12939;

  D.12936 = mod->perms;
  if (D.12936 != 0B) goto <D.12937>; else goto <D.12938>;
  <D.12937>:
  D.12936 = mod->perms;
  monoeg_g_free (D.12936);
  <D.12938>:
  D.12939 = mod->filename;
  if (D.12939 != 0B) goto <D.12940>; else goto <D.12941>;
  <D.12940>:
  D.12939 = mod->filename;
  monoeg_g_free (D.12939);
  <D.12941>:
  monoeg_g_free (mod);
}


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

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


get_module_name (void * process, void * module, gunichar2 * basename, guint32 size, gboolean base)
{
  _Bool D.12944;
  _Bool D.12945;
  _Bool D.12946;
  guint32 D.12949;
  long int process.69;
  signed int D.12951;
  int D.12954;
  struct _WapiHandle_process * process_handle.70;
  gchar[256] * D.12959;
  int * D.12964;
  int D.12965;
  _Bool D.12967;
  _Bool D.12968;
  _Bool D.12969;
  unsigned int i.71;
  gchar * D.12979;
  int D.12980;
  void * D.12982;
  unsigned int i.72;
  long unsigned int bytes.73;
  long unsigned int D.12994;
  long unsigned int bytes.74;
  long unsigned int D.12996;
  long unsigned int D.12999;
  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.12944 = basename == 0B;
      D.12945 = size == 0;
      D.12946 = D.12944 | D.12945;
      if (D.12946 != 0) goto <D.12947>; else goto <D.12948>;
      <D.12947>:
      D.12949 = 0;
      return D.12949;
      <D.12948>:
      process.69 = (long int) process;
      D.12951 = (signed int) process.69;
      if (D.12951 < 0) goto <D.12952>; else goto <D.12953>;
      <D.12952>:
      process.69 = (long int) process;
      D.12954 = (int) process.69;
      pid = D.12954 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.12955>;
      <D.12953>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.12956>; else goto <D.12957>;
      <D.12956>:
      D.12949 = 0;
      return D.12949;
      <D.12957>:
      process_handle.70 = process_handle;
      pid = process_handle.70->id;
      process_handle.70 = process_handle;
      D.12959 = &process_handle.70->proc_name;
      proc_name = monoeg_strdup (D.12959);
      <D.12955>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.12960>; else goto <D.12961>;
      <D.12960>:
      D.12964 = __errno_location ();
      D.12965 = *D.12964;
      if (D.12965 == 13) goto <D.12966>; else goto <D.12962>;
      <D.12966>:
      D.12967 = module == 0B;
      D.12968 = base == 1;
      D.12969 = D.12967 & D.12968;
      if (D.12969 != 0) goto <D.12970>; else goto <D.12962>;
      <D.12970>:
      procname_ext = get_process_name_from_proc (pid);
      goto <D.12963>;
      <D.12962>:
      monoeg_g_free (proc_name);
      D.12949 = 0;
      return D.12949;
      <D.12963>:
      goto <D.12971>;
      <D.12961>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.11567>;
      <D.11566>:
      i.71 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.71);
      if (procname_ext == 0B) goto <D.12976>; else goto <D.12977>;
      <D.12976>:
      if (module == 0B) goto <D.12978>; else goto <D.12973>;
      <D.12978>:
      D.12979 = found_module->filename;
      D.12980 = match_procname_to_modulename (proc_name, D.12979);
      if (D.12980 != 0) goto <D.12974>; else goto <D.12973>;
      <D.12973>:
      if (module != 0B) goto <D.12981>; else goto <D.12975>;
      <D.12981>:
      D.12982 = found_module->address_start;
      if (D.12982 == module) goto <D.12974>; else goto <D.12975>;
      <D.12974>:
      if (base != 0) goto <D.12983>; else goto <D.12984>;
      <D.12983>:
      D.12979 = found_module->filename;
      procname_ext = monoeg_g_path_get_basename (D.12979);
      goto <D.12985>;
      <D.12984>:
      D.12979 = found_module->filename;
      procname_ext = monoeg_strdup (D.12979);
      <D.12985>:
      <D.12975>:
      <D.12977>:
      free_procmodule (found_module);
      i = i + 1;
      <D.11567>:
      i.72 = (unsigned int) i;
      if (i.72 < count) goto <D.11566>; else goto <D.11568>;
      <D.11568>:
      if (procname_ext == 0B) goto <D.12987>; else goto <D.12988>;
      <D.12987>:
      procname_ext = get_process_name_from_proc (pid);
      <D.12988>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      <D.12971>:
      if (procname_ext != 0B) goto <D.12989>; else goto <D.12990>;
      <D.12989>:
      procname = mono_unicode_from_external (procname_ext, &bytes);
      if (procname == 0B) goto <D.12991>; else goto <D.12992>;
      <D.12991>:
      monoeg_g_free (procname_ext);
      D.12949 = 0;
      return D.12949;
      <D.12992>:
      bytes.73 = bytes;
      D.12994 = bytes.73 / 2;
      len = (glong) D.12994;
      bytes.73 = bytes;
      bytes.74 = bytes.73 + 2;
      bytes = bytes.74;
      D.12996 = (long unsigned int) size;
      bytes.73 = bytes;
      if (D.12996 < bytes.73) goto <D.12997>; else goto <D.12998>;
      <D.12997>:
      D.12999 = (long unsigned int) size;
      memcpy (basename, procname, D.12999);
      goto <D.13000>;
      <D.12998>:
      bytes.73 = bytes;
      memcpy (basename, procname, bytes.73);
      <D.13000>:
      monoeg_g_free (procname);
      monoeg_g_free (procname_ext);
      D.12949 = (guint32) len;
      return D.12949;
      <D.12990>:
      D.12949 = 0;
      return D.12949;
    }
  finally
    {
      process_handle = {CLOBBER};
      bytes = {CLOBBER};
    }
}


get_process_name_from_proc (pid_t pid)
{
  long int D.13003;
  gchar * D.13008;
  char * D.13011;
  char * D.13018;
  const char * D.13023;
  long int end.75;
  long int start.76;
  long int D.13028;
  long int D.13029;
  long unsigned int D.13030;
  const gchar * D.13031;
  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.13003 = readlink (filename, &buf, 255);
      if (D.13003 > 0) goto <D.13004>; else goto <D.13005>;
      <D.13004>:
      ret = monoeg_strdup (&buf);
      <D.13005>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.13006>; else goto <D.13007>;
      <D.13006>:
      D.13008 = ret;
      return D.13008;
      <D.13007>:
      filename = monoeg_g_strdup_printf ("/proc/%d/cmdline", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.13009>; else goto <D.13010>;
      <D.13009>:
      D.13011 = fgets (&buf, 256, fp);
      if (D.13011 != 0B) goto <D.13012>; else goto <D.13013>;
      <D.13012>:
      ret = monoeg_strdup (&buf);
      <D.13013>:
      fclose (fp);
      <D.13010>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.13014>; else goto <D.13015>;
      <D.13014>:
      D.13008 = ret;
      return D.13008;
      <D.13015>:
      filename = monoeg_g_strdup_printf ("/proc/%d/stat", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.13016>; else goto <D.13017>;
      <D.13016>:
      D.13018 = fgets (&buf, 256, fp);
      if (D.13018 != 0B) goto <D.13019>; else goto <D.13020>;
      <D.13019>:
      {
        gchar * start;
        gchar * end;

        start = __builtin_strchr (&buf, 40);
        if (start != 0B) goto <D.13021>; else goto <D.13022>;
        <D.13021>:
        D.13023 = start + 1;
        end = __builtin_strchr (D.13023, 41);
        if (end != 0B) goto <D.13024>; else goto <D.13025>;
        <D.13024>:
        end.75 = (long int) end;
        start.76 = (long int) start;
        D.13028 = end.75 - start.76;
        D.13029 = D.13028 + -1;
        D.13030 = (long unsigned int) D.13029;
        D.13031 = start + 1;
        ret = monoeg_g_strndup (D.13031, D.13030);
        <D.13025>:
        <D.13022>:
      }
      <D.13020>:
      fclose (fp);
      <D.13017>:
      monoeg_g_free (filename);
      D.13008 = ret;
      return D.13008;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


readlink (const char * restrict __path, char * restrict __buf, size_t __len)
{
  long unsigned int D.13034;
  int D.13037;
  ssize_t D.13040;
  long unsigned int D.13041;
  long unsigned int D.13042;
  long unsigned int D.13045;

  D.13034 = __builtin_object_size (__buf, 1);
  if (D.13034 != 18446744073709551615) goto <D.13035>; else goto <D.13036>;
  <D.13035>:
  D.13037 = __builtin_constant_p (__len);
  if (D.13037 == 0) goto <D.13038>; else goto <D.13039>;
  <D.13038>:
  D.13041 = __builtin_object_size (__buf, 1);
  D.13040 = __readlink_chk (__path, __buf, __len, D.13041);
  return D.13040;
  <D.13039>:
  D.13042 = __builtin_object_size (__buf, 1);
  if (D.13042 < __len) goto <D.13043>; else goto <D.13044>;
  <D.13043>:
  D.13045 = __builtin_object_size (__buf, 1);
  D.13040 = __readlink_chk_warn (__path, __buf, __len, D.13045);
  return D.13040;
  <D.13044>:
  <D.13036>:
  D.13040 = __readlink_alias (__path, __buf, __len);
  return D.13040;
}


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

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


GetModuleInformation (void * process, void * module, struct WapiModuleInfo * modinfo, guint32 size)
{
  _Bool D.13049;
  _Bool D.13050;
  _Bool D.13051;
  gboolean D.13054;
  long int process.77;
  signed int D.13056;
  int D.13059;
  struct _WapiHandle_process * process_handle.78;
  gchar[256] * D.13064;
  unsigned int i.79;
  gchar * D.13074;
  int D.13075;
  void * D.13077;
  void * D.13078;
  long unsigned int D.13079;
  long unsigned int D.13080;
  long unsigned int D.13081;
  unsigned int D.13082;
  void * D.13083;
  unsigned int i.80;
  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.13049 = modinfo == 0B;
      D.13050 = size <= 23;
      D.13051 = D.13049 | D.13050;
      if (D.13051 != 0) goto <D.13052>; else goto <D.13053>;
      <D.13052>:
      D.13054 = 0;
      return D.13054;
      <D.13053>:
      process.77 = (long int) process;
      D.13056 = (signed int) process.77;
      if (D.13056 < 0) goto <D.13057>; else goto <D.13058>;
      <D.13057>:
      process.77 = (long int) process;
      D.13059 = (int) process.77;
      pid = D.13059 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.13060>;
      <D.13058>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13061>; else goto <D.13062>;
      <D.13061>:
      D.13054 = 0;
      return D.13054;
      <D.13062>:
      process_handle.78 = process_handle;
      pid = process_handle.78->id;
      process_handle.78 = process_handle;
      D.13064 = &process_handle.78->proc_name;
      proc_name = monoeg_strdup (D.13064);
      <D.13060>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.13065>; else goto <D.13066>;
      <D.13065>:
      monoeg_g_free (proc_name);
      D.13054 = 0;
      return D.13054;
      <D.13066>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.11598>;
      <D.11597>:
      i.79 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.79);
      if (ret == 0) goto <D.13071>; else goto <D.13072>;
      <D.13071>:
      if (module == 0B) goto <D.13073>; else goto <D.13068>;
      <D.13073>:
      D.13074 = found_module->filename;
      D.13075 = match_procname_to_modulename (proc_name, D.13074);
      if (D.13075 != 0) goto <D.13069>; else goto <D.13068>;
      <D.13068>:
      if (module != 0B) goto <D.13076>; else goto <D.13070>;
      <D.13076>:
      D.13077 = found_module->address_start;
      if (D.13077 == module) goto <D.13069>; else goto <D.13070>;
      <D.13069>:
      D.13077 = found_module->address_start;
      modinfo->lpBaseOfDll = D.13077;
      D.13078 = found_module->address_end;
      D.13079 = (long unsigned int) D.13078;
      D.13077 = found_module->address_start;
      D.13080 = (long unsigned int) D.13077;
      D.13081 = D.13079 - D.13080;
      D.13082 = (unsigned int) D.13081;
      modinfo->SizeOfImage = D.13082;
      D.13083 = found_module->address_offset;
      modinfo->EntryPoint = D.13083;
      ret = 1;
      <D.13070>:
      <D.13072>:
      free_procmodule (found_module);
      i = i + 1;
      <D.11598>:
      i.80 = (unsigned int) i;
      if (i.80 < count) goto <D.11597>; else goto <D.11599>;
      <D.11599>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      D.13054 = ret;
      return D.13054;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetProcessWorkingSetSize (void * process, size_t * min, size_t * max)
{
  _Bool D.13087;
  _Bool D.13088;
  _Bool D.13089;
  gboolean D.13092;
  long int process.81;
  signed int D.13094;
  struct _WapiHandle_process * process_handle.82;
  long unsigned int D.13100;
  long unsigned int D.13101;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      D.13087 = min == 0B;
      D.13088 = max == 0B;
      D.13089 = D.13087 | D.13088;
      if (D.13089 != 0) goto <D.13090>; else goto <D.13091>;
      <D.13090>:
      D.13092 = 0;
      return D.13092;
      <D.13091>:
      process.81 = (long int) process;
      D.13094 = (signed int) process.81;
      if (D.13094 < 0) goto <D.13095>; else goto <D.13096>;
      <D.13095>:
      D.13092 = 0;
      return D.13092;
      <D.13096>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13097>; else goto <D.13098>;
      <D.13097>:
      D.13092 = 0;
      return D.13092;
      <D.13098>:
      process_handle.82 = process_handle;
      D.13100 = process_handle.82->min_working_set;
      *min = D.13100;
      process_handle.82 = process_handle;
      D.13101 = process_handle.82->max_working_set;
      *max = D.13101;
      D.13092 = 1;
      return D.13092;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetProcessWorkingSetSize (void * process, size_t min, size_t max)
{
  long int process.83;
  signed int D.13105;
  gboolean D.13108;
  struct _WapiHandle_process * process_handle.84;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      process.83 = (long int) process;
      D.13105 = (signed int) process.83;
      if (D.13105 < 0) goto <D.13106>; else goto <D.13107>;
      <D.13106>:
      D.13108 = 0;
      return D.13108;
      <D.13107>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13109>; else goto <D.13110>;
      <D.13109>:
      D.13108 = 0;
      return D.13108;
      <D.13110>:
      process_handle.84 = process_handle;
      process_handle.84->min_working_set = min;
      process_handle.84 = process_handle;
      process_handle.84->max_working_set = max;
      D.13108 = 1;
      return D.13108;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


TerminateProcess (void * process, gint32 exitCode)
{
  long int process.85;
  signed int D.13115;
  int D.13118;
  gboolean D.13122;
  struct _WapiHandle_process * process_handle.86;
  int iftmp.87;
  int * D.13130;
  int D.13131;
  _Bool D.13132;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int signo;
  int ret;
  pid_t pid;

  try
    {
      process.85 = (long int) process;
      D.13115 = (signed int) process.85;
      if (D.13115 < 0) goto <D.13116>; else goto <D.13117>;
      <D.13116>:
      process.85 = (long int) process;
      D.13118 = (int) process.85;
      pid = D.13118 & 2147483647;
      goto <D.13119>;
      <D.13117>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13120>; else goto <D.13121>;
      <D.13120>:
      SetLastError (6);
      D.13122 = 0;
      return D.13122;
      <D.13121>:
      process_handle.86 = process_handle;
      pid = process_handle.86->id;
      <D.13119>:
      if (exitCode == -1) goto <D.13125>; else goto <D.13126>;
      <D.13125>:
      iftmp.87 = 9;
      goto <D.13127>;
      <D.13126>:
      iftmp.87 = 15;
      <D.13127>:
      signo = iftmp.87;
      ret = kill (pid, signo);
      if (ret == -1) goto <D.13128>; else goto <D.13129>;
      <D.13128>:
      D.13130 = __errno_location ();
      D.13131 = *D.13130;
      switch (D.13131) <default: <D.11627>, case 1: <D.11625>, case 3: <D.11626>, case 22: <D.11623>>
      <D.11623>:
      SetLastError (87);
      goto <D.11624>;
      <D.11625>:
      SetLastError (5);
      goto <D.11624>;
      <D.11626>:
      SetLastError (127);
      goto <D.11624>;
      <D.11627>:
      SetLastError (31);
      <D.11624>:
      <D.13129>:
      D.13132 = ret == 0;
      D.13122 = (gboolean) D.13132;
      return D.13122;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetPriorityClass (void * process)
{
  long int process.88;
  signed int D.13136;
  int D.13139;
  guint32 D.13143;
  struct _WapiHandle_process * process_handle.89;
  int * D.13145;
  unsigned int pid.90;
  int D.13149;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  pid_t pid;

  try
    {
      process.88 = (long int) process;
      D.13136 = (signed int) process.88;
      if (D.13136 < 0) goto <D.13137>; else goto <D.13138>;
      <D.13137>:
      process.88 = (long int) process;
      D.13139 = (int) process.88;
      pid = D.13139 & 2147483647;
      goto <D.13140>;
      <D.13138>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13141>; else goto <D.13142>;
      <D.13141>:
      SetLastError (6);
      D.13143 = 0;
      return D.13143;
      <D.13142>:
      process_handle.89 = process_handle;
      pid = process_handle.89->id;
      <D.13140>:
      D.13145 = __errno_location ();
      *D.13145 = 0;
      pid.90 = (unsigned int) pid;
      ret = getpriority (0, pid.90);
      if (ret == -1) goto <D.13147>; else goto <D.13148>;
      <D.13147>:
      D.13145 = __errno_location ();
      D.13149 = *D.13145;
      if (D.13149 != 0) goto <D.13150>; else goto <D.13151>;
      <D.13150>:
      D.13145 = __errno_location ();
      D.13149 = *D.13145;
      switch (D.13149) <default: <D.11639>, case 1: <D.11635>, case 3: <D.11638>, case 13: <D.11636>>
      <D.11635>:
      <D.11636>:
      SetLastError (5);
      goto <D.11637>;
      <D.11638>:
      SetLastError (127);
      goto <D.11637>;
      <D.11639>:
      SetLastError (31);
      <D.11637>:
      D.13143 = 0;
      return D.13143;
      <D.13151>:
      <D.13148>:
      if (ret == 0) goto <D.13152>; else goto <D.13153>;
      <D.13152>:
      D.13143 = 32;
      return D.13143;
      <D.13153>:
      if (ret < -15) goto <D.13154>; else goto <D.13155>;
      <D.13154>:
      D.13143 = 256;
      return D.13143;
      <D.13155>:
      if (ret < -10) goto <D.13156>; else goto <D.13157>;
      <D.13156>:
      D.13143 = 128;
      return D.13143;
      <D.13157>:
      if (ret < 0) goto <D.13158>; else goto <D.13159>;
      <D.13158>:
      D.13143 = 32768;
      return D.13143;
      <D.13159>:
      if (ret > 10) goto <D.13160>; else goto <D.13161>;
      <D.13160>:
      D.13143 = 64;
      return D.13143;
      <D.13161>:
      if (ret > 0) goto <D.13162>; else goto <D.13163>;
      <D.13162>:
      D.13143 = 16384;
      return D.13143;
      <D.13163>:
      D.13143 = 32;
      return D.13143;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetPriorityClass (void * process, guint32 priority_class)
{
  long int process.91;
  signed int D.13167;
  int D.13170;
  gboolean D.13174;
  struct _WapiHandle_process * process_handle.92;
  unsigned int pid.93;
  int * D.13179;
  int D.13180;
  _Bool D.13181;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  int prio;
  pid_t pid;

  try
    {
      process.91 = (long int) process;
      D.13167 = (signed int) process.91;
      if (D.13167 < 0) goto <D.13168>; else goto <D.13169>;
      <D.13168>:
      process.91 = (long int) process;
      D.13170 = (int) process.91;
      pid = D.13170 & 2147483647;
      goto <D.13171>;
      <D.13169>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13172>; else goto <D.13173>;
      <D.13172>:
      SetLastError (6);
      D.13174 = 0;
      return D.13174;
      <D.13173>:
      process_handle.92 = process_handle;
      pid = process_handle.92->id;
      <D.13171>:
      switch (priority_class) <default: <D.11656>, case 32: <D.11652>, case 64: <D.11649>, case 128: <D.11654>, case 256: <D.11655>, case 16384: <D.11651>, case 32768: <D.11653>>
      <D.11649>:
      prio = 19;
      goto <D.11650>;
      <D.11651>:
      prio = 10;
      goto <D.11650>;
      <D.11652>:
      prio = 0;
      goto <D.11650>;
      <D.11653>:
      prio = -5;
      goto <D.11650>;
      <D.11654>:
      prio = -11;
      goto <D.11650>;
      <D.11655>:
      prio = -20;
      goto <D.11650>;
      <D.11656>:
      SetLastError (87);
      D.13174 = 0;
      return D.13174;
      <D.11650>:
      pid.93 = (unsigned int) pid;
      ret = setpriority (0, pid.93, prio);
      if (ret == -1) goto <D.13177>; else goto <D.13178>;
      <D.13177>:
      D.13179 = __errno_location ();
      D.13180 = *D.13179;
      switch (D.13180) <default: <D.11661>, case 1: <D.11657>, case 3: <D.11660>, case 13: <D.11658>>
      <D.11657>:
      <D.11658>:
      SetLastError (5);
      goto <D.11659>;
      <D.11660>:
      SetLastError (127);
      goto <D.11659>;
      <D.11661>:
      SetLastError (31);
      <D.11659>:
      <D.13178>:
      D.13181 = ret == 0;
      D.13174 = (gboolean) D.13181;
      return D.13174;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


