process_wait (void * handle, guint32 timeout, gboolean alertable)
{
  long unsigned int D.12265;
  guint32 D.12268;
  long int handle.0;
  signed int D.12270;
  _Bool D.12271;
  long int D.12272;
  long int D.12273;
  struct _WapiHandle_process * process_handle.1;
  int D.12279;
  int D.12284;
  int D.12285;
  _Bool D.12288;
  union MonoSemType * D.12293;
  unsigned int D.12294;
  unsigned int D.12295;
  int * D.12299;
  int D.12300;
  int D.12308;
  unsigned int D.12312;
  unsigned int D.12317;
  int D.12320;
  _Bool D.12323;
  long int D.12324;
  long int D.12325;
  int iftmp.2;
  union 
{
  int __in;
  int __i;
} D.12255;
  int D.12332;
  unsigned char D.12333;
  unsigned char D.12334;
  unsigned char D.12335;
  signed char D.12336;
  signed char D.12337;
  union 
{
  int __in;
  int __i;
} D.12259;
  int D.12340;
  int D.12341;
  int D.12342;
  unsigned int D.12343;
  union 
{
  int __in;
  int __i;
} D.12263;
  int D.12345;
  int D.12346;
  int D.12347;
  unsigned int D.12348;
  long int D.12349;
  struct WapiFileTime * D.12350;
  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.12265 = pthread_self ();
      current_thread = _wapi_thread_handle_from_id (D.12265);
      if (current_thread == 0B) goto <D.12266>; else goto <D.12267>;
      <D.12266>:
      SetLastError (6);
      D.12268 = 4294967295;
      return D.12268;
      <D.12267>:
      handle.0 = (long int) handle;
      D.12270 = (signed int) handle.0;
      D.12271 = D.12270 < 0;
      D.12272 = (long int) D.12271;
      D.12273 = __builtin_expect (D.12272, 0);
      if (D.12273 != 0) goto <D.12274>; else goto <D.12275>;
      <D.12274>:
      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.12275>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.12276>; else goto <D.12277>;
      <D.12276>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      D.12268 = 4294967295;
      return D.12268;
      <D.12277>:
      process_handle.1 = process_handle;
      D.12279 = process_handle.1->exited;
      if (D.12279 != 0) goto <D.12280>; else goto <D.12281>;
      <D.12280>:
      D.12268 = 0;
      return D.12268;
      <D.12281>:
      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.12282>; else goto <D.12283>;
      <D.12282>:
      process_handle.1 = process_handle;
      D.12284 = process_handle.1->self;
      D.12285 = _wapi_getpid ();
      if (D.12284 != D.12285) goto <D.12286>; else goto <D.12287>;
      <D.12286>:
      mp = 0B;
      <D.12287>:
      <D.12283>:
      start = mono_msec_ticks ();
      now = start;
      D.12288 = mp == 0B;
      spin = (gboolean) D.12288;
      <D.12251>:
      if (mp != 0B) goto <D.12289>; else goto <D.12290>;
      <D.12289>:
      if (timeout != 4294967295) goto <D.12291>; else goto <D.12292>;
      <D.12291>:
      D.12293 = &mp->exit_sem;
      D.12294 = start - now;
      D.12295 = D.12294 + timeout;
      ret = mono_sem_timedwait (D.12293, D.12295, alertable);
      goto <D.12296>;
      <D.12292>:
      D.12293 = &mp->exit_sem;
      ret = mono_sem_wait (D.12293, alertable);
      <D.12296>:
      if (ret == -1) goto <D.12297>; else goto <D.12298>;
      <D.12297>:
      D.12299 = __errno_location ();
      D.12300 = *D.12299;
      if (D.12300 != 4) goto <D.12301>; else goto <D.12302>;
      <D.12301>:
      D.12299 = __errno_location ();
      D.12300 = *D.12299;
      if (D.12300 != 110) goto <D.12303>; else goto <D.12304>;
      <D.12303>:
      <D.12304>:
      <D.12302>:
      <D.12298>:
      if (ret == 0) goto <D.12305>; else goto <D.12306>;
      <D.12305>:
      D.12293 = &mp->exit_sem;
      mono_sem_post (D.12293);
      goto <D.12250>;
      <D.12306>:
      goto <D.12307>;
      <D.12290>:
      D.12308 = is_pid_valid (pid);
      if (D.12308 == 0) goto <D.12250>; else goto <D.12309>;
      <D.12309>:
      <D.12307>:
      if (timeout == 0) goto <D.12310>; else goto <D.12311>;
      <D.12310>:
      D.12268 = 258;
      return D.12268;
      <D.12311>:
      now = mono_msec_ticks ();
      D.12312 = now - start;
      if (D.12312 >= timeout) goto <D.12313>; else goto <D.12314>;
      <D.12313>:
      D.12268 = 258;
      return D.12268;
      <D.12314>:
      if (spin != 0) goto <D.12315>; else goto <D.12316>;
      <D.12315>:
      D.12294 = start - now;
      D.12295 = D.12294 + timeout;
      D.12317 = MIN_EXPR <D.12295, 100>;
      _wapi_handle_spin (D.12317);
      <D.12316>:
      if (alertable != 0) goto <D.12318>; else goto <D.12319>;
      <D.12318>:
      D.12320 = _wapi_thread_apc_pending (current_thread);
      if (D.12320 != 0) goto <D.12321>; else goto <D.12322>;
      <D.12321>:
      D.12268 = 192;
      return D.12268;
      <D.12322>:
      <D.12319>:
      goto <D.12251>;
      <D.12250>:
      ret = _wapi_handle_lock_shared_handles ();
      D.12323 = ret != 0;
      D.12324 = (long int) D.12323;
      D.12325 = __builtin_expect (D.12324, 0);
      if (D.12325 != 0) goto <D.12326>; else goto <D.12327>;
      <D.12326>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 3006, "ret == 0");
      <D.12327>:
      if (mp != 0B) goto <D.12329>; else goto <D.12330>;
      <D.12329>:
      iftmp.2 = mp->status;
      goto <D.12331>;
      <D.12330>:
      iftmp.2 = 0;
      <D.12331>:
      status = iftmp.2;
      D.12255.__in = status;
      D.12332 = D.12255.__i;
      D.12333 = (unsigned char) D.12332;
      D.12334 = D.12333 & 127;
      D.12335 = D.12334 + 1;
      D.12336 = (signed char) D.12335;
      D.12337 = D.12336 >> 1;
      if (D.12337 > 0) goto <D.12338>; else goto <D.12339>;
      <D.12338>:
      {
        typedef union 
      {
        int __in;
        int __i;
      } unionunion 
      {
        int __in;
        int __i;
      };

        process_handle.1 = process_handle;
        D.12259.__in = status;
        D.12340 = D.12259.__i;
        D.12341 = D.12340 & 127;
        D.12342 = D.12341 + 128;
        D.12343 = (unsigned int) D.12342;
        process_handle.1->exitstatus = D.12343;
      }
      goto <D.12344>;
      <D.12339>:
      {
        typedef union 
      {
        int __in;
        int __i;
      } unionunion 
      {
        int __in;
        int __i;
      };

        process_handle.1 = process_handle;
        D.12263.__in = status;
        D.12345 = D.12263.__i;
        D.12346 = D.12345 & 65280;
        D.12347 = D.12346 >> 8;
        D.12348 = (unsigned int) D.12347;
        process_handle.1->exitstatus = D.12348;
      }
      <D.12344>:
      D.12349 = time (0B);
      process_handle.1 = process_handle;
      D.12350 = &process_handle.1->exit_time;
      _wapi_time_t_to_filetime (D.12349, D.12350);
      process_handle.1 = process_handle;
      process_handle.1->exited = 1;
      _wapi_shared_handle_set_signal_state (handle, 1);
      _wapi_handle_unlock_shared_handles ();
      D.12268 = 0;
      return D.12268;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


is_pid_valid (pid_t pid)
{
  int D.12353;
  gboolean D.12356;
  gboolean result;
  gchar * dir;

  result = 0;
  dir = monoeg_g_strdup_printf ("/proc/%d", pid);
  D.12353 = access (dir, 0);
  if (D.12353 == 0) goto <D.12354>; else goto <D.12355>;
  <D.12354>:
  result = 1;
  <D.12355>:
  monoeg_g_free (dir);
  D.12356 = result;
  return D.12356;
}


_wapi_handle_spin (guint32 ms)
{
  _Bool D.12358;
  long int D.12359;
  long int D.12360;
  unsigned int D.12363;
  long int D.12364;
  struct timespec sleepytime;

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


_wapi_handle_lock_shared_handles ()
{
  int D.12365;

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


_wapi_shared_handle_set_signal_state (void * handle, gboolean state)
{
  long int handle.3;
  int iftmp.4;
  <unnamed type> D.12373;
  <unnamed type> D.12375;
  <unnamed type> D.12377;
  <unnamed type> D.12379;
  _Bool D.12381;
  long int D.12382;
  long int D.12383;
  unsigned int D.12386;
  struct _WapiHandleUnshared * D.12387;
  long unsigned int D.12388;
  long unsigned int D.12389;
  long unsigned int D.12390;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.5;
  unsigned int D.12392;
  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.12368>; else goto <D.12369>;
  <D.12368>:
  return;
  <D.12369>:
  D.12373 = _wapi_handle_type (handle);
  if (D.12373 != 9) goto <D.12374>; else goto <D.12371>;
  <D.12374>:
  D.12375 = _wapi_handle_type (handle);
  if (D.12375 != 11) goto <D.12376>; else goto <D.12371>;
  <D.12376>:
  D.12377 = _wapi_handle_type (handle);
  if (D.12377 != 12) goto <D.12378>; else goto <D.12371>;
  <D.12378>:
  D.12379 = _wapi_handle_type (handle);
  if (D.12379 != 13) goto <D.12380>; else goto <D.12371>;
  <D.12380>:
  iftmp.4 = 1;
  goto <D.12372>;
  <D.12371>:
  iftmp.4 = 0;
  <D.12372>:
  D.12381 = iftmp.4 != 0;
  D.12382 = (long int) D.12381;
  D.12383 = __builtin_expect (D.12382, 0);
  if (D.12383 != 0) goto <D.12384>; else goto <D.12385>;
  <D.12384>:
  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.12385>:
  D.12386 = idx / 256;
  D.12387 = _wapi_private_handles[D.12386];
  D.12388 = (long unsigned int) idx;
  D.12389 = D.12388 & 255;
  D.12390 = D.12389 * 200;
  handle_data = D.12387 + D.12390;
  ref = &handle_data->u.shared;
  _wapi_shared_layout.5 = _wapi_shared_layout;
  D.12392 = ref->offset;
  shared_data = &_wapi_shared_layout.5->handles[D.12392];
  shared_data->signalled = state;
}


_wapi_handle_type (void * handle)
{
  long int handle.6;
  unsigned int D.12399;
  struct _WapiHandleUnshared * D.12400;
  WapiHandleType D.12401;
  unsigned int D.12402;
  struct _WapiHandleUnshared * D.12403;
  long unsigned int D.12404;
  long unsigned int D.12405;
  long unsigned int D.12406;
  struct _WapiHandleUnshared * D.12407;
  guint32 idx;

  handle.6 = (long int) handle;
  idx = (guint32) handle.6;
  if (idx > 4194303) goto <D.12395>; else goto <D.12397>;
  <D.12397>:
  if (idx > 268435455) goto <D.12395>; else goto <D.12398>;
  <D.12398>:
  D.12399 = idx / 256;
  D.12400 = _wapi_private_handles[D.12399];
  if (D.12400 == 0B) goto <D.12395>; else goto <D.12396>;
  <D.12395>:
  D.12401 = 0;
  return D.12401;
  <D.12396>:
  D.12402 = idx / 256;
  D.12403 = _wapi_private_handles[D.12402];
  D.12404 = (long unsigned int) idx;
  D.12405 = D.12404 & 255;
  D.12406 = D.12405 * 200;
  D.12407 = D.12403 + D.12406;
  D.12401 = D.12407->type;
  return D.12401;
}


_wapi_handle_unlock_shared_handles ()
{
  int D.12409;

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


process_close (void * handle, void * data)
{
  struct MonoProcess * D.12411;
  int D.12414;
  int D.12415;
  gint32 * D.12418;
  struct _WapiHandle_process * process_handle;

  process_handle = data;
  D.12411 = process_handle->mono_process;
  if (D.12411 != 0B) goto <D.12412>; else goto <D.12413>;
  <D.12412>:
  D.12414 = process_handle->self;
  D.12415 = _wapi_getpid ();
  if (D.12414 == D.12415) goto <D.12416>; else goto <D.12417>;
  <D.12416>:
  D.12411 = process_handle->mono_process;
  D.12418 = &D.12411->handle_count;
  InterlockedDecrement (D.12418);
  <D.12417>:
  <D.12413>:
  mono_processes_cleanup ();
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.12419;
  unsigned int D.12420;

  D.12420 = __sync_sub_and_fetch_4 (val, 1);
  D.12419 = (gint32) D.12420;
  return D.12419;
}


mono_processes_cleanup ()
{
  int D.12422;
  int D.12425;
  void * D.12428;
  int D.12436;
  unsigned int spin.7;
  struct MonoProcess * mono_processes.8;
  struct MonoProcess * mono_processes.9;
  int mono_processes_read_lock.10;
  union MonoSemType * D.12457;
  struct MonoProcess * mp;
  struct MonoProcess * prev;
  struct MonoProcess * candidate;
  void * unref_handle;
  int spin;

  prev = 0B;
  candidate = 0B;
  D.12422 = InterlockedCompareExchange (&mono_processes_cleaning_up, 1, 0);
  if (D.12422 != 0) goto <D.12423>; else goto <D.12424>;
  <D.12423>:
  return;
  <D.12424>:
  mp = mono_processes;
  goto <D.12204>;
  <D.12205>:
  D.12425 = mp->pid;
  if (D.12425 == 0) goto <D.12426>; else goto <D.12427>;
  <D.12426>:
  D.12428 = mp->handle;
  if (D.12428 != 0B) goto <D.12429>; else goto <D.12430>;
  <D.12429>:
  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.12431>; else goto <D.12432>;
  <D.12431>:
  _wapi_handle_unref (unref_handle);
  <D.12432>:
  // predicted unlikely by continue predictor.
  goto <D.12204>;
  <D.12430>:
  <D.12427>:
  mp = mp->next;
  <D.12204>:
  if (mp != 0B) goto <D.12205>; else goto <D.12206>;
  <D.12206>:
  mp = mono_processes;
  spin = 0;
  goto <D.12208>;
  <D.12209>:
  D.12436 = mp->handle_count;
  if (D.12436 == 0) goto <D.12437>; else goto <D.12433>;
  <D.12437>:
  D.12425 = mp->pid;
  if (D.12425 == 0) goto <D.12434>; else goto <D.12433>;
  <D.12433>:
  if (candidate != 0B) goto <D.12434>; else goto <D.12435>;
  <D.12434>:
  if (spin > 0) goto <D.12438>; else goto <D.12439>;
  <D.12438>:
  spin.7 = (unsigned int) spin;
  _wapi_handle_spin (spin.7);
  spin = spin << 1;
  <D.12439>:
  pthread_mutex_lock (&mono_processes_mutex);
  if (candidate == 0B) goto <D.12441>; else goto <D.12442>;
  <D.12441>:
  mono_processes.8 = mono_processes;
  if (mp == mono_processes.8) goto <D.12444>; else goto <D.12445>;
  <D.12444>:
  mono_processes.9 = mp->next;
  mono_processes = mono_processes.9;
  goto <D.12447>;
  <D.12445>:
  mono_processes.9 = mp->next;
  prev->next = mono_processes.9;
  <D.12447>:
  candidate = mp;
  <D.12442>:
  mono_memory_barrier ();
  mono_processes_read_lock.10 = mono_processes_read_lock;
  if (mono_processes_read_lock.10 != 0) goto <D.12449>; else goto <D.12450>;
  <D.12449>:
  if (spin == 0) goto <D.12451>; else goto <D.12452>;
  <D.12451>:
  spin = 1;
  goto <D.12453>;
  <D.12452>:
  if (spin > 7) goto <D.12454>; else goto <D.12455>;
  <D.12454>:
  pthread_mutex_unlock (&mono_processes_mutex);
  goto <D.12207>;
  <D.12455>:
  <D.12453>:
  goto <D.12456>;
  <D.12450>:
  mp = candidate->next;
  D.12457 = &candidate->exit_sem;
  sem_destroy (D.12457);
  monoeg_g_free (candidate);
  candidate = 0B;
  <D.12456>:
  pthread_mutex_unlock (&mono_processes_mutex);
  // predicted unlikely by continue predictor.
  goto <D.12208>;
  <D.12435>:
  spin = 0;
  prev = mp;
  mp = mp->next;
  <D.12208>:
  if (mp != 0B) goto <D.12209>; else goto <D.12207>;
  <D.12207>:
  InterlockedDecrement (&mono_processes_cleaning_up);
}


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

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


mono_memory_barrier ()
{
  __sync_synchronize ();
}


ShellExecuteEx (struct WapiShellExecuteInfo * sei)
{
  gboolean D.12466;
  const gunichar2 * D.12467;
  const gunichar2 * utf16_quote.13;
  const gunichar2 * iftmp.14;
  const gunichar2 * D.12472;
  const gunichar2 * D.12478;
  unsigned int D.12481;
  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 * utf16_space.22;
  const gunichar2 * iftmp.23;
  unsigned int D.12510;
  void * D.12513;
  <unnamed type> D.12514;
  unsigned int D.12515;
  gboolean ret;
  struct WapiProcessInformation process_info;
  gunichar2 * args;

  try
    {
      if (sei == 0B) goto <D.12464>; else goto <D.12465>;
      <D.12464>:
      SetLastError (87);
      D.12466 = 0;
      return D.12466;
      <D.12465>:
      D.12467 = sei->lpFile;
      if (D.12467 == 0B) goto <D.12468>; else goto <D.12469>;
      <D.12468>:
      D.12466 = 1;
      return D.12466;
      <D.12469>:
      utf16_quote.13 = utf16_quote;
      D.12467 = sei->lpFile;
      utf16_quote.13 = utf16_quote;
      D.12472 = sei->lpParameters;
      if (D.12472 != 0B) goto <D.12473>; else goto <D.12474>;
      <D.12473>:
      iftmp.14 = utf16_space;
      goto <D.12475>;
      <D.12474>:
      iftmp.14 = 0B;
      <D.12475>:
      D.12472 = sei->lpParameters;
      args = utf16_concat (utf16_quote.13, D.12467, utf16_quote.13, iftmp.14, D.12472, 0B);
      if (args == 0B) goto <D.12476>; else goto <D.12477>;
      <D.12476>:
      SetLastError (13);
      D.12466 = 0;
      return D.12466;
      <D.12477>:
      D.12478 = sei->lpDirectory;
      ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.12478, 0B, &process_info);
      monoeg_g_free (args);
      if (ret == 0) goto <D.12479>; else goto <D.12480>;
      <D.12479>:
      D.12481 = GetLastError ();
      if (D.12481 == 14) goto <D.12482>; else goto <D.12483>;
      <D.12482>:
      D.12466 = ret;
      return D.12466;
      <D.12483>:
      <D.12480>:
      if (ret == 0) goto <D.12484>; else goto <D.12485>;
      <D.12484>:
      {
        static char * handler;
        static gunichar2 * handler_utf16;

        handler_utf16.15 = handler_utf16;
        if (handler_utf16.15 == -1B) goto <D.12487>; else goto <D.12488>;
        <D.12487>:
        D.12466 = 0;
        return D.12466;
        <D.12488>:
        handler.16 = monoeg_g_find_program_in_path ("xdg-open");
        handler = handler.16;
        handler.17 = handler;
        if (handler.17 == 0B) goto <D.12491>; else goto <D.12492>;
        <D.12491>:
        handler.18 = monoeg_g_find_program_in_path ("gnome-open");
        handler = handler.18;
        handler.17 = handler;
        if (handler.17 == 0B) goto <D.12494>; else goto <D.12495>;
        <D.12494>:
        handler.19 = monoeg_g_find_program_in_path ("kfmclient");
        handler = handler.19;
        handler.17 = handler;
        if (handler.17 == 0B) goto <D.12497>; else goto <D.12498>;
        <D.12497>:
        handler_utf16 = -1B;
        D.12466 = 0;
        return D.12466;
        <D.12498>:
        {
          char * old;

          old = handler;
          handler.20 = monoeg_g_strconcat (old, " exec", 0B);
          handler = handler.20;
          monoeg_g_free (old);
        }
        <D.12495>:
        <D.12492>:
        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);
        handler_utf16.15 = handler_utf16;
        utf16_space.22 = utf16_space;
        utf16_quote.13 = utf16_quote;
        D.12467 = sei->lpFile;
        utf16_quote.13 = utf16_quote;
        D.12472 = sei->lpParameters;
        if (D.12472 != 0B) goto <D.12503>; else goto <D.12504>;
        <D.12503>:
        iftmp.23 = utf16_space;
        goto <D.12505>;
        <D.12504>:
        iftmp.23 = 0B;
        <D.12505>:
        D.12472 = sei->lpParameters;
        args = utf16_concat (handler_utf16.15, utf16_space.22, utf16_quote.13, D.12467, utf16_quote.13, iftmp.23, D.12472, 0B);
        if (args == 0B) goto <D.12506>; else goto <D.12507>;
        <D.12506>:
        SetLastError (13);
        D.12466 = 0;
        return D.12466;
        <D.12507>:
        D.12478 = sei->lpDirectory;
        ret = CreateProcess (0B, args, 0B, 0B, 1, 1024, 0B, D.12478, 0B, &process_info);
        monoeg_g_free (args);
        if (ret == 0) goto <D.12508>; else goto <D.12509>;
        <D.12508>:
        D.12510 = GetLastError ();
        if (D.12510 != 14) goto <D.12511>; else goto <D.12512>;
        <D.12511>:
        SetLastError (13);
        <D.12512>:
        D.12466 = 0;
        return D.12466;
        <D.12509>:
        D.12513 = process_info.hProcess;
        CloseHandle (D.12513);
        process_info.hProcess = 0B;
      }
      <D.12485>:
      D.12514 = sei->fMask;
      D.12515 = D.12514 & 64;
      if (D.12515 != 0) goto <D.12516>; else goto <D.12517>;
      <D.12516>:
      D.12513 = process_info.hProcess;
      sei->hProcess = D.12513;
      goto <D.12518>;
      <D.12517>:
      D.12513 = process_info.hProcess;
      CloseHandle (D.12513);
      <D.12518>:
      D.12466 = ret;
      return D.12466;
    }
  finally
    {
      process_info = {CLOBBER};
    }
}


utf16_concat (const gunichar2 * first)
{
  int D.12521;
  char * args.24;
  char * args.25;
  int D.12524;
  char * args.26;
  char * args.27;
  int D.12527;
  long unsigned int D.12528;
  long unsigned int D.12529;
  gunichar2 * D.12532;
  long unsigned int D.12533;
  long unsigned int D.12534;
  gunichar2 * D.12535;
  int i.28;
  long unsigned int D.12537;
  long unsigned int D.12538;
  gunichar2 * D.12539;
  short unsigned int D.12540;
  char * args.29;
  char * args.30;
  int i.31;
  long unsigned int D.12544;
  long unsigned int D.12545;
  gunichar2 * D.12546;
  short unsigned int D.12547;
  char * args.32;
  char * args.33;
  char * args;
  int total;
  int i;
  const gunichar2 * s;
  gunichar2 * ret;

  try
    {
      total = 0;
      __builtin_va_start (&args, 0);
      D.12521 = len16 (first);
      total = D.12521 + total;
      args.24 = args;
      args.25 = args.24 + 8;
      args = args.25;
      s = MEM[(gunichar2 * *)args.24];
      goto <D.11688>;
      <D.11687>:
      D.12524 = len16 (s);
      total = D.12524 + total;
      args.26 = args;
      args.27 = args.26 + 8;
      args = args.27;
      s = MEM[(gunichar2 * *)args.26];
      <D.11688>:
      if (s != 0B) goto <D.11687>; else goto <D.11689>;
      <D.11689>:
      __builtin_va_end (&args);
      D.12527 = total + 1;
      D.12528 = (long unsigned int) D.12527;
      D.12529 = D.12528 * 2;
      ret = monoeg_malloc (D.12529);
      if (ret == 0B) goto <D.12530>; else goto <D.12531>;
      <D.12530>:
      D.12532 = 0B;
      return D.12532;
      <D.12531>:
      D.12533 = (long unsigned int) total;
      D.12534 = D.12533 * 2;
      D.12535 = ret + D.12534;
      *D.12535 = 0;
      i = 0;
      s = first;
      goto <D.11691>;
      <D.11690>:
      i.28 = i;
      i = i.28 + 1;
      D.12537 = (long unsigned int) i.28;
      D.12538 = D.12537 * 2;
      D.12539 = ret + D.12538;
      D.12540 = *s;
      *D.12539 = D.12540;
      s = s + 2;
      <D.11691>:
      D.12540 = *s;
      if (D.12540 != 0) goto <D.11690>; else goto <D.11692>;
      <D.11692>:
      __builtin_va_start (&args, 0);
      args.29 = args;
      args.30 = args.29 + 8;
      args = args.30;
      s = MEM[(gunichar2 * *)args.29];
      goto <D.11698>;
      <D.11697>:
      {
        const gunichar2 * p;

        p = s;
        goto <D.11695>;
        <D.11694>:
        i.31 = i;
        i = i.31 + 1;
        D.12544 = (long unsigned int) i.31;
        D.12545 = D.12544 * 2;
        D.12546 = ret + D.12545;
        D.12547 = *p;
        *D.12546 = D.12547;
        p = p + 2;
        <D.11695>:
        D.12547 = *p;
        if (D.12547 != 0) goto <D.11694>; else goto <D.11696>;
        <D.11696>:
      }
      args.32 = args;
      args.33 = args.32 + 8;
      args = args.33;
      s = MEM[(gunichar2 * *)args.32];
      <D.11698>:
      if (s != 0B) goto <D.11697>; else goto <D.11699>;
      <D.11699>:
      __builtin_va_end (&args);
      D.12532 = ret;
      return D.12532;
    }
  finally
    {
      args = {CLOBBER};
    }
}


len16 (const gunichar2 * str)
{
  const gunichar2 * str.34;
  short unsigned int D.12553;
  int D.12554;
  int len;

  len = 0;
  goto <D.11677>;
  <D.11676>:
  len = len + 1;
  <D.11677>:
  str.34 = str;
  str = str.34 + 2;
  D.12553 = *str.34;
  if (D.12553 != 0) goto <D.11676>; else goto <D.11678>;
  <D.11678>:
  D.12554 = len;
  return D.12554;
}


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

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


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.12572;
  const short unsigned int * D.12573;
  char D.12574;
  long unsigned int D.12575;
  long unsigned int D.12576;
  const short unsigned int * D.12577;
  short unsigned int D.12578;
  int D.12579;
  int D.12580;
  gchar * D.12583;
  char D.12584;
  const void * D.12587;
  long unsigned int D.12588;
  long unsigned int D.12589;
  long unsigned int D.12590;
  sizetype D.12591;
  gchar * D.12592;
  char D.12593;
  int D.12596;
  int D.12600;
  char D.12606;
  sizetype D.12608;
  gchar * D.12609;
  char D.12610;
  unsigned int D.12614;
  sizetype D.12615;
  gchar * D.12616;
  char D.12617;
  long unsigned int D.12619;
  long unsigned int D.12620;
  const short unsigned int * D.12621;
  short unsigned int D.12622;
  int D.12623;
  int D.12624;
  const gchar * D.12625;
  unsigned int D.12626;
  long unsigned int D.12627;
  sizetype D.12628;
  gchar * D.12629;
  long unsigned int D.12632;
  long unsigned int D.12633;
  const short unsigned int * D.12634;
  short unsigned int D.12635;
  int D.12636;
  int D.12637;
  long unsigned int D.12640;
  char D.12647;
  long unsigned int D.12648;
  long unsigned int D.12649;
  const short unsigned int * D.12650;
  short unsigned int D.12651;
  int D.12652;
  int D.12653;
  gchar * D.12656;
  char D.12657;
  const void * D.12660;
  long unsigned int D.12661;
  long unsigned int D.12662;
  long unsigned int D.12663;
  sizetype D.12664;
  gchar * D.12665;
  int D.12668;
  int D.12672;
  int D.12677;
  const gunichar2 * utf16_space.35;
  char D.12691;
  struct GError * gerr.36;
  gchar * D.12696;
  <unnamed type> D.12700;
  unsigned int D.12701;
  void * D.12703;
  long int D.12704;
  void * D.12705;
  long int D.12706;
  void * D.12707;
  long int D.12708;
  void * D.12709;
  long int D.12710;
  void * D.12711;
  long int D.12712;
  void * D.12713;
  long int D.12714;
  short unsigned int D.12719;
  unsigned int D.12720;
  long unsigned int D.12721;
  long unsigned int D.12722;
  long unsigned int D.12723;
  long unsigned int D.12724;
  gchar * * D.12725;
  gchar * D.12726;
  char * * environ.37;
  long unsigned int D.12729;
  long unsigned int D.12730;
  char * * D.12731;
  char * D.12732;
  gchar * D.12733;
  long int handle.38;
  unsigned int D.12737;
  unsigned int D.12738;
  struct _WapiHandleUnshared * D.12739;
  long unsigned int D.12740;
  long unsigned int D.12741;
  long unsigned int D.12742;
  unsigned int D.12743;
  gchar * D.12744;
  int D.12745;
  int D.12748;
  _Bool D.12749;
  long int D.12750;
  long int D.12751;
  int D.12758;
  int D.12763;
  int D.12764;
  int i.39;
  int D.12768;
  gchar * * argv.40;
  gchar * D.12772;
  struct _WapiHandle_process * process_handle_data.41;
  union MonoSemType * D.12776;
  int D.12777;
  int * D.12780;
  int D.12781;
  char * D.12782;
  int D.12784;
  struct MonoProcess * mono_processes.42;
  unsigned int pid.43;
  gboolean D.12807;
  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.12558>; else goto <D.12559>;
      <D.12558>:
      cmd = mono_unicode_to_external (appname);
      if (cmd == 0B) goto <D.12560>; else goto <D.12561>;
      <D.12560>:
      SetLastError (3);
      goto free_strings;
      <D.12561>:
      switchDirectorySeparators (cmd);
      <D.12559>:
      if (cmdline != 0B) goto <D.12562>; else goto <D.12563>;
      <D.12562>:
      args = mono_unicode_to_external (cmdline);
      if (args == 0B) goto <D.12564>; else goto <D.12565>;
      <D.12564>:
      SetLastError (3);
      goto free_strings;
      <D.12565>:
      <D.12563>:
      if (cwd != 0B) goto <D.12566>; else goto <D.12567>;
      <D.12566>:
      dir = mono_unicode_to_external (cwd);
      if (dir == 0B) goto <D.12568>; else goto <D.12569>;
      <D.12568>:
      SetLastError (3);
      goto free_strings;
      <D.12569>:
      switchDirectorySeparators (dir);
      <D.12567>:
      if (cmd != 0B) goto <D.12570>; else goto <D.12571>;
      <D.12570>:
      {
        gchar * unquoted;

        D.12572 = __ctype_b_loc ();
        D.12573 = *D.12572;
        D.12574 = *cmd;
        D.12575 = (long unsigned int) D.12574;
        D.12576 = D.12575 * 2;
        D.12577 = D.12573 + D.12576;
        D.12578 = *D.12577;
        D.12579 = (int) D.12578;
        D.12580 = D.12579 & 1024;
        if (D.12580 != 0) goto <D.12581>; else goto <D.12582>;
        <D.12581>:
        D.12583 = cmd + 1;
        D.12584 = *D.12583;
        if (D.12584 == 58) goto <D.12585>; else goto <D.12586>;
        <D.12585>:
        D.12587 = cmd + 2;
        D.12588 = strlen (cmd);
        D.12589 = D.12588 + 18446744073709551614;
        memmove (cmd, D.12587, D.12589);
        D.12590 = strlen (cmd);
        D.12591 = D.12590 + 18446744073709551614;
        D.12592 = cmd + D.12591;
        *D.12592 = 0;
        <D.12586>:
        <D.12582>:
        unquoted = monoeg_g_shell_unquote (cmd, 0B);
        D.12593 = *unquoted;
        if (D.12593 == 47) goto <D.12594>; else goto <D.12595>;
        <D.12594>:
        prog = monoeg_strdup (unquoted);
        D.12596 = is_executable (prog);
        if (D.12596 == 0) goto <D.12597>; else goto <D.12598>;
        <D.12597>:
        monoeg_g_free (unquoted);
        SetLastError (2);
        goto free_strings;
        <D.12598>:
        goto <D.12599>;
        <D.12595>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, unquoted);
          monoeg_g_free (curdir);
          D.12600 = is_executable (prog);
          if (D.12600 == 0) goto <D.12601>; else goto <D.12602>;
          <D.12601>:
          monoeg_g_free (unquoted);
          SetLastError (2);
          goto free_strings;
          <D.12602>:
        }
        <D.12599>:
        monoeg_g_free (unquoted);
        args_after_prog = args;
      }
      goto <D.12603>;
      <D.12571>:
      {
        gchar * token;
        char quote;

        token = 0B;
        args = monoeg_g_strchug (args);
        args_after_prog = args;
        D.12606 = *args;
        if (D.12606 == 34) goto <D.12604>; else goto <D.12607>;
        <D.12607>:
        D.12606 = *args;
        if (D.12606 == 39) goto <D.12604>; else goto <D.12605>;
        <D.12604>:
        quote = *args;
        i = 1;
        goto <D.11795>;
        <D.11794>:
        i = i + 1;
        <D.11795>:
        D.12608 = (sizetype) i;
        D.12609 = args + D.12608;
        D.12610 = *D.12609;
        if (D.12610 != 0) goto <D.12611>; else goto <D.11796>;
        <D.12611>:
        D.12608 = (sizetype) i;
        D.12609 = args + D.12608;
        D.12610 = *D.12609;
        if (D.12610 != quote) goto <D.11794>; else goto <D.11796>;
        <D.11796>:
        D.12614 = i + 1;
        D.12615 = (sizetype) D.12614;
        D.12616 = args + D.12615;
        D.12617 = *D.12616;
        if (D.12617 == 0) goto <D.12612>; else goto <D.12618>;
        <D.12618>:
        D.12572 = __ctype_b_loc ();
        D.12573 = *D.12572;
        D.12614 = i + 1;
        D.12615 = (sizetype) D.12614;
        D.12616 = args + D.12615;
        D.12617 = *D.12616;
        D.12619 = (long unsigned int) D.12617;
        D.12620 = D.12619 * 2;
        D.12621 = D.12573 + D.12620;
        D.12622 = *D.12621;
        D.12623 = (int) D.12622;
        D.12624 = D.12623 & 8192;
        if (D.12624 != 0) goto <D.12612>; else goto <D.12613>;
        <D.12612>:
        D.12625 = args + 1;
        D.12626 = i + 4294967295;
        D.12627 = (long unsigned int) D.12626;
        token = monoeg_g_strndup (D.12625, D.12627);
        D.12608 = (sizetype) i;
        D.12628 = D.12608 + 1;
        D.12629 = args + D.12628;
        args_after_prog = monoeg_g_strchug (D.12629);
        <D.12613>:
        <D.12605>:
        if (token == 0B) goto <D.12630>; else goto <D.12631>;
        <D.12630>:
        i = 0;
        goto <D.11799>;
        <D.11798>:
        D.12572 = __ctype_b_loc ();
        D.12573 = *D.12572;
        D.12608 = (sizetype) i;
        D.12609 = args + D.12608;
        D.12610 = *D.12609;
        D.12632 = (long unsigned int) D.12610;
        D.12633 = D.12632 * 2;
        D.12634 = D.12573 + D.12633;
        D.12635 = *D.12634;
        D.12636 = (int) D.12635;
        D.12637 = D.12636 & 8192;
        if (D.12637 != 0) goto <D.12638>; else goto <D.12639>;
        <D.12638>:
        D.12640 = (long unsigned int) i;
        token = monoeg_g_strndup (args, D.12640);
        D.12608 = (sizetype) i;
        D.12628 = D.12608 + 1;
        args_after_prog = args + D.12628;
        goto <D.11797>;
        <D.12639>:
        i = i + 1;
        <D.11799>:
        D.12608 = (sizetype) i;
        D.12609 = args + D.12608;
        D.12610 = *D.12609;
        if (D.12610 != 0) goto <D.11798>; else goto <D.11797>;
        <D.11797>:
        <D.12631>:
        if (token == 0B) goto <D.12641>; else goto <D.12642>;
        <D.12641>:
        D.12606 = *args;
        if (D.12606 != 0) goto <D.12643>; else goto <D.12644>;
        <D.12643>:
        token = monoeg_strdup (args);
        args_after_prog = 0B;
        <D.12644>:
        <D.12642>:
        if (token == 0B) goto <D.12645>; else goto <D.12646>;
        <D.12645>:
        SetLastError (3);
        goto free_strings;
        <D.12646>:
        switchDirectorySeparators (token);
        D.12572 = __ctype_b_loc ();
        D.12573 = *D.12572;
        D.12647 = *token;
        D.12648 = (long unsigned int) D.12647;
        D.12649 = D.12648 * 2;
        D.12650 = D.12573 + D.12649;
        D.12651 = *D.12650;
        D.12652 = (int) D.12651;
        D.12653 = D.12652 & 1024;
        if (D.12653 != 0) goto <D.12654>; else goto <D.12655>;
        <D.12654>:
        D.12656 = token + 1;
        D.12657 = *D.12656;
        if (D.12657 == 58) goto <D.12658>; else goto <D.12659>;
        <D.12658>:
        D.12660 = token + 2;
        D.12661 = strlen (token);
        D.12662 = D.12661 + 18446744073709551614;
        memmove (token, D.12660, D.12662);
        D.12663 = strlen (token);
        D.12664 = D.12663 + 18446744073709551614;
        D.12665 = token + D.12664;
        *D.12665 = 0;
        <D.12659>:
        <D.12655>:
        D.12647 = *token;
        if (D.12647 == 47) goto <D.12666>; else goto <D.12667>;
        <D.12666>:
        prog = monoeg_strdup (token);
        D.12668 = is_executable (prog);
        if (D.12668 == 0) goto <D.12669>; else goto <D.12670>;
        <D.12669>:
        monoeg_g_free (token);
        SetLastError (2);
        goto free_strings;
        <D.12670>:
        goto <D.12671>;
        <D.12667>:
        {
          char * curdir;

          curdir = monoeg_g_get_current_dir ();
          prog = monoeg_g_strdup_printf ("%s/%s", curdir, token);
          monoeg_g_free (curdir);
          D.12672 = is_executable (prog);
          if (D.12672 == 0) goto <D.12673>; else goto <D.12674>;
          <D.12673>:
          monoeg_g_free (prog);
          prog = monoeg_g_find_program_in_path (token);
          if (prog == 0B) goto <D.12675>; else goto <D.12676>;
          <D.12675>:
          monoeg_g_free (token);
          SetLastError (2);
          goto free_strings;
          <D.12676>:
          <D.12674>:
        }
        <D.12671>:
        monoeg_g_free (token);
      }
      <D.12603>:
      D.12677 = is_managed_binary (prog);
      if (D.12677 != 0) goto <D.12678>; else goto <D.12679>;
      <D.12678>:
      {
        gunichar2 * newapp;
        gunichar2 * newcmd;
        gsize bytes_ignored;

        try
          {
            newapp = mono_unicode_from_external ("mono", &bytes_ignored);
            if (newapp != 0B) goto <D.12680>; else goto <D.12681>;
            <D.12680>:
            if (appname != 0B) goto <D.12682>; else goto <D.12683>;
            <D.12682>:
            utf16_space.35 = utf16_space;
            utf16_space.35 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.35, appname, utf16_space.35, cmdline, 0B);
            goto <D.12685>;
            <D.12683>:
            utf16_space.35 = utf16_space;
            newcmd = utf16_concat (newapp, utf16_space.35, cmdline, 0B);
            <D.12685>:
            monoeg_g_free (newapp);
            if (newcmd != 0B) goto <D.12686>; else goto <D.12687>;
            <D.12686>:
            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.12687>:
            <D.12681>:
          }
        finally
          {
            bytes_ignored = {CLOBBER};
          }
      }
      <D.12679>:
      if (args_after_prog != 0B) goto <D.12690>; else goto <D.12688>;
      <D.12690>:
      D.12691 = *args_after_prog;
      if (D.12691 != 0) goto <D.12692>; else goto <D.12688>;
      <D.12692>:
      {
        gchar * qprog;

        qprog = monoeg_g_shell_quote (prog);
        full_prog = monoeg_g_strconcat (qprog, " ", args_after_prog, 0B);
        monoeg_g_free (qprog);
      }
      goto <D.12689>;
      <D.12688>:
      full_prog = monoeg_g_shell_quote (prog);
      <D.12689>:
      ret = monoeg_g_shell_parse_argv (full_prog, 0B, &argv, &gerr);
      if (ret == 0) goto <D.12693>; else goto <D.12694>;
      <D.12693>:
      gerr.36 = gerr;
      D.12696 = gerr.36->message;
      monoeg_g_log (0B, 32, "CreateProcess: %s\n", D.12696);
      gerr.36 = gerr;
      monoeg_g_error_free (gerr.36);
      gerr = 0B;
      goto free_strings;
      <D.12694>:
      if (startup != 0B) goto <D.12699>; else goto <D.12697>;
      <D.12699>:
      D.12700 = startup->dwFlags;
      D.12701 = D.12700 & 256;
      if (D.12701 != 0) goto <D.12702>; else goto <D.12697>;
      <D.12702>:
      D.12703 = startup->hStdInput;
      D.12704 = (long int) D.12703;
      in_fd = (int) D.12704;
      D.12705 = startup->hStdOutput;
      D.12706 = (long int) D.12705;
      out_fd = (int) D.12706;
      D.12707 = startup->hStdError;
      D.12708 = (long int) D.12707;
      err_fd = (int) D.12708;
      goto <D.12698>;
      <D.12697>:
      D.12709 = GetStdHandle (-10);
      D.12710 = (long int) D.12709;
      in_fd = (int) D.12710;
      D.12711 = GetStdHandle (-11);
      D.12712 = (long int) D.12711;
      out_fd = (int) D.12712;
      D.12713 = GetStdHandle (-12);
      D.12714 = (long int) D.12713;
      err_fd = (int) D.12714;
      <D.12698>:
      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.12715>; else goto <D.12716>;
      <D.12715>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      ret = 0;
      SetLastError (14);
      goto free_strings;
      <D.12716>:
      if (new_environ != 0B) goto <D.12717>; else goto <D.12718>;
      <D.12717>:
      {
        gunichar2 * new_environp;

        new_environp = new_environ;
        goto <D.11811>;
        <D.11810>:
        env_count = env_count + 1;
        goto <D.11808>;
        <D.11807>:
        new_environp = new_environp + 2;
        <D.11808>:
        D.12719 = *new_environp;
        if (D.12719 != 0) goto <D.11807>; else goto <D.11809>;
        <D.11809>:
        new_environp = new_environp + 2;
        <D.11811>:
        D.12719 = *new_environp;
        if (D.12719 != 0) goto <D.11810>; else goto <D.11812>;
        <D.11812>:
        D.12720 = env_count + 2;
        D.12721 = (long unsigned int) D.12720;
        D.12722 = D.12721 * 8;
        env_strings = monoeg_malloc0 (D.12722);
        env_count = 0;
        new_environp = new_environ;
        goto <D.11817>;
        <D.11816>:
        D.12723 = (long unsigned int) env_count;
        D.12724 = D.12723 * 8;
        D.12725 = env_strings + D.12724;
        D.12726 = mono_unicode_to_external (new_environp);
        *D.12725 = D.12726;
        env_count = env_count + 1;
        goto <D.11814>;
        <D.11813>:
        new_environp = new_environp + 2;
        <D.11814>:
        D.12719 = *new_environp;
        if (D.12719 != 0) goto <D.11813>; else goto <D.11815>;
        <D.11815>:
        new_environp = new_environp + 2;
        <D.11817>:
        D.12719 = *new_environp;
        if (D.12719 != 0) goto <D.11816>; else goto <D.11818>;
        <D.11818>:
      }
      goto <D.12727>;
      <D.12718>:
      i = 0;
      goto <D.11820>;
      <D.11819>:
      env_count = env_count + 1;
      i = i + 1;
      <D.11820>:
      environ.37 = environ;
      D.12729 = (long unsigned int) i;
      D.12730 = D.12729 * 8;
      D.12731 = environ.37 + D.12730;
      D.12732 = *D.12731;
      if (D.12732 != 0B) goto <D.11819>; else goto <D.11821>;
      <D.11821>:
      D.12720 = env_count + 2;
      D.12721 = (long unsigned int) D.12720;
      D.12722 = D.12721 * 8;
      env_strings = monoeg_malloc0 (D.12722);
      env_count = 0;
      i = 0;
      goto <D.11823>;
      <D.11822>:
      D.12723 = (long unsigned int) env_count;
      D.12724 = D.12723 * 8;
      D.12725 = env_strings + D.12724;
      environ.37 = environ;
      D.12729 = (long unsigned int) i;
      D.12730 = D.12729 * 8;
      D.12731 = environ.37 + D.12730;
      D.12732 = *D.12731;
      D.12733 = monoeg_strdup (D.12732);
      *D.12725 = D.12733;
      env_count = env_count + 1;
      i = i + 1;
      <D.11823>:
      environ.37 = environ;
      D.12729 = (long unsigned int) i;
      D.12730 = D.12729 * 8;
      D.12731 = environ.37 + D.12730;
      D.12732 = *D.12731;
      if (D.12732 != 0B) goto <D.11822>; else goto <D.11824>;
      <D.11824>:
      <D.12727>:
      if (env_strings != 0B) goto <D.12734>; else goto <D.12735>;
      <D.12734>:
      {
        struct _WapiHandleUnshared * handle_data;
        struct _WapiHandle_shared_ref * ref;

        handle.38 = (long int) handle;
        D.12737 = (unsigned int) handle.38;
        D.12738 = D.12737 / 256;
        D.12739 = _wapi_private_handles[D.12738];
        handle.38 = (long int) handle;
        D.12737 = (unsigned int) handle.38;
        D.12740 = (long unsigned int) D.12737;
        D.12741 = D.12740 & 255;
        D.12742 = D.12741 * 200;
        handle_data = D.12739 + D.12742;
        ref = &handle_data->u.shared;
        D.12723 = (long unsigned int) env_count;
        D.12724 = D.12723 * 8;
        D.12725 = env_strings + D.12724;
        D.12743 = ref->offset;
        D.12744 = monoeg_g_strdup_printf ("_WAPI_PROCESS_HANDLE_OFFSET=%d", D.12743);
        *D.12725 = D.12744;
      }
      <D.12735>:
      D.12745 = pipe (&startup_pipe);
      if (D.12745 == -1) goto <D.12746>; else goto <D.12747>;
      <D.12746>:
      startup_pipe[1] = -1;
      D.12748 = startup_pipe[1];
      startup_pipe[0] = D.12748;
      <D.12747>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.12749 = thr_ret != 0;
      D.12750 = (long int) D.12749;
      D.12751 = __builtin_expect (D.12750, 0);
      if (D.12751 != 0) goto <D.12752>; else goto <D.12753>;
      <D.12752>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "processes.c", 965, "thr_ret == 0");
      <D.12753>:
      pid = fork ();
      if (pid == -1) goto <D.12754>; else goto <D.12755>;
      <D.12754>:
      SetLastError (14);
      ret = 0;
      fork_failed = 1;
      goto cleanup;
      <D.12755>:
      if (pid == 0) goto <D.12756>; else goto <D.12757>;
      <D.12756>:
      D.12758 = startup_pipe[0];
      if (D.12758 != -1) goto <D.12759>; else goto <D.12760>;
      <D.12759>:
      {
        ssize_t _i;

        D.12758 = startup_pipe[0];
        _i = read (D.12758, &dummy, 1);
        D.12758 = startup_pipe[0];
        close (D.12758);
        D.12748 = startup_pipe[1];
        close (D.12748);
      }
      <D.12760>:
      dup2 (in_fd, 0);
      dup2 (out_fd, 1);
      dup2 (err_fd, 2);
      if (inherit_handles != 1) goto <D.12761>; else goto <D.12762>;
      <D.12761>:
      <D.12762>:
      D.12763 = getdtablesize ();
      D.12764 = D.12763 + -1;
      i = (guint32) D.12764;
      goto <D.11830>;
      <D.11829>:
      i.39 = (int) i;
      close (i.39);
      i = i + 4294967295;
      <D.11830>:
      if (i > 2) goto <D.11829>; else goto <D.11831>;
      <D.11831>:
      if (dir != 0B) goto <D.12766>; else goto <D.12767>;
      <D.12766>:
      D.12768 = chdir (dir);
      if (D.12768 == -1) goto <D.12769>; else goto <D.12770>;
      <D.12769>:
      _exit (-1);
      <D.12770>:
      <D.12767>:
      argv.40 = argv;
      D.12772 = *argv.40;
      argv.40 = argv;
      execve (D.12772, argv.40, env_strings);
      _exit (-1);
      <D.12757>:
      ret = _wapi_lookup_handle (handle, 9, &process_handle_data);
      if (ret == 0) goto <D.12773>; else goto <D.12774>;
      <D.12773>:
      monoeg_g_log (0B, 16, "%s: error looking up process handle %p", &__func__, handle);
      _wapi_handle_unref (handle);
      goto cleanup;
      <D.12774>:
      process_handle_data.41 = process_handle_data;
      process_handle_data.41->id = pid;
      mono_process = monoeg_malloc0 (64);
      mono_process->pid = pid;
      mono_process->handle_count = 1;
      D.12776 = &mono_process->exit_sem;
      D.12777 = sem_init (D.12776, 0, 0);
      if (D.12777 != 0) goto <D.12778>; else goto <D.12779>;
      <D.12778>:
      D.12780 = __errno_location ();
      D.12781 = *D.12780;
      D.12782 = strerror (D.12781);
      monoeg_g_log (0B, 16, "%s: could not create exit semaphore for process.", D.12782);
      monoeg_g_free (mono_process);
      goto <D.12783>;
      <D.12779>:
      _wapi_handle_ref (handle);
      mono_process->handle = handle;
      process_handle_data.41 = process_handle_data;
      D.12784 = _wapi_getpid ();
      process_handle_data.41->self = D.12784;
      process_handle_data.41 = process_handle_data;
      process_handle_data.41->mono_process = mono_process;
      pthread_mutex_lock (&mono_processes_mutex);
      mono_processes.42 = mono_processes;
      mono_process->next = mono_processes.42;
      mono_processes = mono_process;
      pthread_mutex_unlock (&mono_processes_mutex);
      <D.12783>:
      if (process_info != 0B) goto <D.12786>; else goto <D.12787>;
      <D.12786>:
      process_info->hProcess = handle;
      pid.43 = (unsigned int) pid;
      process_info->dwProcessId = pid.43;
      process_info->hThread = -1B;
      process_info->dwThreadId = 0;
      <D.12787>:
      cleanup:
      _wapi_handle_unlock_shared_handles ();
      if (fork_failed != 0) goto <D.12789>; else goto <D.12790>;
      <D.12789>:
      _wapi_handle_unref (handle);
      <D.12790>:
      D.12748 = startup_pipe[1];
      if (D.12748 != -1) goto <D.12791>; else goto <D.12792>;
      <D.12791>:
      {
        ssize_t _i;

        D.12748 = startup_pipe[1];
        _i = write (D.12748, &startup_pipe, 1);
        D.12758 = startup_pipe[0];
        close (D.12758);
        D.12748 = startup_pipe[1];
        close (D.12748);
      }
      <D.12792>:
      free_strings:
      if (cmd != 0B) goto <D.12793>; else goto <D.12794>;
      <D.12793>:
      monoeg_g_free (cmd);
      <D.12794>:
      if (full_prog != 0B) goto <D.12795>; else goto <D.12796>;
      <D.12795>:
      monoeg_g_free (full_prog);
      <D.12796>:
      if (prog != 0B) goto <D.12797>; else goto <D.12798>;
      <D.12797>:
      monoeg_g_free (prog);
      <D.12798>:
      if (args != 0B) goto <D.12799>; else goto <D.12800>;
      <D.12799>:
      monoeg_g_free (args);
      <D.12800>:
      if (dir != 0B) goto <D.12801>; else goto <D.12802>;
      <D.12801>:
      monoeg_g_free (dir);
      <D.12802>:
      if (env_strings != 0B) goto <D.12803>; else goto <D.12804>;
      <D.12803>:
      monoeg_g_strfreev (env_strings);
      <D.12804>:
      argv.40 = argv;
      if (argv.40 != 0B) goto <D.12805>; else goto <D.12806>;
      <D.12805>:
      argv.40 = argv;
      monoeg_g_strfreev (argv.40);
      <D.12806>:
      mono_processes_cleanup ();
      D.12807 = ret;
      return D.12807;
    }
  finally
    {
      argv = {CLOBBER};
      process_handle = {CLOBBER};
      process_handle_data = {CLOBBER};
      gerr = {CLOBBER};
      startup_pipe = {CLOBBER};
      dummy = {CLOBBER};
    }
}


process_add_sigchld_handler ()
{
  int D.12812;
  _Bool D.12813;
  long int D.12814;
  long int D.12815;
  struct sigaction sa;

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


mono_sigchld_signal_handler (int _dummy, struct siginfo_t * info, void * context)
{
  int * D.12819;
  int D.12820;
  int D.12822;
  int status.44;
  union MonoSemType * D.12826;
  int status;
  int pid;
  struct MonoProcess * p;

  try
    {
      InterlockedIncrement (&mono_processes_read_lock);
      <D.12229>:
      <D.12223>:
      pid = waitpid (-1, &status, 1);
      if (pid == -1) goto <D.12818>; else goto <D.12224>;
      <D.12818>:
      D.12819 = __errno_location ();
      D.12820 = *D.12819;
      if (D.12820 == 4) goto <D.12223>; else goto <D.12224>;
      <D.12224>:
      if (pid <= 0) goto <D.12225>; else goto <D.12821>;
      <D.12821>:
      p = mono_processes;
      goto <D.12228>;
      <D.12227>:
      D.12822 = p->pid;
      if (D.12822 == pid) goto <D.12823>; else goto <D.12824>;
      <D.12823>:
      p->pid = 0;
      status.44 = status;
      p->status = status.44;
      D.12826 = &p->exit_sem;
      mono_sem_post (D.12826);
      goto <D.12226>;
      <D.12824>:
      p = p->next;
      <D.12228>:
      if (p != 0B) goto <D.12227>; else goto <D.12226>;
      <D.12226>:
      goto <D.12229>;
      <D.12225>:
      InterlockedDecrement (&mono_processes_read_lock);
    }
  finally
    {
      status = {CLOBBER};
    }
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.12827;
  unsigned int D.12828;

  D.12828 = __sync_add_and_fetch_4 (val, 1);
  D.12827 = (gint32) D.12828;
  return D.12827;
}


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


switchDirectorySeparators (gchar * path)
{
  gchar * D.12830;
  char D.12831;
  long unsigned int D.12834;
  sizetype D.12837;
  gchar * D.12838;
  char D.12839;
  size_t i;
  size_t pathLength;

  pathLength = strlen (path);
  i = 0;
  goto <D.11751>;
  <D.11750>:
  D.12830 = path + i;
  D.12831 = *D.12830;
  if (D.12831 == 92) goto <D.12832>; else goto <D.12833>;
  <D.12832>:
  D.12834 = pathLength + 18446744073709551615;
  if (D.12834 > i) goto <D.12835>; else goto <D.12836>;
  <D.12835>:
  D.12837 = i + 1;
  D.12838 = path + D.12837;
  D.12839 = *D.12838;
  if (D.12839 != 39) goto <D.12840>; else goto <D.12841>;
  <D.12840>:
  D.12830 = path + i;
  *D.12830 = 47;
  <D.12841>:
  <D.12836>:
  <D.12833>:
  i = i + 1;
  <D.11751>:
  if (i < pathLength) goto <D.11750>; else goto <D.11752>;
  <D.11752>:
}


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

  D.12843 = __builtin_object_size (__dest, 0);
  D.12842 = __builtin___memmove_chk (__dest, __src, __len, D.12843);
  return D.12842;
}


is_executable (const char * prog)
{
  int D.12845;
  gboolean D.12848;
  int D.12849;
  unsigned int D.12852;
  unsigned int D.12853;
  struct stat buf;

  try
    {
      D.12845 = access (prog, 1);
      if (D.12845 != 0) goto <D.12846>; else goto <D.12847>;
      <D.12846>:
      D.12848 = 0;
      return D.12848;
      <D.12847>:
      D.12849 = stat (prog, &buf);
      if (D.12849 != 0) goto <D.12850>; else goto <D.12851>;
      <D.12850>:
      D.12848 = 0;
      return D.12848;
      <D.12851>:
      D.12852 = buf.st_mode;
      D.12853 = D.12852 & 61440;
      if (D.12853 == 32768) goto <D.12854>; else goto <D.12855>;
      <D.12854>:
      D.12848 = 1;
      return D.12848;
      <D.12855>:
      D.12848 = 0;
      return D.12848;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


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

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


is_managed_binary (const gchar * filename)
{
  int * D.12860;
  gboolean D.12863;
  long int D.12865;
  unsigned char D.12867;
  unsigned char D.12869;
  long int D.12872;
  int D.12874;
  int D.12875;
  int D.12876;
  int D.12877;
  unsigned char D.12878;
  int D.12879;
  int D.12880;
  int D.12881;
  unsigned char D.12882;
  int D.12883;
  int D.12884;
  int D.12885;
  long int D.12886;
  long int D.12889;
  long int D.12895;
  long int D.12897;
  long int D.12900;
  long int D.12902;
  unsigned char * D.12903;
  unsigned char * D.12904;
  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.12860 = __errno_location ();
      original_errno = *D.12860;
      file = open (filename, 0);
      managed = 0;
      if (file < 0) goto <D.12861>; else goto <D.12862>;
      <D.12861>:
      D.12860 = __errno_location ();
      *D.12860 = original_errno;
      D.12863 = 0;
      return D.12863;
      <D.12862>:
      file_size = lseek (file, 0, 2);
      lseek (file, 0, 0);
      if (file_size <= 63) goto leave; else goto <D.12864>;
      <D.12864>:
      D.12865 = read (file, &buffer, 2);
      num_read = (int) D.12865;
      if (num_read != 2) goto leave; else goto <D.12866>;
      <D.12866>:
      D.12867 = buffer[0];
      if (D.12867 != 77) goto leave; else goto <D.12868>;
      <D.12868>:
      D.12869 = buffer[1];
      if (D.12869 != 90) goto leave; else goto <D.12870>;
      <D.12870>:
      new_offset = lseek (file, 60, 0);
      if (new_offset != 60) goto leave; else goto <D.12871>;
      <D.12871>:
      D.12872 = read (file, &buffer, 4);
      num_read = (int) D.12872;
      if (num_read != 4) goto leave; else goto <D.12873>;
      <D.12873>:
      D.12867 = buffer[0];
      D.12874 = (int) D.12867;
      D.12869 = buffer[1];
      D.12875 = (int) D.12869;
      D.12876 = D.12875 << 8;
      D.12877 = D.12874 | D.12876;
      D.12878 = buffer[2];
      D.12879 = (int) D.12878;
      D.12880 = D.12879 << 16;
      D.12881 = D.12877 | D.12880;
      D.12882 = buffer[3];
      D.12883 = (int) D.12882;
      D.12884 = D.12883 << 24;
      D.12885 = D.12881 | D.12884;
      pe_header_offset = (off_t) D.12885;
      D.12886 = pe_header_offset + 23;
      if (D.12886 >= file_size) goto leave; else goto <D.12887>;
      <D.12887>:
      new_offset = lseek (file, pe_header_offset, 0);
      if (new_offset != pe_header_offset) goto leave; else goto <D.12888>;
      <D.12888>:
      D.12889 = read (file, &buffer, 4);
      num_read = (int) D.12889;
      if (num_read != 4) goto leave; else goto <D.12890>;
      <D.12890>:
      D.12867 = buffer[0];
      if (D.12867 != 80) goto leave; else goto <D.12891>;
      <D.12891>:
      D.12869 = buffer[1];
      if (D.12869 != 69) goto leave; else goto <D.12892>;
      <D.12892>:
      D.12878 = buffer[2];
      if (D.12878 != 0) goto leave; else goto <D.12893>;
      <D.12893>:
      D.12882 = buffer[3];
      if (D.12882 != 0) goto leave; else goto <D.12894>;
      <D.12894>:
      D.12895 = pe_header_offset + 20;
      new_offset = lseek (file, D.12895, 0);
      D.12895 = pe_header_offset + 20;
      if (D.12895 != new_offset) goto leave; else goto <D.12896>;
      <D.12896>:
      D.12897 = read (file, &buffer, 2);
      num_read = (int) D.12897;
      if (num_read != 2) goto leave; else goto <D.12898>;
      <D.12898>:
      D.12867 = buffer[0];
      D.12874 = (int) D.12867;
      D.12869 = buffer[1];
      D.12875 = (int) D.12869;
      D.12876 = D.12875 << 8;
      D.12877 = D.12874 | D.12876;
      if (D.12877 <= 215) goto leave; else goto <D.12899>;
      <D.12899>:
      optional_header_offset = pe_header_offset + 24;
      D.12900 = optional_header_offset + 208;
      new_offset = lseek (file, D.12900, 0);
      D.12900 = optional_header_offset + 208;
      if (D.12900 != new_offset) goto leave; else goto <D.12901>;
      <D.12901>:
      D.12902 = read (file, &buffer, 8);
      num_read = (int) D.12902;
      D.12903 = &buffer[0];
      first_word = MEM[(guint32 *)D.12903];
      D.12904 = &buffer[4];
      second_word = MEM[(guint32 *)D.12904];
      if (num_read != 8) goto leave; else goto <D.12905>;
      <D.12905>:
      if (first_word == 0) goto leave; else goto <D.12906>;
      <D.12906>:
      if (second_word == 0) goto leave; else goto <D.12907>;
      <D.12907>:
      managed = 1;
      leave:
      close (file);
      D.12860 = __errno_location ();
      *D.12860 = original_errno;
      D.12863 = managed;
      return D.12863;
    }
  finally
    {
      buffer = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.12910;
  int D.12913;
  int D.12918;
  int D.12920;
  int D.12921;
  int D.12924;
  int D.12925;

  D.12910 = __builtin_va_arg_pack_len ();
  if (D.12910 > 1) goto <D.12911>; else goto <D.12912>;
  <D.12911>:
  __open_too_many_args ();
  <D.12912>:
  D.12913 = __builtin_constant_p (__oflag);
  if (D.12913 != 0) goto <D.12914>; else goto <D.12915>;
  <D.12914>:
  D.12918 = __oflag & 64;
  if (D.12918 != 0) goto <D.12916>; else goto <D.12919>;
  <D.12919>:
  D.12920 = __oflag & 4259840;
  if (D.12920 == 4259840) goto <D.12916>; else goto <D.12917>;
  <D.12916>:
  D.12921 = __builtin_va_arg_pack_len ();
  if (D.12921 <= 0) goto <D.12922>; else goto <D.12923>;
  <D.12922>:
  __open_missing_mode ();
  D.12924 = __open_2 (__path, __oflag);
  return D.12924;
  <D.12923>:
  <D.12917>:
  D.12924 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.12924;
  <D.12915>:
  D.12925 = __builtin_va_arg_pack_len ();
  if (D.12925 <= 0) goto <D.12926>; else goto <D.12927>;
  <D.12926>:
  D.12924 = __open_2 (__path, __oflag);
  return D.12924;
  <D.12927>:
  D.12924 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.12924;
}


process_set_defaults (struct _WapiHandle_process * process_handle)
{
  long int D.12929;
  struct WapiFileTime * D.12930;

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


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

  if (str != 0B) goto <D.12931>; else goto <D.12932>;
  <D.12931>:
  D.12933 = __strdup (str);
  return D.12933;
  <D.12932>:
  D.12933 = 0B;
  return D.12933;
}


read (int __fd, void * __buf, size_t __nbytes)
{
  long unsigned int D.12935;
  int D.12938;
  ssize_t D.12941;
  long unsigned int D.12942;
  long unsigned int D.12943;
  long unsigned int D.12946;

  D.12935 = __builtin_object_size (__buf, 0);
  if (D.12935 != 18446744073709551615) goto <D.12936>; else goto <D.12937>;
  <D.12936>:
  D.12938 = __builtin_constant_p (__nbytes);
  if (D.12938 == 0) goto <D.12939>; else goto <D.12940>;
  <D.12939>:
  D.12942 = __builtin_object_size (__buf, 0);
  D.12941 = __read_chk (__fd, __buf, __nbytes, D.12942);
  return D.12941;
  <D.12940>:
  D.12943 = __builtin_object_size (__buf, 0);
  if (D.12943 < __nbytes) goto <D.12944>; else goto <D.12945>;
  <D.12944>:
  D.12946 = __builtin_object_size (__buf, 0);
  D.12941 = __read_chk_warn (__fd, __buf, __nbytes, D.12946);
  return D.12941;
  <D.12945>:
  <D.12937>:
  D.12941 = __read_alias (__fd, __buf, __nbytes);
  return D.12941;
}


_wapi_process_duplicate ()
{
  void * current_process.45;
  void * D.12949;

  mono_once (&process_current_once, process_set_current);
  current_process.45 = current_process;
  _wapi_handle_ref (current_process.45);
  D.12949 = current_process;
  return D.12949;
}


process_set_current ()
{
  int D.12953;
  unsigned int D.12954;
  void * current_process.46;
  void * current_process.47;
  struct _WapiHandle_process * process_handlep.48;
  int D.12960;
  int D.11859;
  int iftmp.49;
  int D.11858;
  const char[5] * D.12966;
  unsigned char D.12967;
  int D.12968;
  unsigned char D.12969;
  int D.12970;
  const unsigned char * D.12975;
  unsigned char D.12976;
  int D.12977;
  const unsigned char * D.12978;
  unsigned char D.12979;
  int D.12980;
  const unsigned char * D.12985;
  unsigned char D.12986;
  int D.12987;
  const unsigned char * D.12988;
  unsigned char D.12989;
  int D.12990;
  const unsigned char * D.12995;
  unsigned char D.12996;
  int D.12997;
  const unsigned char * D.12998;
  unsigned char D.12999;
  int D.13000;
  void * current_process.50;
  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.12951>; else goto <D.12952>;
      <D.12951>:
      {
        struct _WapiHandle_process * process_handlep;
        gchar * procname;
        gboolean ok;

        try
          {
            procname = 0B;
            D.12953 = atoi (handle_env);
            D.12954 = (unsigned int) D.12953;
            current_process.46 = _wapi_handle_new_from_offset (9, D.12954, 1);
            current_process = current_process.46;
            current_process.47 = current_process;
            ok = _wapi_lookup_handle (current_process.47, 9, &process_handlep);
            if (ok != 0) goto <D.12957>; else goto <D.12958>;
            <D.12957>:
            process_handlep.48 = process_handlep;
            D.12960 = process_handlep.48->id;
            if (D.12960 == pid) goto <D.12961>; else goto <D.12962>;
            <D.12961>:
            process_handlep.48 = process_handlep;
            procname = &process_handlep.48->proc_name;
            {
              size_t __s1_len;
              size_t __s2_len;

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

                __s2 = procname;
                D.12966 = "mono";
                D.12967 = MEM[(const unsigned char *)D.12966];
                D.12968 = (int) D.12967;
                D.12969 = *__s2;
                D.12970 = (int) D.12969;
                __result = D.12968 - D.12970;
                {
                  if (__s2_len != 0) goto <D.12971>; else goto <D.12972>;
                  <D.12971>:
                  if (__result == 0) goto <D.12973>; else goto <D.12974>;
                  <D.12973>:
                  D.12975 = &MEM[(void *)"mono" + 1B];
                  D.12976 = *D.12975;
                  D.12977 = (int) D.12976;
                  D.12978 = __s2 + 1;
                  D.12979 = *D.12978;
                  D.12980 = (int) D.12979;
                  __result = D.12977 - D.12980;
                  if (__s2_len > 1) goto <D.12981>; else goto <D.12982>;
                  <D.12981>:
                  if (__result == 0) goto <D.12983>; else goto <D.12984>;
                  <D.12983>:
                  D.12985 = &MEM[(void *)"mono" + 2B];
                  D.12986 = *D.12985;
                  D.12987 = (int) D.12986;
                  D.12988 = __s2 + 2;
                  D.12989 = *D.12988;
                  D.12990 = (int) D.12989;
                  __result = D.12987 - D.12990;
                  if (__s2_len > 2) goto <D.12991>; else goto <D.12992>;
                  <D.12991>:
                  if (__result == 0) goto <D.12993>; else goto <D.12994>;
                  <D.12993>:
                  D.12995 = &MEM[(void *)"mono" + 3B];
                  D.12996 = *D.12995;
                  D.12997 = (int) D.12996;
                  D.12998 = __s2 + 3;
                  D.12999 = *D.12998;
                  D.13000 = (int) D.12999;
                  __result = D.12997 - D.13000;
                  <D.12994>:
                  <D.12992>:
                  <D.12984>:
                  <D.12982>:
                  <D.12974>:
                  <D.12972>:
                }
                D.11858 = __result;
              }
              iftmp.49 = -D.11858;
              goto <D.13001>;
              <D.12965>:
              iftmp.49 = __builtin_strcmp (procname, "mono");
              <D.13001>:
              D.11859 = iftmp.49;
            }
            if (D.11859 == 0) goto <D.13002>; else goto <D.13003>;
            <D.13002>:
            process_handlep.48 = process_handlep;
            process_set_name (process_handlep.48);
            goto <D.13004>;
            <D.13003>:
            <D.13004>:
            return;
            <D.12962>:
            current_process.47 = current_process;
            _wapi_handle_unref (current_process.47);
            <D.12958>:
          }
        finally
          {
            process_handlep = {CLOBBER};
          }
      }
      <D.12952>:
      process_handle.id = pid;
      process_set_defaults (&process_handle);
      process_set_name (&process_handle);
      current_process.50 = _wapi_handle_new (9, &process_handle);
      current_process = current_process.50;
      current_process.47 = current_process;
      if (current_process.47 == -1B) goto <D.13006>; else goto <D.13007>;
      <D.13006>:
      monoeg_g_log (0B, 16, "%s: error creating process handle", &__func__);
      return;
      <D.13007>:
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


atoi (const char * __nptr)
{
  int D.13013;
  long int D.13014;

  D.13014 = strtol (__nptr, 0B, 10);
  D.13013 = (int) D.13014;
  return D.13013;
}


process_set_name (struct _WapiHandle_process * process_handle)
{
  gchar[256] * D.13020;
  const gchar * D.13021;
  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.13016>; else goto <D.13017>;
  <D.13016>:
  slash = strrchr (utf8_progname, 47);
  if (slash != 0B) goto <D.13018>; else goto <D.13019>;
  <D.13018>:
  D.13020 = &process_handle->proc_name;
  D.13021 = slash + 1;
  monoeg_g_strlcpy (D.13020, D.13021, 255);
  goto <D.13022>;
  <D.13019>:
  D.13020 = &process_handle->proc_name;
  monoeg_g_strlcpy (D.13020, utf8_progname, 255);
  <D.13022>:
  monoeg_g_free (utf8_progname);
  <D.13017>:
}


GetCurrentProcess ()
{
  void * D.13023;

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


GetProcessId (void * handle)
{
  long int handle.51;
  signed int D.13026;
  guint32 D.13029;
  unsigned int D.13030;
  struct _WapiHandle_process * process_handle.52;
  int D.13034;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.51 = (long int) handle;
      D.13026 = (signed int) handle.51;
      if (D.13026 < 0) goto <D.13027>; else goto <D.13028>;
      <D.13027>:
      handle.51 = (long int) handle;
      D.13030 = (unsigned int) handle.51;
      D.13029 = D.13030 & 2147483647;
      return D.13029;
      <D.13028>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.13031>; else goto <D.13032>;
      <D.13031>:
      SetLastError (6);
      D.13029 = 0;
      return D.13029;
      <D.13032>:
      process_handle.52 = process_handle;
      D.13034 = process_handle.52->id;
      D.13029 = (guint32) D.13034;
      return D.13029;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetCurrentProcessId ()
{
  guint32 D.13037;
  void * current_process.53;

  mono_once (&process_current_once, process_set_current);
  current_process.53 = current_process;
  D.13037 = GetProcessId (current_process.53);
  return D.13037;
}


EnumProcesses (guint32 * pids, guint32 len, guint32 * needed)
{
  gboolean D.13042;
  const short unsigned int * * D.13043;
  const short unsigned int * D.13044;
  char D.13045;
  long unsigned int D.13046;
  long unsigned int D.13047;
  const short unsigned int * D.13048;
  short unsigned int D.13049;
  int D.13050;
  int D.13051;
  char[256] * D.13054;
  long int D.13055;
  char * endptr.54;
  char D.13057;
  unsigned int i.55;
  long unsigned int D.13061;
  long unsigned int D.13062;
  guint32 * D.13063;
  unsigned int pid.56;
  unsigned int D.13066;
  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.13040>; else goto <D.13041>;
  <D.13040>:
  D.13042 = 0;
  return D.13042;
  <D.13041>:
  i = 0;
  fit = len / 4;
  goto <D.11890>;
  <D.11891>:
  {
    pid_t pid;
    char * endptr;

    try
      {
        D.13043 = __ctype_b_loc ();
        D.13044 = *D.13043;
        D.13045 = entry->d_name[0];
        D.13046 = (long unsigned int) D.13045;
        D.13047 = D.13046 * 2;
        D.13048 = D.13044 + D.13047;
        D.13049 = *D.13048;
        D.13050 = (int) D.13049;
        D.13051 = D.13050 & 2048;
        if (D.13051 == 0) goto <D.13052>; else goto <D.13053>;
        <D.13052>:
        // predicted unlikely by continue predictor.
        goto <D.11890>;
        <D.13053>:
        D.13054 = &entry->d_name;
        D.13055 = strtol (D.13054, &endptr, 10);
        pid = (pid_t) D.13055;
        endptr.54 = endptr;
        D.13057 = *endptr.54;
        if (D.13057 == 0) goto <D.13058>; else goto <D.13059>;
        <D.13058>:
        i.55 = i;
        i = i.55 + 1;
        D.13061 = (long unsigned int) i.55;
        D.13062 = D.13061 * 4;
        D.13063 = pids + D.13062;
        pid.56 = (unsigned int) pid;
        *D.13063 = pid.56;
        <D.13059>:
      }
    finally
      {
        endptr = {CLOBBER};
      }
  }
  <D.11890>:
  if (i < fit) goto <D.13065>; else goto <D.11892>;
  <D.13065>:
  entry = readdir (dir);
  if (entry != 0B) goto <D.11891>; else goto <D.11892>;
  <D.11892>:
  closedir (dir);
  D.13066 = i * 4;
  *needed = D.13066;
  D.13042 = 1;
  return D.13042;
}


CloseProcess (void * handle)
{
  long int handle.57;
  signed int D.13071;
  gboolean D.13074;

  handle.57 = (long int) handle;
  D.13071 = (signed int) handle.57;
  if (D.13071 < 0) goto <D.13072>; else goto <D.13073>;
  <D.13072>:
  D.13074 = 1;
  return D.13074;
  <D.13073>:
  D.13074 = CloseHandle (handle);
  return D.13074;
}


OpenProcess (guint32 req_access, gboolean inherit, guint32 pid)
{
  long unsigned int D.13076;
  void * D.13077;
  int pid.58;
  int D.13081;
  void * D.13084;
  unsigned int D.13085;
  long int D.13086;
  void * handle;

  handle = 0B;
  mono_once (&process_current_once, process_set_current);
  D.13076 = (long unsigned int) pid;
  D.13077 = (void *) D.13076;
  handle = _wapi_search_handle (9, process_open_compare, D.13077, 0B, 1);
  if (handle == 0B) goto <D.13078>; else goto <D.13079>;
  <D.13078>:
  pid.58 = (int) pid;
  D.13081 = is_pid_valid (pid.58);
  if (D.13081 != 0) goto <D.13082>; else goto <D.13083>;
  <D.13082>:
  D.13085 = pid + 2147483648;
  D.13086 = (long int) D.13085;
  D.13084 = (void *) D.13086;
  return D.13084;
  <D.13083>:
  SetLastError (127);
  D.13084 = 0B;
  return D.13084;
  <D.13079>:
  D.13084 = handle;
  return D.13084;
}


process_open_compare (void * handle, void * user_data)
{
  gboolean D.13090;
  long int user_data.59;
  int D.13094;
  pid_t wanted_pid;
  pid_t checking_pid;

  checking_pid = signal_process_if_gone (handle);
  if (checking_pid == 0) goto <D.13088>; else goto <D.13089>;
  <D.13088>:
  D.13090 = 0;
  return D.13090;
  <D.13089>:
  user_data.59 = (long int) user_data;
  wanted_pid = (pid_t) user_data.59;
  if (checking_pid == wanted_pid) goto <D.13093>; else goto <D.13092>;
  <D.13093>:
  D.13094 = _wapi_handle_issignalled (handle);
  if (D.13094 == 0) goto <D.13095>; else goto <D.13092>;
  <D.13095>:
  D.13090 = 1;
  return D.13090;
  <D.13092>:
  D.13090 = 0;
  return D.13090;
}


signal_process_if_gone (void * handle)
{
  long int handle.60;
  signed int D.13098;
  _Bool D.13099;
  long int D.13100;
  long int D.13101;
  pid_t D.13106;
  struct _WapiHandle_process * process_handle.61;
  int D.13110;
  int D.13111;
  int * D.13114;
  int D.13115;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      handle.60 = (long int) handle;
      D.13098 = (signed int) handle.60;
      D.13099 = D.13098 < 0;
      D.13100 = (long int) D.13099;
      D.13101 = __builtin_expect (D.13100, 0);
      if (D.13101 != 0) goto <D.13102>; else goto <D.13103>;
      <D.13102>:
      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.13103>:
      ok = _wapi_lookup_handle (handle, 9, &process_handle);
      if (ok == 0) goto <D.13104>; else goto <D.13105>;
      <D.13104>:
      D.13106 = 0;
      return D.13106;
      <D.13105>:
      process_handle.61 = process_handle;
      D.13110 = process_handle.61->id;
      D.13111 = kill (D.13110, 0);
      if (D.13111 == -1) goto <D.13112>; else goto <D.13113>;
      <D.13112>:
      D.13114 = __errno_location ();
      D.13115 = *D.13114;
      if (D.13115 == 3) goto <D.13107>; else goto <D.13116>;
      <D.13116>:
      D.13114 = __errno_location ();
      D.13115 = *D.13114;
      if (D.13115 == 1) goto <D.13107>; else goto <D.13108>;
      <D.13107>:
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.13108>:
      <D.13113>:
      process_handle.61 = process_handle;
      D.13106 = process_handle.61->id;
      return D.13106;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


_wapi_handle_issignalled (void * handle)
{
  long int handle.62;
  gboolean D.13122;
  <unnamed type> D.13125;
  <unnamed type> D.13127;
  <unnamed type> D.13129;
  <unnamed type> D.13131;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.63;
  unsigned int D.13133;
  unsigned int D.13134;
  struct _WapiHandleUnshared * D.13135;
  long unsigned int D.13136;
  long unsigned int D.13137;
  long unsigned int D.13138;
  struct _WapiHandleUnshared * D.13139;
  unsigned int D.13140;
  unsigned int D.13141;
  struct _WapiHandleUnshared * D.13142;
  long unsigned int D.13143;
  long unsigned int D.13144;
  long unsigned int D.13145;
  struct _WapiHandleUnshared * D.13146;
  guint32 idx;

  handle.62 = (long int) handle;
  idx = (guint32) handle.62;
  if (idx > 4194303) goto <D.13120>; else goto <D.13121>;
  <D.13120>:
  D.13122 = 0;
  return D.13122;
  <D.13121>:
  D.13125 = _wapi_handle_type (handle);
  if (D.13125 == 9) goto <D.13123>; else goto <D.13126>;
  <D.13126>:
  D.13127 = _wapi_handle_type (handle);
  if (D.13127 == 11) goto <D.13123>; else goto <D.13128>;
  <D.13128>:
  D.13129 = _wapi_handle_type (handle);
  if (D.13129 == 12) goto <D.13123>; else goto <D.13130>;
  <D.13130>:
  D.13131 = _wapi_handle_type (handle);
  if (D.13131 == 13) goto <D.13123>; else goto <D.13124>;
  <D.13123>:
  _wapi_shared_layout.63 = _wapi_shared_layout;
  handle.62 = (long int) handle;
  D.13133 = (unsigned int) handle.62;
  D.13134 = D.13133 / 256;
  D.13135 = _wapi_private_handles[D.13134];
  handle.62 = (long int) handle;
  D.13133 = (unsigned int) handle.62;
  D.13136 = (long unsigned int) D.13133;
  D.13137 = D.13136 & 255;
  D.13138 = D.13137 * 200;
  D.13139 = D.13135 + D.13138;
  D.13140 = D.13139->u.shared.offset;
  D.13122 = _wapi_shared_layout.63->handles[D.13140].signalled;
  return D.13122;
  <D.13124>:
  D.13141 = idx / 256;
  D.13142 = _wapi_private_handles[D.13141];
  D.13143 = (long unsigned int) idx;
  D.13144 = D.13143 & 255;
  D.13145 = D.13144 * 200;
  D.13146 = D.13142 + D.13145;
  D.13122 = D.13146->signalled;
  return D.13122;
}


GetExitCodeProcess (void * process, guint32 * code)
{
  gboolean D.13150;
  long int process.64;
  unsigned int D.13152;
  signed int D.13153;
  int pid.65;
  int D.13157;
  int D.13162;
  struct _WapiHandle_process * process_handle.66;
  unsigned int D.13166;
  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.13148>; else goto <D.13149>;
      <D.13148>:
      D.13150 = 0;
      return D.13150;
      <D.13149>:
      process.64 = (long int) process;
      D.13152 = (unsigned int) process.64;
      pid = D.13152 + 2147483648;
      process.64 = (long int) process;
      D.13153 = (signed int) process.64;
      if (D.13153 < 0) goto <D.13154>; else goto <D.13155>;
      <D.13154>:
      pid.65 = (int) pid;
      D.13157 = is_pid_valid (pid.65);
      if (D.13157 != 0) goto <D.13158>; else goto <D.13159>;
      <D.13158>:
      *code = 259;
      D.13150 = 1;
      return D.13150;
      <D.13159>:
      D.13150 = 0;
      return D.13150;
      <D.13155>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13160>; else goto <D.13161>;
      <D.13160>:
      D.13150 = 0;
      return D.13150;
      <D.13161>:
      process_wait (process, 0, 1);
      D.13162 = _wapi_handle_issignalled (process);
      if (D.13162 == 1) goto <D.13163>; else goto <D.13164>;
      <D.13163>:
      process_handle.66 = process_handle;
      D.13166 = process_handle.66->exitstatus;
      *code = D.13166;
      goto <D.13167>;
      <D.13164>:
      *code = 259;
      <D.13167>:
      D.13150 = 1;
      return D.13150;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetProcessTimes (void * process, struct WapiFileTime * create_time, struct WapiFileTime * exit_time, struct WapiFileTime * kernel_time, struct WapiFileTime * user_time)
{
  gboolean D.13175;
  long int process.67;
  signed int D.13177;
  struct _WapiHandle_process * process_handle.68;
  int D.13183;
  int D.13186;
  int D.13187;
  int D.13190;
  long int D.13193;
  long int D.13194;
  long int D.13195;
  long int D.13196;
  long int D.13197;
  long int D.13198;
  long int D.13199;
  long int D.13200;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  gboolean ku_times_set;

  try
    {
      ku_times_set = 0;
      mono_once (&process_current_once, process_set_current);
      if (create_time == 0B) goto <D.13170>; else goto <D.13172>;
      <D.13172>:
      if (exit_time == 0B) goto <D.13170>; else goto <D.13173>;
      <D.13173>:
      if (kernel_time == 0B) goto <D.13170>; else goto <D.13174>;
      <D.13174>:
      if (user_time == 0B) goto <D.13170>; else goto <D.13171>;
      <D.13170>:
      D.13175 = 0;
      return D.13175;
      <D.13171>:
      process.67 = (long int) process;
      D.13177 = (signed int) process.67;
      if (D.13177 < 0) goto <D.13178>; else goto <D.13179>;
      <D.13178>:
      D.13175 = 0;
      return D.13175;
      <D.13179>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13180>; else goto <D.13181>;
      <D.13180>:
      D.13175 = 0;
      return D.13175;
      <D.13181>:
      process_handle.68 = process_handle;
      *create_time = process_handle.68->create_time;
      D.13183 = _wapi_handle_issignalled (process);
      if (D.13183 == 1) goto <D.13184>; else goto <D.13185>;
      <D.13184>:
      process_handle.68 = process_handle;
      *exit_time = process_handle.68->exit_time;
      <D.13185>:
      process_handle.68 = process_handle;
      D.13186 = process_handle.68->id;
      D.13187 = getpid ();
      if (D.13186 == D.13187) goto <D.13188>; else goto <D.13189>;
      <D.13188>:
      {
        struct rusage time_data;

        try
          {
            D.13190 = getrusage (0, &time_data);
            if (D.13190 == 0) goto <D.13191>; else goto <D.13192>;
            <D.13191>:
            {
              gint64 tick_val;
              gint64 * tick_val_ptr;

              ku_times_set = 1;
              D.13193 = time_data.ru_utime.tv_sec;
              D.13194 = D.13193 * 10000000;
              D.13195 = time_data.ru_utime.tv_usec;
              D.13196 = D.13195 * 10;
              tick_val = D.13194 + D.13196;
              tick_val_ptr = user_time;
              *tick_val_ptr = tick_val;
              D.13197 = time_data.ru_stime.tv_sec;
              D.13198 = D.13197 * 10000000;
              D.13199 = time_data.ru_stime.tv_usec;
              D.13200 = D.13199 * 10;
              tick_val = D.13198 + D.13200;
              tick_val_ptr = kernel_time;
              *tick_val_ptr = tick_val;
            }
            <D.13192>:
          }
        finally
          {
            time_data = {CLOBBER};
          }
      }
      <D.13189>:
      if (ku_times_set == 0) goto <D.13201>; else goto <D.13202>;
      <D.13201>:
      memset (kernel_time, 0, 8);
      memset (user_time, 0, 8);
      <D.13202>:
      D.13175 = 1;
      return D.13175;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.13207;
  int D.13212;
  void * D.13214;
  long unsigned int D.13215;

  D.13207 = __builtin_constant_p (__len);
  if (D.13207 != 0) goto <D.13208>; else goto <D.13209>;
  <D.13208>:
  if (__len == 0) goto <D.13210>; else goto <D.13211>;
  <D.13210>:
  D.13212 = __builtin_constant_p (__ch);
  if (D.13212 == 0) goto <D.13205>; else goto <D.13213>;
  <D.13213>:
  if (__ch != 0) goto <D.13205>; else goto <D.13206>;
  <D.13205>:
  __warn_memset_zero_len ();
  D.13214 = __dest;
  return D.13214;
  <D.13206>:
  <D.13211>:
  <D.13209>:
  D.13215 = __builtin_object_size (__dest, 0);
  D.13214 = __builtin___memset_chk (__dest, __ch, __len, D.13215);
  return D.13214;
}


EnumProcessModules (void * process, void * * modules, guint32 size, guint32 * needed)
{
  gboolean D.13219;
  long int process.69;
  signed int D.13221;
  int D.13224;
  struct _WapiHandle_process * process_handle.70;
  unsigned int D.13232;
  unsigned int D.13233;
  unsigned int i.71;
  void * D.13235;
  long unsigned int D.13238;
  long unsigned int D.13239;
  void * * D.13240;
  void * D.13241;
  gchar * D.13243;
  int D.13244;
  sizetype D.13248;
  sizetype D.13249;
  sizetype D.13250;
  void * * D.13251;
  unsigned int i.72;
  unsigned int D.13253;
  void * D.13255;
  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.13217>; else goto <D.13218>;
      <D.13217>:
      D.13219 = 0;
      return D.13219;
      <D.13218>:
      process.69 = (long int) process;
      D.13221 = (signed int) process.69;
      if (D.13221 < 0) goto <D.13222>; else goto <D.13223>;
      <D.13222>:
      process.69 = (long int) process;
      D.13224 = (int) process.69;
      pid = D.13224 & 2147483647;
      goto <D.13225>;
      <D.13223>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13226>; else goto <D.13227>;
      <D.13226>:
      D.13219 = 0;
      return D.13219;
      <D.13227>:
      process_handle.70 = process_handle;
      pid = process_handle.70->id;
      process_handle.70 = process_handle;
      proc_name = &process_handle.70->proc_name;
      <D.13225>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.13229>; else goto <D.13230>;
      <D.13229>:
      *modules = 0B;
      *needed = 8;
      goto <D.13231>;
      <D.13230>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      D.13232 = count + 1;
      D.13233 = D.13232 * 8;
      *needed = D.13233;
      *modules = 0B;
      i = 0;
      goto <D.12066>;
      <D.12065>:
      i.71 = (unsigned int) i;
      module = monoeg_g_slist_nth_data (mods, i.71);
      D.13235 = *modules;
      if (D.13235 != 0B) goto <D.13236>; else goto <D.13237>;
      <D.13236>:
      D.13238 = (long unsigned int) i;
      D.13239 = D.13238 * 8;
      D.13240 = modules + D.13239;
      D.13241 = module->address_start;
      *D.13240 = D.13241;
      goto <D.13242>;
      <D.13237>:
      D.13243 = module->filename;
      D.13244 = match_procname_to_modulename (proc_name, D.13243);
      if (D.13244 != 0) goto <D.13245>; else goto <D.13246>;
      <D.13245>:
      D.13241 = module->address_start;
      *modules = D.13241;
      goto <D.13247>;
      <D.13246>:
      D.13248 = (sizetype) i;
      D.13249 = D.13248 + 1;
      D.13250 = D.13249 * 8;
      D.13251 = modules + D.13250;
      D.13241 = module->address_start;
      *D.13251 = D.13241;
      <D.13247>:
      <D.13242>:
      i = i + 1;
      <D.12066>:
      i.72 = (unsigned int) i;
      D.13253 = avail + 4294967295;
      if (i.72 < D.13253) goto <D.13254>; else goto <D.12067>;
      <D.13254>:
      i.72 = (unsigned int) i;
      if (i.72 < count) goto <D.12065>; else goto <D.12067>;
      <D.12067>:
      i = 0;
      goto <D.12069>;
      <D.12068>:
      i.71 = (unsigned int) i;
      D.13255 = monoeg_g_slist_nth_data (mods, i.71);
      free_procmodule (D.13255);
      i = i + 1;
      <D.12069>:
      i.72 = (unsigned int) i;
      if (i.72 < count) goto <D.12068>; else goto <D.12070>;
      <D.12070>:
      monoeg_g_slist_free (mods);
      <D.13231>:
      D.13219 = 1;
      return D.13219;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


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

  try
    {
      fp = 0B;
      proc_path = *.LC2;
      i = 0;
      goto <D.12047>;
      <D.12046>:
      D.13261 = proc_path[i];
      filename = monoeg_g_strdup_printf (D.13261, pid);
      fp = fopen (filename, mode);
      monoeg_g_free (filename);
      i = i + 1;
      <D.12047>:
      if (fp == 0B) goto <D.13262>; else goto <D.12048>;
      <D.13262>:
      D.13261 = proc_path[i];
      if (D.13261 != 0B) goto <D.12046>; else goto <D.12048>;
      <D.12048>:
      D.13263 = fp;
      return D.13263;
    }
  finally
    {
      proc_path = {CLOBBER};
    }
}


load_modules (struct FILE * fp)
{
  const short unsigned int * * D.13266;
  const short unsigned int * D.13267;
  char D.13268;
  long unsigned int D.13269;
  long unsigned int D.13270;
  const short unsigned int * D.13271;
  short unsigned int D.13272;
  int D.13273;
  int D.13274;
  char D.13275;
  long unsigned int D.13276;
  long unsigned int D.13277;
  const short unsigned int * D.13278;
  short unsigned int D.13279;
  int D.13280;
  int D.13281;
  long unsigned int D.13284;
  char D.13287;
  long unsigned int D.13288;
  long unsigned int D.13289;
  const short unsigned int * D.13290;
  short unsigned int D.13291;
  int D.13292;
  int D.13293;
  long unsigned int D.13296;
  char D.13299;
  char D.13304;
  long unsigned int D.13305;
  long unsigned int D.13306;
  const short unsigned int * D.13307;
  short unsigned int D.13308;
  int D.13309;
  int D.13310;
  long unsigned int D.13313;
  char D.13316;
  long unsigned int D.13317;
  long unsigned int D.13318;
  const short unsigned int * D.13319;
  short unsigned int D.13320;
  int D.13321;
  int D.13322;
  long unsigned int D.13325;
  char D.13328;
  long unsigned int D.13329;
  long unsigned int D.13330;
  const short unsigned int * D.13331;
  short unsigned int D.13332;
  int D.13333;
  int D.13334;
  long unsigned int D.13337;
  char D.13340;
  long unsigned int D.13341;
  long unsigned int D.13342;
  const short unsigned int * D.13343;
  short unsigned int D.13344;
  int D.13345;
  int D.13346;
  long int D.13349;
  gchar * D.13356;
  gchar * D.13357;
  gchar * D.13358;
  gchar * D.13359;
  struct GSList * D.13360;
  char * D.13364;
  struct GSList * D.13365;
  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.11972>;
      <D.11991>:
      p = &buf;
      goto <D.11970>;
      <D.11969>:
      p = p + 1;
      <D.11970>:
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 != 0) goto <D.11969>; else goto <D.11971>;
      <D.11971>:
      start_start = p;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13275 = *start_start;
      D.13276 = (long unsigned int) D.13275;
      D.13277 = D.13276 * 2;
      D.13278 = D.13267 + D.13277;
      D.13279 = *D.13278;
      D.13280 = (int) D.13279;
      D.13281 = D.13280 & 4096;
      if (D.13281 == 0) goto <D.13282>; else goto <D.13283>;
      <D.13282>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13283>:
      D.13284 = strtoul (start_start, &endp, 16);
      address_start = (void *) D.13284;
      p = endp;
      D.13268 = *p;
      if (D.13268 != 45) goto <D.13285>; else goto <D.13286>;
      <D.13285>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13286>:
      p = p + 1;
      end_start = p;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13287 = *end_start;
      D.13288 = (long unsigned int) D.13287;
      D.13289 = D.13288 * 2;
      D.13290 = D.13267 + D.13289;
      D.13291 = *D.13290;
      D.13292 = (int) D.13291;
      D.13293 = D.13292 & 4096;
      if (D.13293 == 0) goto <D.13294>; else goto <D.13295>;
      <D.13294>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13295>:
      D.13296 = strtoul (end_start, &endp, 16);
      address_end = (void *) D.13296;
      p = endp;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 == 0) goto <D.13297>; else goto <D.13298>;
      <D.13297>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13298>:
      goto <D.11974>;
      <D.11973>:
      p = p + 1;
      <D.11974>:
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 != 0) goto <D.11973>; else goto <D.11975>;
      <D.11975>:
      prot_start = p;
      D.13299 = *prot_start;
      if (D.13299 != 114) goto <D.13300>; else goto <D.13301>;
      <D.13300>:
      D.13299 = *prot_start;
      if (D.13299 != 45) goto <D.13302>; else goto <D.13303>;
      <D.13302>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13303>:
      <D.13301>:
      memcpy (&prot_buf, prot_start, 4);
      prot_buf[4] = 0;
      goto <D.11977>;
      <D.11976>:
      p = p + 1;
      <D.11977>:
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 == 0) goto <D.11976>; else goto <D.11978>;
      <D.11978>:
      goto <D.11980>;
      <D.11979>:
      p = p + 1;
      <D.11980>:
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 != 0) goto <D.11979>; else goto <D.11981>;
      <D.11981>:
      offset_start = p;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13304 = *offset_start;
      D.13305 = (long unsigned int) D.13304;
      D.13306 = D.13305 * 2;
      D.13307 = D.13267 + D.13306;
      D.13308 = *D.13307;
      D.13309 = (int) D.13308;
      D.13310 = D.13309 & 4096;
      if (D.13310 == 0) goto <D.13311>; else goto <D.13312>;
      <D.13311>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13312>:
      D.13313 = strtoul (offset_start, &endp, 16);
      address_offset = (void *) D.13313;
      p = endp;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 == 0) goto <D.13314>; else goto <D.13315>;
      <D.13314>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13315>:
      goto <D.11983>;
      <D.11982>:
      p = p + 1;
      <D.11983>:
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 != 0) goto <D.11982>; else goto <D.11984>;
      <D.11984>:
      maj_dev_start = p;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13316 = *maj_dev_start;
      D.13317 = (long unsigned int) D.13316;
      D.13318 = D.13317 * 2;
      D.13319 = D.13267 + D.13318;
      D.13320 = *D.13319;
      D.13321 = (int) D.13320;
      D.13322 = D.13321 & 4096;
      if (D.13322 == 0) goto <D.13323>; else goto <D.13324>;
      <D.13323>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13324>:
      D.13325 = strtoul (maj_dev_start, &endp, 16);
      maj_dev = (guint32) D.13325;
      p = endp;
      D.13268 = *p;
      if (D.13268 != 58) goto <D.13326>; else goto <D.13327>;
      <D.13326>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13327>:
      p = p + 1;
      min_dev_start = p;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13328 = *min_dev_start;
      D.13329 = (long unsigned int) D.13328;
      D.13330 = D.13329 * 2;
      D.13331 = D.13267 + D.13330;
      D.13332 = *D.13331;
      D.13333 = (int) D.13332;
      D.13334 = D.13333 & 4096;
      if (D.13334 == 0) goto <D.13335>; else goto <D.13336>;
      <D.13335>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13336>:
      D.13337 = strtoul (min_dev_start, &endp, 16);
      min_dev = (guint32) D.13337;
      p = endp;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 == 0) goto <D.13338>; else goto <D.13339>;
      <D.13338>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13339>:
      goto <D.11986>;
      <D.11985>:
      p = p + 1;
      <D.11986>:
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 != 0) goto <D.11985>; else goto <D.11987>;
      <D.11987>:
      inode_start = p;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13340 = *inode_start;
      D.13341 = (long unsigned int) D.13340;
      D.13342 = D.13341 * 2;
      D.13343 = D.13267 + D.13342;
      D.13344 = *D.13343;
      D.13345 = (int) D.13344;
      D.13346 = D.13345 & 4096;
      if (D.13346 == 0) goto <D.13347>; else goto <D.13348>;
      <D.13347>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13348>:
      D.13349 = strtol (inode_start, &endp, 10);
      inode = (ino_t) D.13349;
      p = endp;
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 == 0) goto <D.13350>; else goto <D.13351>;
      <D.13350>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13351>:
      device = gnu_dev_makedev (maj_dev, min_dev);
      if (device == 0) goto <D.13352>; else goto <D.13353>;
      <D.13352>:
      if (inode == 0) goto <D.13354>; else goto <D.13355>;
      <D.13354>:
      // predicted unlikely by continue predictor.
      goto <D.11972>;
      <D.13355>:
      <D.13353>:
      goto <D.11989>;
      <D.11988>:
      p = p + 1;
      <D.11989>:
      D.13266 = __ctype_b_loc ();
      D.13267 = *D.13266;
      D.13268 = *p;
      D.13269 = (long unsigned int) D.13268;
      D.13270 = D.13269 * 2;
      D.13271 = D.13267 + D.13270;
      D.13272 = *D.13271;
      D.13273 = (int) D.13272;
      D.13274 = D.13273 & 8192;
      if (D.13274 != 0) goto <D.11988>; else goto <D.11990>;
      <D.11990>:
      mod = monoeg_malloc0 (56);
      mod->address_start = address_start;
      mod->address_end = address_end;
      D.13356 = monoeg_strdup (&prot_buf);
      mod->perms = D.13356;
      mod->address_offset = address_offset;
      mod->device = device;
      mod->inode = inode;
      D.13357 = monoeg_g_strchomp (p);
      D.13358 = monoeg_g_strchug (D.13357);
      D.13359 = monoeg_strdup (D.13358);
      mod->filename = D.13359;
      D.13360 = monoeg_g_slist_find_custom (ret, mod, find_procmodule);
      if (D.13360 == 0B) goto <D.13361>; else goto <D.13362>;
      <D.13361>:
      ret = monoeg_g_slist_prepend (ret, mod);
      goto <D.13363>;
      <D.13362>:
      free_procmodule (mod);
      <D.13363>:
      <D.11972>:
      D.13364 = fgets (&buf, 4097, fp);
      if (D.13364 != 0B) goto <D.11991>; else goto <D.11992>;
      <D.11992>:
      ret = monoeg_g_slist_reverse (ret);
      D.13365 = ret;
      return D.13365;
    }
  finally
    {
      buf = {CLOBBER};
      endp = {CLOBBER};
      prot_buf = {CLOBBER};
    }
}


find_procmodule (const void * a, const void * b)
{
  long unsigned int D.13369;
  long unsigned int D.13370;
  long unsigned int D.13372;
  long unsigned int D.13373;
  gint D.13375;
  struct WapiProcModule * want;
  struct WapiProcModule * compare;

  want = a;
  compare = b;
  D.13369 = want->device;
  D.13370 = compare->device;
  if (D.13369 == D.13370) goto <D.13371>; else goto <D.13368>;
  <D.13371>:
  D.13372 = want->inode;
  D.13373 = compare->inode;
  if (D.13372 == D.13373) goto <D.13374>; else goto <D.13368>;
  <D.13374>:
  D.13375 = 0;
  return D.13375;
  <D.13368>:
  D.13375 = 1;
  return D.13375;
}


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

  D.13378 = __builtin_object_size (__dest, 0);
  D.13377 = __builtin___memcpy_chk (__dest, __src, __len, D.13378);
  return D.13377;
}


gnu_dev_makedev (unsigned int __major, unsigned int __minor)
{
  long long unsigned int D.13380;
  unsigned int D.13381;
  unsigned int D.13382;
  unsigned int D.13383;
  unsigned int D.13384;
  long long unsigned int D.13385;
  long long unsigned int D.13386;
  long long unsigned int D.13387;
  long long unsigned int D.13388;
  long long unsigned int D.13389;
  long long unsigned int D.13390;
  long long unsigned int D.13391;
  long long unsigned int D.13392;

  D.13381 = __minor & 255;
  D.13382 = __major & 4095;
  D.13383 = D.13382 << 8;
  D.13384 = D.13381 | D.13383;
  D.13385 = (long long unsigned int) D.13384;
  D.13386 = (long long unsigned int) __minor;
  D.13387 = D.13386 & 4294967040;
  D.13388 = D.13387 << 12;
  D.13389 = D.13385 | D.13388;
  D.13390 = (long long unsigned int) __major;
  D.13391 = D.13390 & 4294963200;
  D.13392 = D.13391 << 32;
  D.13380 = D.13389 | D.13392;
  return D.13380;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  long unsigned int D.13394;
  int D.13399;
  char * D.13401;
  long unsigned int D.13402;
  long unsigned int D.13403;
  long unsigned int D.13404;
  long unsigned int D.13407;

  D.13394 = __builtin_object_size (__s, 1);
  if (D.13394 != 18446744073709551615) goto <D.13395>; else goto <D.13396>;
  <D.13395>:
  D.13399 = __builtin_constant_p (__n);
  if (D.13399 == 0) goto <D.13397>; else goto <D.13400>;
  <D.13400>:
  if (__n <= 0) goto <D.13397>; else goto <D.13398>;
  <D.13397>:
  D.13402 = __builtin_object_size (__s, 1);
  D.13401 = __fgets_chk (__s, D.13402, __n, __stream);
  return D.13401;
  <D.13398>:
  D.13403 = (long unsigned int) __n;
  D.13404 = __builtin_object_size (__s, 1);
  if (D.13403 > D.13404) goto <D.13405>; else goto <D.13406>;
  <D.13405>:
  D.13407 = __builtin_object_size (__s, 1);
  D.13401 = __fgets_chk_warn (__s, D.13407, __n, __stream);
  return D.13401;
  <D.13406>:
  <D.13396>:
  D.13401 = __fgets_alias (__s, __n, __stream);
  return D.13401;
}


match_procname_to_modulename (gchar * procname, gchar * modulename)
{
  gboolean D.13412;
  int D.12010;
  int D.12019;
  const char * D.13419;
  int D.12028;
  const char * D.13428;
  int D.12037;
  char * lastsep;
  char * lastsep2;
  char * pname;
  char * mname;
  gboolean result;

  lastsep = 0B;
  lastsep2 = 0B;
  pname = 0B;
  mname = 0B;
  result = 0;
  if (procname == 0B) goto <D.13409>; else goto <D.13411>;
  <D.13411>:
  if (modulename == 0B) goto <D.13409>; else goto <D.13410>;
  <D.13409>:
  D.13412 = 0;
  return D.13412;
  <D.13410>:
  pname = mono_path_resolve_symlinks (procname);
  mname = mono_path_resolve_symlinks (modulename);
  {
    size_t __s1_len;
    size_t __s2_len;

    D.12010 = __builtin_strcmp (pname, mname);
  }
  if (D.12010 == 0) goto <D.13413>; else goto <D.13414>;
  <D.13413>:
  result = 1;
  <D.13414>:
  if (result == 0) goto <D.13415>; else goto <D.13416>;
  <D.13415>:
  lastsep = strrchr (mname, 47);
  if (lastsep != 0B) goto <D.13417>; else goto <D.13418>;
  <D.13417>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.13419 = lastsep + 1;
    D.12019 = __builtin_strcmp (D.13419, pname);
  }
  if (D.12019 == 0) goto <D.13420>; else goto <D.13421>;
  <D.13420>:
  result = 1;
  <D.13421>:
  <D.13418>:
  if (result == 0) goto <D.13422>; else goto <D.13423>;
  <D.13422>:
  lastsep2 = strrchr (pname, 47);
  if (lastsep2 != 0B) goto <D.13424>; else goto <D.13425>;
  <D.13424>:
  if (lastsep != 0B) goto <D.13426>; else goto <D.13427>;
  <D.13426>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.13419 = lastsep + 1;
    D.13428 = lastsep2 + 1;
    D.12028 = __builtin_strcmp (D.13419, D.13428);
  }
  if (D.12028 == 0) goto <D.13429>; else goto <D.13430>;
  <D.13429>:
  result = 1;
  <D.13430>:
  goto <D.13431>;
  <D.13427>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.13428 = lastsep2 + 1;
    D.12037 = __builtin_strcmp (mname, D.13428);
  }
  if (D.12037 == 0) goto <D.13432>; else goto <D.13433>;
  <D.13432>:
  result = 1;
  <D.13433>:
  <D.13431>:
  <D.13425>:
  <D.13423>:
  <D.13416>:
  monoeg_g_free (pname);
  monoeg_g_free (mname);
  D.13412 = result;
  return D.13412;
}


free_procmodule (struct WapiProcModule * mod)
{
  gchar * D.13435;
  gchar * D.13438;

  D.13435 = mod->perms;
  if (D.13435 != 0B) goto <D.13436>; else goto <D.13437>;
  <D.13436>:
  D.13435 = mod->perms;
  monoeg_g_free (D.13435);
  <D.13437>:
  D.13438 = mod->filename;
  if (D.13438 != 0B) goto <D.13439>; else goto <D.13440>;
  <D.13439>:
  D.13438 = mod->filename;
  monoeg_g_free (D.13438);
  <D.13440>:
  monoeg_g_free (mod);
}


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

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


get_module_name (void * process, void * module, gunichar2 * basename, guint32 size, gboolean base)
{
  guint32 D.13446;
  long int process.73;
  signed int D.13448;
  int D.13451;
  struct _WapiHandle_process * process_handle.74;
  gchar[256] * D.13456;
  int * D.13461;
  int D.13462;
  unsigned int i.75;
  gchar * D.13474;
  int D.13475;
  void * D.13477;
  unsigned int i.76;
  long unsigned int bytes.77;
  long unsigned int D.13489;
  long unsigned int bytes.78;
  long unsigned int D.13491;
  long unsigned int D.13494;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  pid_t pid;
  gunichar2 * procname;
  gchar * procname_ext;
  glong len;
  gsize bytes;
  struct FILE * fp;
  struct GSList * mods;
  struct WapiProcModule * found_module;
  guint32 count;
  int i;
  gchar * proc_name;

  try
    {
      procname_ext = 0B;
      mods = 0B;
      proc_name = 0B;
      mono_once (&process_current_once, process_set_current);
      size = size * 2;
      if (basename == 0B) goto <D.13443>; else goto <D.13445>;
      <D.13445>:
      if (size == 0) goto <D.13443>; else goto <D.13444>;
      <D.13443>:
      D.13446 = 0;
      return D.13446;
      <D.13444>:
      process.73 = (long int) process;
      D.13448 = (signed int) process.73;
      if (D.13448 < 0) goto <D.13449>; else goto <D.13450>;
      <D.13449>:
      process.73 = (long int) process;
      D.13451 = (int) process.73;
      pid = D.13451 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.13452>;
      <D.13450>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13453>; else goto <D.13454>;
      <D.13453>:
      D.13446 = 0;
      return D.13446;
      <D.13454>:
      process_handle.74 = process_handle;
      pid = process_handle.74->id;
      process_handle.74 = process_handle;
      D.13456 = &process_handle.74->proc_name;
      proc_name = monoeg_strdup (D.13456);
      <D.13452>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.13457>; else goto <D.13458>;
      <D.13457>:
      D.13461 = __errno_location ();
      D.13462 = *D.13461;
      if (D.13462 == 13) goto <D.13463>; else goto <D.13459>;
      <D.13463>:
      if (module == 0B) goto <D.13464>; else goto <D.13459>;
      <D.13464>:
      if (base == 1) goto <D.13465>; else goto <D.13459>;
      <D.13465>:
      procname_ext = get_process_name_from_proc (pid);
      goto <D.13460>;
      <D.13459>:
      monoeg_g_free (proc_name);
      D.13446 = 0;
      return D.13446;
      <D.13460>:
      goto <D.13466>;
      <D.13458>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.12101>;
      <D.12100>:
      i.75 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.75);
      if (procname_ext == 0B) goto <D.13471>; else goto <D.13472>;
      <D.13471>:
      if (module == 0B) goto <D.13473>; else goto <D.13468>;
      <D.13473>:
      D.13474 = found_module->filename;
      D.13475 = match_procname_to_modulename (proc_name, D.13474);
      if (D.13475 != 0) goto <D.13469>; else goto <D.13468>;
      <D.13468>:
      if (module != 0B) goto <D.13476>; else goto <D.13470>;
      <D.13476>:
      D.13477 = found_module->address_start;
      if (D.13477 == module) goto <D.13469>; else goto <D.13470>;
      <D.13469>:
      if (base != 0) goto <D.13478>; else goto <D.13479>;
      <D.13478>:
      D.13474 = found_module->filename;
      procname_ext = monoeg_g_path_get_basename (D.13474);
      goto <D.13480>;
      <D.13479>:
      D.13474 = found_module->filename;
      procname_ext = monoeg_strdup (D.13474);
      <D.13480>:
      <D.13470>:
      <D.13472>:
      free_procmodule (found_module);
      i = i + 1;
      <D.12101>:
      i.76 = (unsigned int) i;
      if (i.76 < count) goto <D.12100>; else goto <D.12102>;
      <D.12102>:
      if (procname_ext == 0B) goto <D.13482>; else goto <D.13483>;
      <D.13482>:
      procname_ext = get_process_name_from_proc (pid);
      <D.13483>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      <D.13466>:
      if (procname_ext != 0B) goto <D.13484>; else goto <D.13485>;
      <D.13484>:
      procname = mono_unicode_from_external (procname_ext, &bytes);
      if (procname == 0B) goto <D.13486>; else goto <D.13487>;
      <D.13486>:
      monoeg_g_free (procname_ext);
      D.13446 = 0;
      return D.13446;
      <D.13487>:
      bytes.77 = bytes;
      D.13489 = bytes.77 / 2;
      len = (glong) D.13489;
      bytes.77 = bytes;
      bytes.78 = bytes.77 + 2;
      bytes = bytes.78;
      D.13491 = (long unsigned int) size;
      bytes.77 = bytes;
      if (D.13491 < bytes.77) goto <D.13492>; else goto <D.13493>;
      <D.13492>:
      D.13494 = (long unsigned int) size;
      memcpy (basename, procname, D.13494);
      goto <D.13495>;
      <D.13493>:
      bytes.77 = bytes;
      memcpy (basename, procname, bytes.77);
      <D.13495>:
      monoeg_g_free (procname);
      monoeg_g_free (procname_ext);
      D.13446 = (guint32) len;
      return D.13446;
      <D.13485>:
      D.13446 = 0;
      return D.13446;
    }
  finally
    {
      process_handle = {CLOBBER};
      bytes = {CLOBBER};
    }
}


get_process_name_from_proc (pid_t pid)
{
  long int D.13498;
  gchar * D.13503;
  char * D.13506;
  char * D.13513;
  const char * D.13518;
  const gchar * D.13521;
  long int end.79;
  long int start.80;
  long int D.13524;
  long int D.13525;
  long unsigned int D.13526;
  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.13498 = readlink (filename, &buf, 255);
      if (D.13498 > 0) goto <D.13499>; else goto <D.13500>;
      <D.13499>:
      ret = monoeg_strdup (&buf);
      <D.13500>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.13501>; else goto <D.13502>;
      <D.13501>:
      D.13503 = ret;
      return D.13503;
      <D.13502>:
      filename = monoeg_g_strdup_printf ("/proc/%d/cmdline", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.13504>; else goto <D.13505>;
      <D.13504>:
      D.13506 = fgets (&buf, 256, fp);
      if (D.13506 != 0B) goto <D.13507>; else goto <D.13508>;
      <D.13507>:
      ret = monoeg_strdup (&buf);
      <D.13508>:
      fclose (fp);
      <D.13505>:
      monoeg_g_free (filename);
      if (ret != 0B) goto <D.13509>; else goto <D.13510>;
      <D.13509>:
      D.13503 = ret;
      return D.13503;
      <D.13510>:
      filename = monoeg_g_strdup_printf ("/proc/%d/stat", pid);
      fp = fopen (filename, "r");
      if (fp != 0B) goto <D.13511>; else goto <D.13512>;
      <D.13511>:
      D.13513 = fgets (&buf, 256, fp);
      if (D.13513 != 0B) goto <D.13514>; else goto <D.13515>;
      <D.13514>:
      {
        gchar * start;
        gchar * end;

        start = __builtin_strchr (&buf, 40);
        if (start != 0B) goto <D.13516>; else goto <D.13517>;
        <D.13516>:
        D.13518 = start + 1;
        end = __builtin_strchr (D.13518, 41);
        if (end != 0B) goto <D.13519>; else goto <D.13520>;
        <D.13519>:
        D.13521 = start + 1;
        end.79 = (long int) end;
        start.80 = (long int) start;
        D.13524 = end.79 - start.80;
        D.13525 = D.13524 + -1;
        D.13526 = (long unsigned int) D.13525;
        ret = monoeg_g_strndup (D.13521, D.13526);
        <D.13520>:
        <D.13517>:
      }
      <D.13515>:
      fclose (fp);
      <D.13512>:
      monoeg_g_free (filename);
      D.13503 = ret;
      return D.13503;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


readlink (const char * restrict __path, char * restrict __buf, size_t __len)
{
  long unsigned int D.13529;
  int D.13532;
  ssize_t D.13535;
  long unsigned int D.13536;
  long unsigned int D.13537;
  long unsigned int D.13540;

  D.13529 = __builtin_object_size (__buf, 1);
  if (D.13529 != 18446744073709551615) goto <D.13530>; else goto <D.13531>;
  <D.13530>:
  D.13532 = __builtin_constant_p (__len);
  if (D.13532 == 0) goto <D.13533>; else goto <D.13534>;
  <D.13533>:
  D.13536 = __builtin_object_size (__buf, 1);
  D.13535 = __readlink_chk (__path, __buf, __len, D.13536);
  return D.13535;
  <D.13534>:
  D.13537 = __builtin_object_size (__buf, 1);
  if (D.13537 < __len) goto <D.13538>; else goto <D.13539>;
  <D.13538>:
  D.13540 = __builtin_object_size (__buf, 1);
  D.13535 = __readlink_chk_warn (__path, __buf, __len, D.13540);
  return D.13535;
  <D.13539>:
  <D.13531>:
  D.13535 = __readlink_alias (__path, __buf, __len);
  return D.13535;
}


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

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


GetModuleInformation (void * process, void * module, struct WapiModuleInfo * modinfo, guint32 size)
{
  gboolean D.13547;
  long int process.81;
  signed int D.13549;
  int D.13552;
  struct _WapiHandle_process * process_handle.82;
  gchar[256] * D.13557;
  unsigned int i.83;
  gchar * D.13567;
  int D.13568;
  void * D.13570;
  void * D.13571;
  long unsigned int D.13572;
  long unsigned int D.13573;
  long unsigned int D.13574;
  unsigned int D.13575;
  void * D.13576;
  unsigned int i.84;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  pid_t pid;
  struct FILE * fp;
  struct GSList * mods;
  struct WapiProcModule * found_module;
  guint32 count;
  int i;
  gboolean ret;
  gchar * proc_name;

  try
    {
      mods = 0B;
      ret = 0;
      proc_name = 0B;
      mono_once (&process_current_once, process_set_current);
      if (modinfo == 0B) goto <D.13544>; else goto <D.13546>;
      <D.13546>:
      if (size <= 23) goto <D.13544>; else goto <D.13545>;
      <D.13544>:
      D.13547 = 0;
      return D.13547;
      <D.13545>:
      process.81 = (long int) process;
      D.13549 = (signed int) process.81;
      if (D.13549 < 0) goto <D.13550>; else goto <D.13551>;
      <D.13550>:
      process.81 = (long int) process;
      D.13552 = (int) process.81;
      pid = D.13552 & 2147483647;
      proc_name = get_process_name_from_proc (pid);
      goto <D.13553>;
      <D.13551>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13554>; else goto <D.13555>;
      <D.13554>:
      D.13547 = 0;
      return D.13547;
      <D.13555>:
      process_handle.82 = process_handle;
      pid = process_handle.82->id;
      process_handle.82 = process_handle;
      D.13557 = &process_handle.82->proc_name;
      proc_name = monoeg_strdup (D.13557);
      <D.13553>:
      fp = open_process_map (pid, "r");
      if (fp == 0B) goto <D.13558>; else goto <D.13559>;
      <D.13558>:
      monoeg_g_free (proc_name);
      D.13547 = 0;
      return D.13547;
      <D.13559>:
      mods = load_modules (fp);
      fclose (fp);
      count = monoeg_g_slist_length (mods);
      i = 0;
      goto <D.12132>;
      <D.12131>:
      i.83 = (unsigned int) i;
      found_module = monoeg_g_slist_nth_data (mods, i.83);
      if (ret == 0) goto <D.13564>; else goto <D.13565>;
      <D.13564>:
      if (module == 0B) goto <D.13566>; else goto <D.13561>;
      <D.13566>:
      D.13567 = found_module->filename;
      D.13568 = match_procname_to_modulename (proc_name, D.13567);
      if (D.13568 != 0) goto <D.13562>; else goto <D.13561>;
      <D.13561>:
      if (module != 0B) goto <D.13569>; else goto <D.13563>;
      <D.13569>:
      D.13570 = found_module->address_start;
      if (D.13570 == module) goto <D.13562>; else goto <D.13563>;
      <D.13562>:
      D.13570 = found_module->address_start;
      modinfo->lpBaseOfDll = D.13570;
      D.13571 = found_module->address_end;
      D.13572 = (long unsigned int) D.13571;
      D.13570 = found_module->address_start;
      D.13573 = (long unsigned int) D.13570;
      D.13574 = D.13572 - D.13573;
      D.13575 = (unsigned int) D.13574;
      modinfo->SizeOfImage = D.13575;
      D.13576 = found_module->address_offset;
      modinfo->EntryPoint = D.13576;
      ret = 1;
      <D.13563>:
      <D.13565>:
      free_procmodule (found_module);
      i = i + 1;
      <D.12132>:
      i.84 = (unsigned int) i;
      if (i.84 < count) goto <D.12131>; else goto <D.12133>;
      <D.12133>:
      monoeg_g_slist_free (mods);
      monoeg_g_free (proc_name);
      D.13547 = ret;
      return D.13547;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetProcessWorkingSetSize (void * process, size_t * min, size_t * max)
{
  gboolean D.13583;
  long int process.85;
  signed int D.13585;
  struct _WapiHandle_process * process_handle.86;
  long unsigned int D.13591;
  long unsigned int D.13592;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      if (min == 0B) goto <D.13580>; else goto <D.13582>;
      <D.13582>:
      if (max == 0B) goto <D.13580>; else goto <D.13581>;
      <D.13580>:
      D.13583 = 0;
      return D.13583;
      <D.13581>:
      process.85 = (long int) process;
      D.13585 = (signed int) process.85;
      if (D.13585 < 0) goto <D.13586>; else goto <D.13587>;
      <D.13586>:
      D.13583 = 0;
      return D.13583;
      <D.13587>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13588>; else goto <D.13589>;
      <D.13588>:
      D.13583 = 0;
      return D.13583;
      <D.13589>:
      process_handle.86 = process_handle;
      D.13591 = process_handle.86->min_working_set;
      *min = D.13591;
      process_handle.86 = process_handle;
      D.13592 = process_handle.86->max_working_set;
      *max = D.13592;
      D.13583 = 1;
      return D.13583;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetProcessWorkingSetSize (void * process, size_t min, size_t max)
{
  long int process.87;
  signed int D.13596;
  gboolean D.13599;
  struct _WapiHandle_process * process_handle.88;
  struct _WapiHandle_process * process_handle;
  gboolean ok;

  try
    {
      mono_once (&process_current_once, process_set_current);
      process.87 = (long int) process;
      D.13596 = (signed int) process.87;
      if (D.13596 < 0) goto <D.13597>; else goto <D.13598>;
      <D.13597>:
      D.13599 = 0;
      return D.13599;
      <D.13598>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13600>; else goto <D.13601>;
      <D.13600>:
      D.13599 = 0;
      return D.13599;
      <D.13601>:
      process_handle.88 = process_handle;
      process_handle.88->min_working_set = min;
      process_handle.88 = process_handle;
      process_handle.88->max_working_set = max;
      D.13599 = 1;
      return D.13599;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


TerminateProcess (void * process, gint32 exitCode)
{
  long int process.89;
  signed int D.13606;
  int D.13609;
  gboolean D.13613;
  struct _WapiHandle_process * process_handle.90;
  int iftmp.91;
  int * D.13621;
  int D.13622;
  _Bool D.13623;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int signo;
  int ret;
  pid_t pid;

  try
    {
      process.89 = (long int) process;
      D.13606 = (signed int) process.89;
      if (D.13606 < 0) goto <D.13607>; else goto <D.13608>;
      <D.13607>:
      process.89 = (long int) process;
      D.13609 = (int) process.89;
      pid = D.13609 & 2147483647;
      goto <D.13610>;
      <D.13608>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13611>; else goto <D.13612>;
      <D.13611>:
      SetLastError (6);
      D.13613 = 0;
      return D.13613;
      <D.13612>:
      process_handle.90 = process_handle;
      pid = process_handle.90->id;
      <D.13610>:
      if (exitCode == -1) goto <D.13616>; else goto <D.13617>;
      <D.13616>:
      iftmp.91 = 9;
      goto <D.13618>;
      <D.13617>:
      iftmp.91 = 15;
      <D.13618>:
      signo = iftmp.91;
      ret = kill (pid, signo);
      if (ret == -1) goto <D.13619>; else goto <D.13620>;
      <D.13619>:
      D.13621 = __errno_location ();
      D.13622 = *D.13621;
      switch (D.13622) <default: <D.12161>, case 1: <D.12159>, case 3: <D.12160>, case 22: <D.12157>>
      <D.12157>:
      SetLastError (87);
      goto <D.12158>;
      <D.12159>:
      SetLastError (5);
      goto <D.12158>;
      <D.12160>:
      SetLastError (127);
      goto <D.12158>;
      <D.12161>:
      SetLastError (31);
      <D.12158>:
      <D.13620>:
      D.13623 = ret == 0;
      D.13613 = (gboolean) D.13623;
      return D.13613;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


GetPriorityClass (void * process)
{
  long int process.92;
  signed int D.13627;
  int D.13630;
  guint32 D.13634;
  struct _WapiHandle_process * process_handle.93;
  int * D.13636;
  unsigned int pid.94;
  int D.13640;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  pid_t pid;

  try
    {
      process.92 = (long int) process;
      D.13627 = (signed int) process.92;
      if (D.13627 < 0) goto <D.13628>; else goto <D.13629>;
      <D.13628>:
      process.92 = (long int) process;
      D.13630 = (int) process.92;
      pid = D.13630 & 2147483647;
      goto <D.13631>;
      <D.13629>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13632>; else goto <D.13633>;
      <D.13632>:
      SetLastError (6);
      D.13634 = 0;
      return D.13634;
      <D.13633>:
      process_handle.93 = process_handle;
      pid = process_handle.93->id;
      <D.13631>:
      D.13636 = __errno_location ();
      *D.13636 = 0;
      pid.94 = (unsigned int) pid;
      ret = getpriority (0, pid.94);
      if (ret == -1) goto <D.13638>; else goto <D.13639>;
      <D.13638>:
      D.13636 = __errno_location ();
      D.13640 = *D.13636;
      if (D.13640 != 0) goto <D.13641>; else goto <D.13642>;
      <D.13641>:
      D.13636 = __errno_location ();
      D.13640 = *D.13636;
      switch (D.13640) <default: <D.12173>, case 1: <D.12169>, case 3: <D.12172>, case 13: <D.12170>>
      <D.12169>:
      <D.12170>:
      SetLastError (5);
      goto <D.12171>;
      <D.12172>:
      SetLastError (127);
      goto <D.12171>;
      <D.12173>:
      SetLastError (31);
      <D.12171>:
      D.13634 = 0;
      return D.13634;
      <D.13642>:
      <D.13639>:
      if (ret == 0) goto <D.13643>; else goto <D.13644>;
      <D.13643>:
      D.13634 = 32;
      return D.13634;
      <D.13644>:
      if (ret < -15) goto <D.13645>; else goto <D.13646>;
      <D.13645>:
      D.13634 = 256;
      return D.13634;
      <D.13646>:
      if (ret < -10) goto <D.13647>; else goto <D.13648>;
      <D.13647>:
      D.13634 = 128;
      return D.13634;
      <D.13648>:
      if (ret < 0) goto <D.13649>; else goto <D.13650>;
      <D.13649>:
      D.13634 = 32768;
      return D.13634;
      <D.13650>:
      if (ret > 10) goto <D.13651>; else goto <D.13652>;
      <D.13651>:
      D.13634 = 64;
      return D.13634;
      <D.13652>:
      if (ret > 0) goto <D.13653>; else goto <D.13654>;
      <D.13653>:
      D.13634 = 16384;
      return D.13634;
      <D.13654>:
      D.13634 = 32;
      return D.13634;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


SetPriorityClass (void * process, guint32 priority_class)
{
  long int process.95;
  signed int D.13658;
  int D.13661;
  gboolean D.13665;
  struct _WapiHandle_process * process_handle.96;
  unsigned int pid.97;
  int * D.13670;
  int D.13671;
  _Bool D.13672;
  struct _WapiHandle_process * process_handle;
  gboolean ok;
  int ret;
  int prio;
  pid_t pid;

  try
    {
      process.95 = (long int) process;
      D.13658 = (signed int) process.95;
      if (D.13658 < 0) goto <D.13659>; else goto <D.13660>;
      <D.13659>:
      process.95 = (long int) process;
      D.13661 = (int) process.95;
      pid = D.13661 & 2147483647;
      goto <D.13662>;
      <D.13660>:
      ok = _wapi_lookup_handle (process, 9, &process_handle);
      if (ok == 0) goto <D.13663>; else goto <D.13664>;
      <D.13663>:
      SetLastError (6);
      D.13665 = 0;
      return D.13665;
      <D.13664>:
      process_handle.96 = process_handle;
      pid = process_handle.96->id;
      <D.13662>:
      switch (priority_class) <default: <D.12190>, case 32: <D.12186>, case 64: <D.12183>, case 128: <D.12188>, case 256: <D.12189>, case 16384: <D.12185>, case 32768: <D.12187>>
      <D.12183>:
      prio = 19;
      goto <D.12184>;
      <D.12185>:
      prio = 10;
      goto <D.12184>;
      <D.12186>:
      prio = 0;
      goto <D.12184>;
      <D.12187>:
      prio = -5;
      goto <D.12184>;
      <D.12188>:
      prio = -11;
      goto <D.12184>;
      <D.12189>:
      prio = -20;
      goto <D.12184>;
      <D.12190>:
      SetLastError (87);
      D.13665 = 0;
      return D.13665;
      <D.12184>:
      pid.97 = (unsigned int) pid;
      ret = setpriority (0, pid.97, prio);
      if (ret == -1) goto <D.13668>; else goto <D.13669>;
      <D.13668>:
      D.13670 = __errno_location ();
      D.13671 = *D.13670;
      switch (D.13671) <default: <D.12195>, case 1: <D.12191>, case 3: <D.12194>, case 13: <D.12192>>
      <D.12191>:
      <D.12192>:
      SetLastError (5);
      goto <D.12193>;
      <D.12194>:
      SetLastError (127);
      goto <D.12193>;
      <D.12195>:
      SetLastError (31);
      <D.12193>:
      <D.13669>:
      D.13672 = ret == 0;
      D.13665 = (gboolean) D.13672;
      return D.13665;
    }
  finally
    {
      process_handle = {CLOBBER};
    }
}


