_wapi_shm_enabled ()
{
  int env_checked.0;
  const gchar * D.10403;
  gboolean D.10406;
  int _wapi_shm_disabled.1;
  _Bool D.10408;
  static gboolean env_checked;

  env_checked.0 = env_checked;
  if (env_checked.0 == 0) goto <D.10401>; else goto <D.10402>;
  <D.10401>:
  D.10403 = monoeg_g_getenv ("MONO_ENABLE_SHM");
  if (D.10403 != 0B) goto <D.10404>; else goto <D.10405>;
  <D.10404>:
  _wapi_shm_disabled = 0;
  <D.10405>:
  env_checked = 1;
  <D.10402>:
  _wapi_shm_disabled.1 = _wapi_shm_disabled;
  D.10408 = _wapi_shm_disabled.1 == 0;
  D.10406 = (gboolean) D.10408;
  return D.10406;
}


_wapi_shm_attach (_wapi_shm_t type)
{
  void * D.10410;
  int D.10411;
  void * D.10414;
  int size.2;
  int D.10420;
  int * D.10423;
  int D.10424;
  const gchar * D.10425;
  long long int D.10426;
  unsigned int D.10427;
  const gchar * D.10432;
  void * shm_seg;
  int fd;
  struct stat statbuf;
  gchar * filename;
  gchar * shm_name;
  guint32 size;
  static const char __func__[17] = "_wapi_shm_attach";

  try
    {
      filename = _wapi_shm_file (type);
      switch (type) <default: <D.10320>, case 0: <D.10317>, case 1: <D.10319>>
      <D.10317>:
      size = 81928;
      goto <D.10318>;
      <D.10319>:
      size = 3686404;
      goto <D.10318>;
      <D.10320>:
      monoeg_g_log (0B, 4, "Invalid type in _wapi_shm_attach ()");
      <D.10321>:
      goto <D.10321>;
      D.10410 = 0B;
      return D.10410;
      <D.10318>:
      D.10411 = _wapi_shm_enabled ();
      if (D.10411 == 0) goto <D.10412>; else goto <D.10413>;
      <D.10412>:
      D.10414 = monoeg_malloc0 (size);
      wapi_storage[type] = D.10414;
      D.10410 = wapi_storage[type];
      return D.10410;
      <D.10413>:
      shm_name = _wapi_shm_shm_name (type);
      size.2 = (int) size;
      fd = _wapi_shm_open (shm_name, size.2);
      monoeg_g_free (shm_name);
      if (fd == -1) goto <D.10416>; else goto <D.10417>;
      <D.10416>:
      fd = _wapi_shm_file_open (filename, size);
      <D.10417>:
      if (fd == -1) goto <D.10418>; else goto <D.10419>;
      <D.10418>:
      monoeg_g_log (0B, 8, "%s: shared file [%s] open error", &__func__, filename);
      D.10410 = 0B;
      return D.10410;
      <D.10419>:
      D.10420 = fstat (fd, &statbuf);
      if (D.10420 == -1) goto <D.10421>; else goto <D.10422>;
      <D.10421>:
      D.10423 = __errno_location ();
      D.10424 = *D.10423;
      D.10425 = monoeg_g_strerror (D.10424);
      monoeg_g_log (0B, 8, "%s: fstat error: %s", &__func__, D.10425);
      close (fd);
      D.10410 = 0B;
      return D.10410;
      <D.10422>:
      D.10426 = statbuf.st_size;
      D.10427 = (unsigned int) D.10426;
      shm_seg = mmap (0B, D.10427, 3, 1, fd, 0);
      if (shm_seg == 4294967295B) goto <D.10428>; else goto <D.10429>;
      <D.10428>:
      D.10426 = statbuf.st_size;
      D.10427 = (unsigned int) D.10426;
      shm_seg = mmap (0B, D.10427, 3, 2, fd, 0);
      if (shm_seg == 4294967295B) goto <D.10430>; else goto <D.10431>;
      <D.10430>:
      D.10423 = __errno_location ();
      D.10424 = *D.10423;
      D.10432 = monoeg_g_strerror (D.10424);
      monoeg_g_log (0B, 8, "%s: mmap error: %s", &__func__, D.10432);
      close (fd);
      D.10410 = 0B;
      return D.10410;
      <D.10431>:
      <D.10429>:
      close (fd);
      D.10410 = shm_seg;
      return D.10410;
    }
  finally
    {
      statbuf = {CLOBBER};
    }
}


_wapi_shm_file (_wapi_shm_t type)
{
  const gchar * D.10437;
  gchar * D.10439;
  static gchar file[256];
  gchar * name;
  gchar * filename;
  const gchar * wapi_dir;

  name = 0B;
  name = _wapi_shm_base_name (type);
  wapi_dir = monoeg_g_getenv ("MONO_SHARED_DIR");
  if (wapi_dir == 0B) goto <D.10435>; else goto <D.10436>;
  <D.10435>:
  D.10437 = monoeg_g_get_home_dir ();
  filename = monoeg_g_build_path ("/", D.10437, ".wapi", name, 0B);
  goto <D.10438>;
  <D.10436>:
  filename = monoeg_g_build_path ("/", wapi_dir, ".wapi", name, 0B);
  <D.10438>:
  monoeg_g_free (name);
  monoeg_g_snprintf (&file, 256, "%s", filename);
  monoeg_g_free (filename);
  D.10439 = &file;
  return D.10439;
}


_wapi_shm_base_name (_wapi_shm_t type)
{
  int D.10446;
  int iftmp.3;
  unsigned int D.10451;
  unsigned int D.10454;
  unsigned int len.4;
  gchar * D.10458;
  gchar * name;
  gchar machine_name[256];
  const gchar * fake_name;
  struct utsname ubuf;
  int ret;
  int len;

  try
    {
      name = 0B;
      ret = uname (&ubuf);
      if (ret == -1) goto <D.10441>; else goto <D.10442>;
      <D.10441>:
      ubuf.machine[0] = 0;
      ubuf.sysname[0] = 0;
      goto <D.10443>;
      <D.10442>:
      monoeg_g_strdelimit (&ubuf.sysname, "/", 95);
      monoeg_g_strdelimit (&ubuf.machine, "/", 95);
      <D.10443>:
      fake_name = monoeg_g_getenv ("MONO_SHARED_HOSTNAME");
      if (fake_name == 0B) goto <D.10444>; else goto <D.10445>;
      <D.10444>:
      D.10446 = gethostname (&machine_name, 256);
      if (D.10446 != 0) goto <D.10447>; else goto <D.10448>;
      <D.10447>:
      machine_name[0] = 0;
      <D.10448>:
      goto <D.10449>;
      <D.10445>:
      D.10451 = strlen (fake_name);
      if (D.10451 <= 254) goto <D.10452>; else goto <D.10453>;
      <D.10452>:
      D.10454 = strlen (fake_name);
      iftmp.3 = (int) D.10454;
      goto <D.10455>;
      <D.10453>:
      iftmp.3 = 255;
      <D.10455>:
      len = iftmp.3;
      len.4 = (unsigned int) len;
      strncpy (&machine_name, fake_name, len.4);
      machine_name[len] = 0;
      <D.10449>:
      switch (type) <default: <D.10457>, case 0: <D.10269>, case 1: <D.10271>>
      <D.10269>:
      name = monoeg_g_strdup_printf ("shared_data-%s-%s-%s-%d-%d-%d", &machine_name, &ubuf.sysname, &ubuf.machine, 320, 12, 0);
      goto <D.10270>;
      <D.10271>:
      name = monoeg_g_strdup_printf ("shared_fileshare-%s-%s-%s-%d-%d-%d", &machine_name, &ubuf.sysname, &ubuf.machine, 36, 12, 0);
      goto <D.10270>;
      <D.10457>:
      <D.10270>:
      D.10458 = name;
      return D.10458;
    }
  finally
    {
      machine_name = {CLOBBER};
      ubuf = {CLOBBER};
    }
}


gethostname (char * __buf, size_t __buflen)
{
  unsigned int D.10461;
  int D.10464;
  int D.10467;
  unsigned int D.10468;
  unsigned int D.10469;
  unsigned int D.10472;

  D.10461 = __builtin_object_size (__buf, 1);
  if (D.10461 != 4294967295) goto <D.10462>; else goto <D.10463>;
  <D.10462>:
  D.10464 = __builtin_constant_p (__buflen);
  if (D.10464 == 0) goto <D.10465>; else goto <D.10466>;
  <D.10465>:
  D.10468 = __builtin_object_size (__buf, 1);
  D.10467 = __gethostname_chk (__buf, __buflen, D.10468);
  return D.10467;
  <D.10466>:
  D.10469 = __builtin_object_size (__buf, 1);
  if (D.10469 < __buflen) goto <D.10470>; else goto <D.10471>;
  <D.10470>:
  D.10472 = __builtin_object_size (__buf, 1);
  D.10467 = __gethostname_chk_warn (__buf, __buflen, D.10472);
  return D.10467;
  <D.10471>:
  <D.10463>:
  D.10467 = __gethostname_alias (__buf, __buflen);
  return D.10467;
}


strncpy (char * restrict __dest, const char * restrict __src, size_t __len)
{
  char * D.10474;
  unsigned int D.10475;

  D.10475 = __builtin_object_size (__dest, 1);
  D.10474 = __builtin___strncpy_chk (__dest, __src, __len, D.10475);
  return D.10474;
}


_wapi_shm_shm_name (_wapi_shm_t type)
{
  unsigned int D.10477;
  gchar * D.10478;
  char * base_name;
  char * res;

  base_name = _wapi_shm_base_name (type);
  D.10477 = getuid ();
  res = monoeg_g_strdup_printf ("/mono-shared-%d-%s", D.10477, base_name);
  monoeg_g_free (base_name);
  D.10478 = res;
  return D.10478;
}


_wapi_shm_open (const char * filename, int size)
{
  int D.10482;
  long long int D.10483;
  int D.10484;
  int fd;

  fd = shm_open (filename, 66, 416);
  if (fd == -1) goto <D.10480>; else goto <D.10481>;
  <D.10480>:
  D.10482 = -1;
  return D.10482;
  <D.10481>:
  D.10483 = (long long int) size;
  D.10484 = ftruncate (fd, D.10483);
  if (D.10484 != 0) goto <D.10485>; else goto <D.10486>;
  <D.10485>:
  perror ("_wapi_shm_open (): ftruncate ()");
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "shared.c", 245);
  <D.10486>:
  D.10482 = fd;
  return D.10482;
}


_wapi_shm_file_open (const gchar * filename, guint32 wanted_size)
{
  int tries.5;
  int D.10491;
  int * D.10497;
  int D.10498;
  const gchar * D.10505;
  unsigned int D.10506;
  long long int D.10507;
  long long int D.10508;
  const gchar * D.10511;
  const gchar * D.10515;
  const gchar * D.10518;
  int D.10519;
  const gchar * D.10522;
  long long int D.10525;
  long long int D.10526;
  long int D.10531;
  int fd;
  struct stat statbuf;
  int ret;
  int tries;
  gboolean created;
  mode_t oldmask;
  gchar * dir;
  void try_again = <<< error >>>;
  static const char __func__[20] = "_wapi_shm_file_open";

  try
    {
      tries = 0;
      created = 0;
      dir = monoeg_g_path_get_dirname (filename);
      mkdir (dir, 493);
      monoeg_g_free (dir);
      try_again:
      tries.5 = tries;
      tries = tries.5 + 1;
      if (tries.5 > 10) goto <D.10489>; else goto <D.10490>;
      <D.10489>:
      D.10491 = -1;
      return D.10491;
      <D.10490>:
      if (tries > 5) goto <D.10492>; else goto <D.10493>;
      <D.10492>:
      unlink (filename);
      <D.10493>:
      oldmask = umask (54);
      fd = open (filename, 2, 384);
      umask (oldmask);
      if (fd == -1) goto <D.10496>; else goto <D.10494>;
      <D.10496>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      if (D.10498 == 2) goto <D.10499>; else goto <D.10494>;
      <D.10499>:
      oldmask = umask (54);
      fd = open (filename, 194, 384);
      umask (oldmask);
      if (fd == -1) goto <D.10502>; else goto <D.10500>;
      <D.10502>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      if (D.10498 == 17) goto try_again; else goto <D.10500>;
      goto <D.10501>;
      <D.10500>:
      if (fd == -1) goto <D.10503>; else goto <D.10504>;
      <D.10503>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      D.10505 = monoeg_g_strerror (D.10498);
      monoeg_g_log (0B, 8, "%s: shared file [%s] open error: %s", &__func__, filename, D.10505);
      D.10491 = -1;
      return D.10491;
      <D.10504>:
      D.10506 = wanted_size + 4294967295;
      D.10507 = (long long int) D.10506;
      D.10508 = lseek (fd, D.10507, 0);
      if (D.10508 == -1) goto <D.10509>; else goto <D.10510>;
      <D.10509>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      D.10511 = monoeg_g_strerror (D.10498);
      monoeg_g_log (0B, 8, "%s: shared file [%s] lseek error: %s", &__func__, filename, D.10511);
      close (fd);
      unlink (filename);
      D.10491 = -1;
      return D.10491;
      <D.10510>:
      <D.10302>:
      ret = write (fd, "", 1);
      if (ret == -1) goto <D.10512>; else goto <D.10303>;
      <D.10512>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      if (D.10498 == 4) goto <D.10302>; else goto <D.10303>;
      <D.10303>:
      if (ret == -1) goto <D.10513>; else goto <D.10514>;
      <D.10513>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      D.10515 = monoeg_g_strerror (D.10498);
      monoeg_g_log (0B, 8, "%s: shared file [%s] write error: %s", &__func__, filename, D.10515);
      close (fd);
      unlink (filename);
      D.10491 = -1;
      return D.10491;
      <D.10514>:
      created = 1;
      <D.10501>:
      goto <D.10495>;
      <D.10494>:
      if (fd == -1) goto <D.10516>; else goto <D.10517>;
      <D.10516>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      D.10518 = monoeg_g_strerror (D.10498);
      monoeg_g_log (0B, 8, "%s: shared file [%s] open error: %s", &__func__, filename, D.10518);
      D.10491 = -1;
      return D.10491;
      <D.10517>:
      <D.10495>:
      D.10519 = fstat (fd, &statbuf);
      if (D.10519 == -1) goto <D.10520>; else goto <D.10521>;
      <D.10520>:
      D.10497 = __errno_location ();
      D.10498 = *D.10497;
      D.10522 = monoeg_g_strerror (D.10498);
      monoeg_g_log (0B, 8, "%s: fstat error: %s", &__func__, D.10522);
      if (created == 1) goto <D.10523>; else goto <D.10524>;
      <D.10523>:
      unlink (filename);
      <D.10524>:
      close (fd);
      D.10491 = -1;
      return D.10491;
      <D.10521>:
      D.10525 = statbuf.st_size;
      D.10526 = (long long int) wanted_size;
      if (D.10525 < D.10526) goto <D.10527>; else goto <D.10528>;
      <D.10527>:
      close (fd);
      if (created == 1) goto <D.10529>; else goto <D.10530>;
      <D.10529>:
      D.10525 = statbuf.st_size;
      D.10531 = (long int) D.10525;
      monoeg_g_log (0B, 8, "%s: shared file [%s] is not big enough! (found %ld, need %d bytes)", &__func__, filename, D.10531, wanted_size);
      unlink (filename);
      D.10491 = -1;
      return D.10491;
      <D.10530>:
      _wapi_handle_spin (100);
      goto try_again;
      <D.10528>:
      D.10491 = fd;
      return D.10491;
    }
  finally
    {
      statbuf = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.10534;
  int D.10537;
  int D.10542;
  int D.10544;
  int D.10545;
  int D.10548;
  int D.10549;

  D.10534 = __builtin_va_arg_pack_len ();
  if (D.10534 > 1) goto <D.10535>; else goto <D.10536>;
  <D.10535>:
  __open_too_many_args ();
  <D.10536>:
  D.10537 = __builtin_constant_p (__oflag);
  if (D.10537 != 0) goto <D.10538>; else goto <D.10539>;
  <D.10538>:
  D.10542 = __oflag & 64;
  if (D.10542 != 0) goto <D.10540>; else goto <D.10543>;
  <D.10543>:
  D.10544 = __oflag & 4259840;
  if (D.10544 == 4259840) goto <D.10540>; else goto <D.10541>;
  <D.10540>:
  D.10545 = __builtin_va_arg_pack_len ();
  if (D.10545 <= 0) goto <D.10546>; else goto <D.10547>;
  <D.10546>:
  __open_missing_mode ();
  D.10548 = __open_2 (__path, __oflag);
  return D.10548;
  <D.10547>:
  <D.10541>:
  D.10548 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.10548;
  <D.10539>:
  D.10549 = __builtin_va_arg_pack_len ();
  if (D.10549 <= 0) goto <D.10550>; else goto <D.10551>;
  <D.10550>:
  D.10548 = __open_2 (__path, __oflag);
  return D.10548;
  <D.10551>:
  D.10548 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.10548;
}


_wapi_handle_spin (guint32 ms)
{
  _Bool D.10553;
  long int D.10554;
  long int D.10555;
  unsigned int D.10558;
  long int D.10559;
  struct timespec sleepytime;

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


fstat (int __fd, struct stat * __statbuf)
{
  int D.10560;

  D.10560 = __fxstat (3, __fd, __statbuf);
  return D.10560;
}


_wapi_shm_detach (_wapi_shm_t type)
{
  int D.10562;
  void * D.10565;

  D.10562 = _wapi_shm_enabled ();
  if (D.10562 == 0) goto <D.10563>; else goto <D.10564>;
  <D.10563>:
  D.10565 = wapi_storage[type];
  monoeg_g_free (D.10565);
  <D.10564>:
}


_wapi_shm_semaphores_init ()
{
  int D.10566;

  D.10566 = _wapi_shm_enabled ();
  if (D.10566 == 0) goto <D.10567>; else goto <D.10568>;
  <D.10567>:
  noshm_semaphores_init ();
  goto <D.10569>;
  <D.10568>:
  shm_semaphores_init ();
  <D.10569>:
}


noshm_semaphores_init ()
{
  union mono_mutex_t * D.10570;
  int i;

  i = 0;
  goto <D.10246>;
  <D.10245>:
  D.10570 = &noshm_sems[i];
  pthread_mutex_init (D.10570, 0B);
  i = i + 1;
  <D.10246>:
  if (i <= 7) goto <D.10245>; else goto <D.10247>;
  <D.10247>:
}


shm_semaphores_init ()
{
  _Bool D.10571;
  long int D.10572;
  long int D.10573;
  _Bool D.10576;
  long int D.10577;
  long int D.10578;
  int * D.10583;
  int D.10584;
  const gchar * D.10587;
  const gchar * D.10590;
  const gchar * D.10595;
  int _wapi_sem_id.6;
  int _wapi_sem_id.7;
  int D.10598;
  const gchar * D.10603;
  volatile key_t * D.10604;
  int D.10605;
  int _wapi_sem_id.8;
  const gchar * D.10612;
  volatile key_t * D.10613;
  _Bool D.10614;
  long int D.10615;
  long int D.10616;
  int _wapi_shm_disabled.9;
  key_t key;
  key_t oldkey;
  int thr_ret;
  struct _WapiHandleSharedLayout * tmp_shared;
  gchar * ftmp;
  gchar * filename;
  typedef union semun unionunion semun;
  union semun defs;
  ushort def_vals[8];
  int i;
  int retries;
  void again = <<< error >>>;
  static const char __func__[20] = "shm_semaphores_init";
  void done = <<< error >>>;

  try
    {
      retries = 0;
      i = 0;
      goto <D.10344>;
      <D.10343>:
      def_vals[i] = 1;
      i = i + 1;
      <D.10344>:
      if (i <= 7) goto <D.10343>; else goto <D.10345>;
      <D.10345>:
      def_vals[7] = 0;
      defs.array = &def_vals;
      tmp_shared = _wapi_shm_attach (0);
      D.10571 = tmp_shared == 0B;
      D.10572 = (long int) D.10571;
      D.10573 = __builtin_expect (D.10572, 0);
      if (D.10573 != 0) goto <D.10574>; else goto <D.10575>;
      <D.10574>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 547, "tmp_shared != NULL");
      <D.10575>:
      ftmp = _wapi_shm_shm_name (0);
      filename = monoeg_g_build_path ("/", "/dev/shm", ftmp, 0B);
      D.10576 = filename == 0B;
      D.10577 = (long int) D.10576;
      D.10578 = __builtin_expect (D.10577, 0);
      if (D.10578 != 0) goto <D.10579>; else goto <D.10580>;
      <D.10579>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 552, "filename!=NULL");
      <D.10580>:
      key = ftok (filename, 77);
      monoeg_g_free (ftmp);
      monoeg_g_free (filename);
      again:
      retries = retries + 1;
      oldkey = tmp_shared->sem_key;
      if (oldkey == 0) goto <D.10581>; else goto <D.10582>;
      <D.10581>:
      goto <D.10351>;
      <D.10350>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      if (D.10584 == 12) goto <D.10585>; else goto <D.10586>;
      <D.10585>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      D.10587 = monoeg_g_strerror (D.10584);
      monoeg_g_log (0B, 4, "%s: semget error: %s", &__func__, D.10587);
      <D.10348>:
      goto <D.10348>;
      <D.10586>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      if (D.10584 == 28) goto <D.10588>; else goto <D.10589>;
      <D.10588>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      D.10590 = monoeg_g_strerror (D.10584);
      monoeg_g_log (0B, 4, "%s: semget error: %s.  Try deleting some semaphores with ipcs and ipcrm\nor increase the maximum number of semaphore in the system.", &__func__, D.10590);
      <D.10349>:
      goto <D.10349>;
      <D.10589>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      if (D.10584 != 17) goto <D.10591>; else goto <D.10592>;
      <D.10591>:
      if (retries > 3) goto <D.10593>; else goto <D.10594>;
      <D.10593>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      D.10595 = monoeg_g_strerror (D.10584);
      monoeg_g_log (0B, 16, "%s: semget error: %s key 0x%x - trying again", &__func__, D.10595, key);
      <D.10594>:
      <D.10592>:
      key = key + 1;
      <D.10351>:
      _wapi_sem_id.6 = semget (key, 8, 1920);
      _wapi_sem_id = _wapi_sem_id.6;
      _wapi_sem_id.7 = _wapi_sem_id;
      if (_wapi_sem_id.7 == -1) goto <D.10350>; else goto <D.10352>;
      <D.10352>:
      _wapi_sem_id.7 = _wapi_sem_id;
      D.10598 = semctl (_wapi_sem_id.7, 0, 17, defs);
      if (D.10598 == -1) goto <D.10599>; else goto <D.10600>;
      <D.10599>:
      if (retries > 3) goto <D.10601>; else goto <D.10602>;
      <D.10601>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      D.10603 = monoeg_g_strerror (D.10584);
      monoeg_g_log (0B, 16, "%s: semctl init error: %s - trying again", &__func__, D.10603);
      <D.10602>:
      _wapi_sem_id.7 = _wapi_sem_id;
      semctl (_wapi_sem_id.7, 0, 0);
      goto again;
      <D.10600>:
      D.10604 = &tmp_shared->sem_key;
      D.10605 = InterlockedCompareExchange (D.10604, key, 0);
      if (D.10605 != 0) goto <D.10606>; else goto done;
      <D.10606>:
      _wapi_sem_id.7 = _wapi_sem_id;
      semctl (_wapi_sem_id.7, 0, 0);
      oldkey = tmp_shared->sem_key;
      <D.10582>:
      _wapi_sem_id.8 = semget (oldkey, 8, 384);
      _wapi_sem_id = _wapi_sem_id.8;
      _wapi_sem_id.7 = _wapi_sem_id;
      if (_wapi_sem_id.7 == -1) goto <D.10608>; else goto <D.10609>;
      <D.10608>:
      if (retries > 3) goto <D.10610>; else goto <D.10611>;
      <D.10610>:
      D.10583 = __errno_location ();
      D.10584 = *D.10583;
      D.10612 = monoeg_g_strerror (D.10584);
      monoeg_g_log (0B, 16, "%s: semget error opening old key 0x%x (%s) - trying again", &__func__, oldkey, D.10612);
      <D.10611>:
      D.10613 = &tmp_shared->sem_key;
      InterlockedCompareExchange (D.10613, 0, oldkey);
      goto again;
      <D.10609>:
      done:
      thr_ret = _wapi_shm_sem_lock (6);
      D.10614 = thr_ret != 0;
      D.10615 = (long int) D.10614;
      D.10616 = __builtin_expect (D.10615, 0);
      if (D.10616 != 0) goto <D.10617>; else goto <D.10618>;
      <D.10617>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 645, "thr_ret == 0");
      <D.10618>:
      _wapi_shm_sem_unlock (7);
      _wapi_shm_sem_unlock (6);
      _wapi_shm_disabled.9 = _wapi_shm_disabled;
      if (_wapi_shm_disabled.9 != 0) goto <D.10620>; else goto <D.10621>;
      <D.10620>:
      monoeg_g_free (tmp_shared);
      goto <D.10622>;
      <D.10621>:
      munmap (tmp_shared, 81928);
      <D.10622>:
    }
  finally
    {
      defs = {CLOBBER};
      def_vals = {CLOBBER};
    }
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.10623;
  unsigned int exch.10;
  unsigned int comp.11;
  unsigned int D.10626;

  exch.10 = (unsigned int) exch;
  comp.11 = (unsigned int) comp;
  D.10626 = __sync_val_compare_and_swap_4 (dest, comp.11, exch.10);
  D.10623 = (gint32) D.10626;
  return D.10623;
}


_wapi_shm_semaphores_remove ()
{
  int _wapi_shm_disabled.12;

  _wapi_shm_disabled.12 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.12 == 0) goto <D.10629>; else goto <D.10630>;
  <D.10629>:
  shm_semaphores_remove ();
  <D.10630>:
}


shm_semaphores_remove ()
{
  _Bool D.10631;
  long int D.10632;
  long int D.10633;
  int _wapi_sem_id.13;
  _Bool D.10637;
  long int D.10638;
  long int D.10639;
  gchar * D.10644;
  gchar * D.10645;
  int thr_ret;
  int proc_count;
  gchar * shm_name;

  thr_ret = _wapi_shm_sem_lock (6);
  D.10631 = thr_ret != 0;
  D.10632 = (long int) D.10631;
  D.10633 = __builtin_expect (D.10632, 0);
  if (D.10633 != 0) goto <D.10634>; else goto <D.10635>;
  <D.10634>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 678, "thr_ret == 0");
  <D.10635>:
  _wapi_sem_id.13 = _wapi_sem_id;
  proc_count = semctl (_wapi_sem_id.13, 7, 12);
  D.10637 = proc_count <= 0;
  D.10638 = (long int) D.10637;
  D.10639 = __builtin_expect (D.10638, 0);
  if (D.10639 != 0) goto <D.10640>; else goto <D.10641>;
  <D.10640>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 683, "proc_count > 0");
  <D.10641>:
  if (proc_count == 1) goto <D.10642>; else goto <D.10643>;
  <D.10642>:
  _wapi_sem_id.13 = _wapi_sem_id;
  semctl (_wapi_sem_id.13, 0, 0);
  shm_name = _wapi_shm_shm_name (0);
  shm_unlink (shm_name);
  monoeg_g_free (shm_name);
  shm_name = _wapi_shm_shm_name (1);
  shm_unlink (shm_name);
  monoeg_g_free (shm_name);
  D.10644 = _wapi_shm_file (0);
  unlink (D.10644);
  D.10645 = _wapi_shm_file (1);
  unlink (D.10645);
  goto <D.10646>;
  <D.10643>:
  _wapi_shm_sem_unlock (6);
  <D.10646>:
}


_wapi_shm_sem_lock (int sem)
{
  int _wapi_shm_disabled.14;
  int D.10650;

  _wapi_shm_disabled.14 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.14 != 0) goto <D.10648>; else goto <D.10649>;
  <D.10648>:
  D.10650 = noshm_sem_lock (sem);
  return D.10650;
  <D.10649>:
  D.10650 = shm_sem_lock (sem);
  return D.10650;
}


noshm_sem_lock (int sem)
{
  union mono_mutex_t * D.10652;
  int D.10653;
  int ret;

  D.10652 = &noshm_sems[sem];
  ret = pthread_mutex_lock (D.10652);
  D.10653 = ret;
  return D.10653;
}


shm_sem_lock (int sem)
{
  short unsigned int D.10655;
  int _wapi_sem_id.15;
  int * D.10658;
  int D.10659;
  int D.10662;
  _Bool D.10663;
  _Bool D.10664;
  _Bool D.10665;
  int D.10668;
  struct sembuf ops;
  int ret;
  void retry = <<< error >>>;

  try
    {
      D.10655 = (short unsigned int) sem;
      ops.sem_num = D.10655;
      ops.sem_op = -1;
      ops.sem_flg = 4096;
      retry:
      <D.10366>:
      _wapi_sem_id.15 = _wapi_sem_id;
      ret = semop (_wapi_sem_id.15, &ops, 1);
      if (ret == -1) goto <D.10657>; else goto <D.10367>;
      <D.10657>:
      D.10658 = __errno_location ();
      D.10659 = *D.10658;
      if (D.10659 == 4) goto <D.10366>; else goto <D.10367>;
      <D.10367>:
      if (ret == -1) goto <D.10660>; else goto <D.10661>;
      <D.10660>:
      D.10658 = __errno_location ();
      D.10662 = *D.10658;
      D.10663 = D.10662 == 43;
      D.10664 = D.10662 == 22;
      D.10665 = D.10663 | D.10664;
      if (D.10665 != 0) goto <D.10666>; else goto <D.10667>;
      <D.10666>:
      _wapi_shm_semaphores_init ();
      goto retry;
      <D.10667>:
      D.10658 = __errno_location ();
      ret = *D.10658;
      <D.10661>:
      D.10668 = ret;
      return D.10668;
    }
  finally
    {
      ops = {CLOBBER};
    }
}


_wapi_shm_sem_trylock (int sem)
{
  int _wapi_shm_disabled.16;
  int D.10674;

  _wapi_shm_disabled.16 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.16 != 0) goto <D.10672>; else goto <D.10673>;
  <D.10672>:
  D.10674 = noshm_sem_trylock (sem);
  return D.10674;
  <D.10673>:
  D.10674 = shm_sem_trylock (sem);
  return D.10674;
}


noshm_sem_trylock (int sem)
{
  union mono_mutex_t * D.10676;
  int D.10677;
  int ret;

  D.10676 = &noshm_sems[sem];
  ret = pthread_mutex_trylock (D.10676);
  D.10677 = ret;
  return D.10677;
}


shm_sem_trylock (int sem)
{
  short unsigned int D.10679;
  int _wapi_sem_id.17;
  int * D.10682;
  int D.10683;
  int D.10686;
  _Bool D.10687;
  _Bool D.10688;
  _Bool D.10689;
  int D.10694;
  struct sembuf ops;
  int ret;
  void retry = <<< error >>>;

  try
    {
      D.10679 = (short unsigned int) sem;
      ops.sem_num = D.10679;
      ops.sem_op = -1;
      ops.sem_flg = 6144;
      retry:
      <D.10374>:
      _wapi_sem_id.17 = _wapi_sem_id;
      ret = semop (_wapi_sem_id.17, &ops, 1);
      if (ret == -1) goto <D.10681>; else goto <D.10375>;
      <D.10681>:
      D.10682 = __errno_location ();
      D.10683 = *D.10682;
      if (D.10683 == 4) goto <D.10374>; else goto <D.10375>;
      <D.10375>:
      if (ret == -1) goto <D.10684>; else goto <D.10685>;
      <D.10684>:
      D.10682 = __errno_location ();
      D.10686 = *D.10682;
      D.10687 = D.10686 == 43;
      D.10688 = D.10686 == 22;
      D.10689 = D.10687 | D.10688;
      if (D.10689 != 0) goto <D.10690>; else goto <D.10691>;
      <D.10690>:
      _wapi_shm_semaphores_init ();
      goto retry;
      <D.10691>:
      D.10682 = __errno_location ();
      ret = *D.10682;
      <D.10685>:
      if (ret == 11) goto <D.10692>; else goto <D.10693>;
      <D.10692>:
      ret = 16;
      <D.10693>:
      D.10694 = ret;
      return D.10694;
    }
  finally
    {
      ops = {CLOBBER};
    }
}


_wapi_shm_sem_unlock (int sem)
{
  int _wapi_shm_disabled.18;
  int D.10700;

  _wapi_shm_disabled.18 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.18 != 0) goto <D.10698>; else goto <D.10699>;
  <D.10698>:
  D.10700 = noshm_sem_unlock (sem);
  return D.10700;
  <D.10699>:
  D.10700 = shm_sem_unlock (sem);
  return D.10700;
}


noshm_sem_unlock (int sem)
{
  union mono_mutex_t * D.10702;
  int D.10703;
  int ret;

  D.10702 = &noshm_sems[sem];
  ret = pthread_mutex_unlock (D.10702);
  D.10703 = ret;
  return D.10703;
}


shm_sem_unlock (int sem)
{
  short unsigned int D.10705;
  int _wapi_sem_id.19;
  int * D.10708;
  int D.10709;
  int D.10712;
  _Bool D.10713;
  _Bool D.10714;
  _Bool D.10715;
  int D.10718;
  struct sembuf ops;
  int ret;
  void retry = <<< error >>>;

  try
    {
      D.10705 = (short unsigned int) sem;
      ops.sem_num = D.10705;
      ops.sem_op = 1;
      ops.sem_flg = 4096;
      retry:
      <D.10382>:
      _wapi_sem_id.19 = _wapi_sem_id;
      ret = semop (_wapi_sem_id.19, &ops, 1);
      if (ret == -1) goto <D.10707>; else goto <D.10383>;
      <D.10707>:
      D.10708 = __errno_location ();
      D.10709 = *D.10708;
      if (D.10709 == 4) goto <D.10382>; else goto <D.10383>;
      <D.10383>:
      if (ret == -1) goto <D.10710>; else goto <D.10711>;
      <D.10710>:
      D.10708 = __errno_location ();
      D.10712 = *D.10708;
      D.10713 = D.10712 == 43;
      D.10714 = D.10712 == 22;
      D.10715 = D.10713 | D.10714;
      if (D.10715 != 0) goto <D.10716>; else goto <D.10717>;
      <D.10716>:
      _wapi_shm_semaphores_init ();
      goto retry;
      <D.10717>:
      D.10708 = __errno_location ();
      ret = *D.10708;
      <D.10711>:
      D.10718 = ret;
      return D.10718;
    }
  finally
    {
      ops = {CLOBBER};
    }
}


