_wapi_shm_enabled ()
{
  int env_checked.0;
  const gchar * D.11272;
  gboolean D.11275;
  int _wapi_shm_disabled.1;
  _Bool D.11277;
  static gboolean env_checked;

  env_checked.0 = env_checked;
  if (env_checked.0 == 0) goto <D.11270>; else goto <D.11271>;
  <D.11270>:
  D.11272 = monoeg_g_getenv ("MONO_ENABLE_SHM");
  if (D.11272 != 0B) goto <D.11273>; else goto <D.11274>;
  <D.11273>:
  _wapi_shm_disabled = 0;
  <D.11274>:
  env_checked = 1;
  <D.11271>:
  _wapi_shm_disabled.1 = _wapi_shm_disabled;
  D.11277 = _wapi_shm_disabled.1 == 0;
  D.11275 = (gboolean) D.11277;
  return D.11275;
}


_wapi_shm_attach (_wapi_shm_t type)
{
  void * D.11279;
  int D.11280;
  long unsigned int D.11283;
  void * D.11284;
  int size.2;
  int D.11290;
  int * D.11293;
  int D.11294;
  const gchar * D.11295;
  long int D.11296;
  long unsigned int D.11297;
  const gchar * D.11302;
  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.11189>, case 0: <D.11186>, case 1: <D.11188>>
      <D.11186>:
      size = 86024;
      goto <D.11187>;
      <D.11188>:
      size = 4096008;
      goto <D.11187>;
      <D.11189>:
      monoeg_g_log (0B, 4, "Invalid type in _wapi_shm_attach ()");
      <D.11190>:
      goto <D.11190>;
      D.11279 = 0B;
      return D.11279;
      <D.11187>:
      D.11280 = _wapi_shm_enabled ();
      if (D.11280 == 0) goto <D.11281>; else goto <D.11282>;
      <D.11281>:
      D.11283 = (long unsigned int) size;
      D.11284 = monoeg_malloc0 (D.11283);
      wapi_storage[type] = D.11284;
      D.11279 = wapi_storage[type];
      return D.11279;
      <D.11282>:
      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.11286>; else goto <D.11287>;
      <D.11286>:
      fd = _wapi_shm_file_open (filename, size);
      <D.11287>:
      if (fd == -1) goto <D.11288>; else goto <D.11289>;
      <D.11288>:
      monoeg_g_log (0B, 8, "%s: shared file [%s] open error", &__func__, filename);
      D.11279 = 0B;
      return D.11279;
      <D.11289>:
      D.11290 = fstat (fd, &statbuf);
      if (D.11290 == -1) goto <D.11291>; else goto <D.11292>;
      <D.11291>:
      D.11293 = __errno_location ();
      D.11294 = *D.11293;
      D.11295 = monoeg_g_strerror (D.11294);
      monoeg_g_log (0B, 8, "%s: fstat error: %s", &__func__, D.11295);
      close (fd);
      D.11279 = 0B;
      return D.11279;
      <D.11292>:
      D.11296 = statbuf.st_size;
      D.11297 = (long unsigned int) D.11296;
      shm_seg = mmap (0B, D.11297, 3, 1, fd, 0);
      if (shm_seg == -1B) goto <D.11298>; else goto <D.11299>;
      <D.11298>:
      D.11296 = statbuf.st_size;
      D.11297 = (long unsigned int) D.11296;
      shm_seg = mmap (0B, D.11297, 3, 2, fd, 0);
      if (shm_seg == -1B) goto <D.11300>; else goto <D.11301>;
      <D.11300>:
      D.11293 = __errno_location ();
      D.11294 = *D.11293;
      D.11302 = monoeg_g_strerror (D.11294);
      monoeg_g_log (0B, 8, "%s: mmap error: %s", &__func__, D.11302);
      close (fd);
      D.11279 = 0B;
      return D.11279;
      <D.11301>:
      <D.11299>:
      close (fd);
      D.11279 = shm_seg;
      return D.11279;
    }
  finally
    {
      statbuf = {CLOBBER};
    }
}


_wapi_shm_file (_wapi_shm_t type)
{
  const gchar * D.11307;
  gchar * D.11309;
  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.11305>; else goto <D.11306>;
  <D.11305>:
  D.11307 = monoeg_g_get_home_dir ();
  filename = monoeg_g_build_path ("/", D.11307, ".wapi", name, 0B);
  goto <D.11308>;
  <D.11306>:
  filename = monoeg_g_build_path ("/", wapi_dir, ".wapi", name, 0B);
  <D.11308>:
  monoeg_g_free (name);
  monoeg_g_snprintf (&file, 256, "%s", filename);
  monoeg_g_free (filename);
  D.11309 = &file;
  return D.11309;
}


_wapi_shm_base_name (_wapi_shm_t type)
{
  int D.11316;
  int iftmp.3;
  long unsigned int D.11321;
  long unsigned int D.11324;
  long unsigned int D.11326;
  gchar * D.11328;
  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.11311>; else goto <D.11312>;
      <D.11311>:
      ubuf.machine[0] = 0;
      ubuf.sysname[0] = 0;
      goto <D.11313>;
      <D.11312>:
      monoeg_g_strdelimit (&ubuf.sysname, "/", 95);
      monoeg_g_strdelimit (&ubuf.machine, "/", 95);
      <D.11313>:
      fake_name = monoeg_g_getenv ("MONO_SHARED_HOSTNAME");
      if (fake_name == 0B) goto <D.11314>; else goto <D.11315>;
      <D.11314>:
      D.11316 = gethostname (&machine_name, 256);
      if (D.11316 != 0) goto <D.11317>; else goto <D.11318>;
      <D.11317>:
      machine_name[0] = 0;
      <D.11318>:
      goto <D.11319>;
      <D.11315>:
      D.11321 = strlen (fake_name);
      if (D.11321 <= 254) goto <D.11322>; else goto <D.11323>;
      <D.11322>:
      D.11324 = strlen (fake_name);
      iftmp.3 = (int) D.11324;
      goto <D.11325>;
      <D.11323>:
      iftmp.3 = 255;
      <D.11325>:
      len = iftmp.3;
      D.11326 = (long unsigned int) len;
      strncpy (&machine_name, fake_name, D.11326);
      machine_name[len] = 0;
      <D.11319>:
      switch (type) <default: <D.11327>, case 0: <D.11138>, case 1: <D.11140>>
      <D.11138>:
      name = monoeg_g_strdup_printf ("shared_data-%s-%s-%s-%d-%d-%d", &machine_name, &ubuf.sysname, &ubuf.machine, 336, 12, 0);
      goto <D.11139>;
      <D.11140>:
      name = monoeg_g_strdup_printf ("shared_fileshare-%s-%s-%s-%d-%d-%d", &machine_name, &ubuf.sysname, &ubuf.machine, 40, 12, 0);
      goto <D.11139>;
      <D.11327>:
      <D.11139>:
      D.11328 = name;
      return D.11328;
    }
  finally
    {
      machine_name = {CLOBBER};
      ubuf = {CLOBBER};
    }
}


gethostname (char * __buf, size_t __buflen)
{
  long unsigned int D.11331;
  int D.11334;
  int D.11337;
  long unsigned int D.11338;
  long unsigned int D.11339;
  long unsigned int D.11342;

  D.11331 = __builtin_object_size (__buf, 1);
  if (D.11331 != 18446744073709551615) goto <D.11332>; else goto <D.11333>;
  <D.11332>:
  D.11334 = __builtin_constant_p (__buflen);
  if (D.11334 == 0) goto <D.11335>; else goto <D.11336>;
  <D.11335>:
  D.11338 = __builtin_object_size (__buf, 1);
  D.11337 = __gethostname_chk (__buf, __buflen, D.11338);
  return D.11337;
  <D.11336>:
  D.11339 = __builtin_object_size (__buf, 1);
  if (D.11339 < __buflen) goto <D.11340>; else goto <D.11341>;
  <D.11340>:
  D.11342 = __builtin_object_size (__buf, 1);
  D.11337 = __gethostname_chk_warn (__buf, __buflen, D.11342);
  return D.11337;
  <D.11341>:
  <D.11333>:
  D.11337 = __gethostname_alias (__buf, __buflen);
  return D.11337;
}


strncpy (char * restrict __dest, const char * restrict __src, size_t __len)
{
  char * D.11344;
  long unsigned int D.11345;

  D.11345 = __builtin_object_size (__dest, 1);
  D.11344 = __builtin___strncpy_chk (__dest, __src, __len, D.11345);
  return D.11344;
}


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

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


_wapi_shm_open (const char * filename, int size)
{
  int D.11352;
  long int D.11353;
  int D.11354;
  int fd;

  fd = shm_open (filename, 66, 416);
  if (fd == -1) goto <D.11350>; else goto <D.11351>;
  <D.11350>:
  D.11352 = -1;
  return D.11352;
  <D.11351>:
  D.11353 = (long int) size;
  D.11354 = ftruncate (fd, D.11353);
  if (D.11354 != 0) goto <D.11355>; else goto <D.11356>;
  <D.11355>:
  perror ("_wapi_shm_open (): ftruncate ()");
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "shared.c", 245);
  <D.11356>:
  D.11352 = fd;
  return D.11352;
}


_wapi_shm_file_open (const gchar * filename, guint32 wanted_size)
{
  int tries.4;
  int D.11361;
  int * D.11367;
  int D.11368;
  const gchar * D.11375;
  unsigned int D.11376;
  long int D.11377;
  long int D.11378;
  const gchar * D.11381;
  long int D.11382;
  const gchar * D.11386;
  const gchar * D.11389;
  int D.11390;
  const gchar * D.11393;
  long int D.11396;
  long int D.11397;
  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.4 = tries;
      tries = tries.4 + 1;
      if (tries.4 > 10) goto <D.11359>; else goto <D.11360>;
      <D.11359>:
      D.11361 = -1;
      return D.11361;
      <D.11360>:
      if (tries > 5) goto <D.11362>; else goto <D.11363>;
      <D.11362>:
      unlink (filename);
      <D.11363>:
      oldmask = umask (54);
      fd = open (filename, 2, 384);
      umask (oldmask);
      if (fd == -1) goto <D.11366>; else goto <D.11364>;
      <D.11366>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      if (D.11368 == 2) goto <D.11369>; else goto <D.11364>;
      <D.11369>:
      oldmask = umask (54);
      fd = open (filename, 194, 384);
      umask (oldmask);
      if (fd == -1) goto <D.11372>; else goto <D.11370>;
      <D.11372>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      if (D.11368 == 17) goto try_again; else goto <D.11370>;
      goto <D.11371>;
      <D.11370>:
      if (fd == -1) goto <D.11373>; else goto <D.11374>;
      <D.11373>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      D.11375 = monoeg_g_strerror (D.11368);
      monoeg_g_log (0B, 8, "%s: shared file [%s] open error: %s", &__func__, filename, D.11375);
      D.11361 = -1;
      return D.11361;
      <D.11374>:
      D.11376 = wanted_size + 4294967295;
      D.11377 = (long int) D.11376;
      D.11378 = lseek (fd, D.11377, 0);
      if (D.11378 == -1) goto <D.11379>; else goto <D.11380>;
      <D.11379>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      D.11381 = monoeg_g_strerror (D.11368);
      monoeg_g_log (0B, 8, "%s: shared file [%s] lseek error: %s", &__func__, filename, D.11381);
      close (fd);
      unlink (filename);
      D.11361 = -1;
      return D.11361;
      <D.11380>:
      <D.11171>:
      D.11382 = write (fd, "", 1);
      ret = (int) D.11382;
      if (ret == -1) goto <D.11383>; else goto <D.11172>;
      <D.11383>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      if (D.11368 == 4) goto <D.11171>; else goto <D.11172>;
      <D.11172>:
      if (ret == -1) goto <D.11384>; else goto <D.11385>;
      <D.11384>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      D.11386 = monoeg_g_strerror (D.11368);
      monoeg_g_log (0B, 8, "%s: shared file [%s] write error: %s", &__func__, filename, D.11386);
      close (fd);
      unlink (filename);
      D.11361 = -1;
      return D.11361;
      <D.11385>:
      created = 1;
      <D.11371>:
      goto <D.11365>;
      <D.11364>:
      if (fd == -1) goto <D.11387>; else goto <D.11388>;
      <D.11387>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      D.11389 = monoeg_g_strerror (D.11368);
      monoeg_g_log (0B, 8, "%s: shared file [%s] open error: %s", &__func__, filename, D.11389);
      D.11361 = -1;
      return D.11361;
      <D.11388>:
      <D.11365>:
      D.11390 = fstat (fd, &statbuf);
      if (D.11390 == -1) goto <D.11391>; else goto <D.11392>;
      <D.11391>:
      D.11367 = __errno_location ();
      D.11368 = *D.11367;
      D.11393 = monoeg_g_strerror (D.11368);
      monoeg_g_log (0B, 8, "%s: fstat error: %s", &__func__, D.11393);
      if (created == 1) goto <D.11394>; else goto <D.11395>;
      <D.11394>:
      unlink (filename);
      <D.11395>:
      close (fd);
      D.11361 = -1;
      return D.11361;
      <D.11392>:
      D.11396 = statbuf.st_size;
      D.11397 = (long int) wanted_size;
      if (D.11396 < D.11397) goto <D.11398>; else goto <D.11399>;
      <D.11398>:
      close (fd);
      if (created == 1) goto <D.11400>; else goto <D.11401>;
      <D.11400>:
      D.11396 = statbuf.st_size;
      monoeg_g_log (0B, 8, "%s: shared file [%s] is not big enough! (found %ld, need %d bytes)", &__func__, filename, D.11396, wanted_size);
      unlink (filename);
      D.11361 = -1;
      return D.11361;
      <D.11401>:
      _wapi_handle_spin (100);
      goto try_again;
      <D.11399>:
      D.11361 = fd;
      return D.11361;
    }
  finally
    {
      statbuf = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.11404;
  int D.11407;
  int D.11412;
  int D.11414;
  int D.11415;
  int D.11418;
  int D.11419;

  D.11404 = __builtin_va_arg_pack_len ();
  if (D.11404 > 1) goto <D.11405>; else goto <D.11406>;
  <D.11405>:
  __open_too_many_args ();
  <D.11406>:
  D.11407 = __builtin_constant_p (__oflag);
  if (D.11407 != 0) goto <D.11408>; else goto <D.11409>;
  <D.11408>:
  D.11412 = __oflag & 64;
  if (D.11412 != 0) goto <D.11410>; else goto <D.11413>;
  <D.11413>:
  D.11414 = __oflag & 4259840;
  if (D.11414 == 4259840) goto <D.11410>; else goto <D.11411>;
  <D.11410>:
  D.11415 = __builtin_va_arg_pack_len ();
  if (D.11415 <= 0) goto <D.11416>; else goto <D.11417>;
  <D.11416>:
  __open_missing_mode ();
  D.11418 = __open_2 (__path, __oflag);
  return D.11418;
  <D.11417>:
  <D.11411>:
  D.11418 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.11418;
  <D.11409>:
  D.11419 = __builtin_va_arg_pack_len ();
  if (D.11419 <= 0) goto <D.11420>; else goto <D.11421>;
  <D.11420>:
  D.11418 = __open_2 (__path, __oflag);
  return D.11418;
  <D.11421>:
  D.11418 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.11418;
}


_wapi_handle_spin (guint32 ms)
{
  _Bool D.11423;
  long int D.11424;
  long int D.11425;
  unsigned int D.11428;
  long int D.11429;
  struct timespec sleepytime;

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


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

  D.11430 = __fxstat (1, __fd, __statbuf);
  return D.11430;
}


_wapi_shm_detach (_wapi_shm_t type)
{
  int D.11432;
  void * D.11435;

  D.11432 = _wapi_shm_enabled ();
  if (D.11432 == 0) goto <D.11433>; else goto <D.11434>;
  <D.11433>:
  D.11435 = wapi_storage[type];
  monoeg_g_free (D.11435);
  <D.11434>:
}


_wapi_shm_semaphores_init ()
{
  int D.11436;

  D.11436 = _wapi_shm_enabled ();
  if (D.11436 == 0) goto <D.11437>; else goto <D.11438>;
  <D.11437>:
  noshm_semaphores_init ();
  goto <D.11439>;
  <D.11438>:
  shm_semaphores_init ();
  <D.11439>:
}


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

  i = 0;
  goto <D.11115>;
  <D.11114>:
  D.11440 = &noshm_sems[i];
  pthread_mutex_init (D.11440, 0B);
  i = i + 1;
  <D.11115>:
  if (i <= 7) goto <D.11114>; else goto <D.11116>;
  <D.11116>:
}


shm_semaphores_init ()
{
  _Bool D.11441;
  long int D.11442;
  long int D.11443;
  _Bool D.11446;
  long int D.11447;
  long int D.11448;
  int * D.11453;
  int D.11454;
  const gchar * D.11457;
  const gchar * D.11460;
  const gchar * D.11465;
  int _wapi_sem_id.5;
  int _wapi_sem_id.6;
  int D.11468;
  const gchar * D.11473;
  volatile key_t * D.11474;
  int D.11475;
  int _wapi_sem_id.7;
  const gchar * D.11482;
  volatile key_t * D.11483;
  _Bool D.11484;
  long int D.11485;
  long int D.11486;
  int _wapi_shm_disabled.8;
  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.11213>;
      <D.11212>:
      def_vals[i] = 1;
      i = i + 1;
      <D.11213>:
      if (i <= 7) goto <D.11212>; else goto <D.11214>;
      <D.11214>:
      def_vals[7] = 0;
      defs.array = &def_vals;
      tmp_shared = _wapi_shm_attach (0);
      D.11441 = tmp_shared == 0B;
      D.11442 = (long int) D.11441;
      D.11443 = __builtin_expect (D.11442, 0);
      if (D.11443 != 0) goto <D.11444>; else goto <D.11445>;
      <D.11444>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 547, "tmp_shared != NULL");
      <D.11445>:
      ftmp = _wapi_shm_shm_name (0);
      filename = monoeg_g_build_path ("/", "/dev/shm", ftmp, 0B);
      D.11446 = filename == 0B;
      D.11447 = (long int) D.11446;
      D.11448 = __builtin_expect (D.11447, 0);
      if (D.11448 != 0) goto <D.11449>; else goto <D.11450>;
      <D.11449>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 552, "filename!=NULL");
      <D.11450>:
      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.11451>; else goto <D.11452>;
      <D.11451>:
      goto <D.11220>;
      <D.11219>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      if (D.11454 == 12) goto <D.11455>; else goto <D.11456>;
      <D.11455>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      D.11457 = monoeg_g_strerror (D.11454);
      monoeg_g_log (0B, 4, "%s: semget error: %s", &__func__, D.11457);
      <D.11217>:
      goto <D.11217>;
      <D.11456>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      if (D.11454 == 28) goto <D.11458>; else goto <D.11459>;
      <D.11458>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      D.11460 = monoeg_g_strerror (D.11454);
      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.11460);
      <D.11218>:
      goto <D.11218>;
      <D.11459>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      if (D.11454 != 17) goto <D.11461>; else goto <D.11462>;
      <D.11461>:
      if (retries > 3) goto <D.11463>; else goto <D.11464>;
      <D.11463>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      D.11465 = monoeg_g_strerror (D.11454);
      monoeg_g_log (0B, 16, "%s: semget error: %s key 0x%x - trying again", &__func__, D.11465, key);
      <D.11464>:
      <D.11462>:
      key = key + 1;
      <D.11220>:
      _wapi_sem_id.5 = semget (key, 8, 1920);
      _wapi_sem_id = _wapi_sem_id.5;
      _wapi_sem_id.6 = _wapi_sem_id;
      if (_wapi_sem_id.6 == -1) goto <D.11219>; else goto <D.11221>;
      <D.11221>:
      _wapi_sem_id.6 = _wapi_sem_id;
      D.11468 = semctl (_wapi_sem_id.6, 0, 17, defs);
      if (D.11468 == -1) goto <D.11469>; else goto <D.11470>;
      <D.11469>:
      if (retries > 3) goto <D.11471>; else goto <D.11472>;
      <D.11471>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      D.11473 = monoeg_g_strerror (D.11454);
      monoeg_g_log (0B, 16, "%s: semctl init error: %s - trying again", &__func__, D.11473);
      <D.11472>:
      _wapi_sem_id.6 = _wapi_sem_id;
      semctl (_wapi_sem_id.6, 0, 0);
      goto again;
      <D.11470>:
      D.11474 = &tmp_shared->sem_key;
      D.11475 = InterlockedCompareExchange (D.11474, key, 0);
      if (D.11475 != 0) goto <D.11476>; else goto done;
      <D.11476>:
      _wapi_sem_id.6 = _wapi_sem_id;
      semctl (_wapi_sem_id.6, 0, 0);
      oldkey = tmp_shared->sem_key;
      <D.11452>:
      _wapi_sem_id.7 = semget (oldkey, 8, 384);
      _wapi_sem_id = _wapi_sem_id.7;
      _wapi_sem_id.6 = _wapi_sem_id;
      if (_wapi_sem_id.6 == -1) goto <D.11478>; else goto <D.11479>;
      <D.11478>:
      if (retries > 3) goto <D.11480>; else goto <D.11481>;
      <D.11480>:
      D.11453 = __errno_location ();
      D.11454 = *D.11453;
      D.11482 = monoeg_g_strerror (D.11454);
      monoeg_g_log (0B, 16, "%s: semget error opening old key 0x%x (%s) - trying again", &__func__, oldkey, D.11482);
      <D.11481>:
      D.11483 = &tmp_shared->sem_key;
      InterlockedCompareExchange (D.11483, 0, oldkey);
      goto again;
      <D.11479>:
      done:
      thr_ret = _wapi_shm_sem_lock (6);
      D.11484 = thr_ret != 0;
      D.11485 = (long int) D.11484;
      D.11486 = __builtin_expect (D.11485, 0);
      if (D.11486 != 0) goto <D.11487>; else goto <D.11488>;
      <D.11487>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 645, "thr_ret == 0");
      <D.11488>:
      _wapi_shm_sem_unlock (7);
      _wapi_shm_sem_unlock (6);
      _wapi_shm_disabled.8 = _wapi_shm_disabled;
      if (_wapi_shm_disabled.8 != 0) goto <D.11490>; else goto <D.11491>;
      <D.11490>:
      monoeg_g_free (tmp_shared);
      goto <D.11492>;
      <D.11491>:
      munmap (tmp_shared, 86024);
      <D.11492>:
    }
  finally
    {
      defs = {CLOBBER};
      def_vals = {CLOBBER};
    }
}


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

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


_wapi_shm_semaphores_remove ()
{
  int _wapi_shm_disabled.11;

  _wapi_shm_disabled.11 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.11 == 0) goto <D.11499>; else goto <D.11500>;
  <D.11499>:
  shm_semaphores_remove ();
  <D.11500>:
}


shm_semaphores_remove ()
{
  _Bool D.11501;
  long int D.11502;
  long int D.11503;
  int _wapi_sem_id.12;
  _Bool D.11507;
  long int D.11508;
  long int D.11509;
  gchar * D.11514;
  gchar * D.11515;
  int thr_ret;
  int proc_count;
  gchar * shm_name;

  thr_ret = _wapi_shm_sem_lock (6);
  D.11501 = thr_ret != 0;
  D.11502 = (long int) D.11501;
  D.11503 = __builtin_expect (D.11502, 0);
  if (D.11503 != 0) goto <D.11504>; else goto <D.11505>;
  <D.11504>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 678, "thr_ret == 0");
  <D.11505>:
  _wapi_sem_id.12 = _wapi_sem_id;
  proc_count = semctl (_wapi_sem_id.12, 7, 12);
  D.11507 = proc_count <= 0;
  D.11508 = (long int) D.11507;
  D.11509 = __builtin_expect (D.11508, 0);
  if (D.11509 != 0) goto <D.11510>; else goto <D.11511>;
  <D.11510>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "shared.c", 683, "proc_count > 0");
  <D.11511>:
  if (proc_count == 1) goto <D.11512>; else goto <D.11513>;
  <D.11512>:
  _wapi_sem_id.12 = _wapi_sem_id;
  semctl (_wapi_sem_id.12, 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.11514 = _wapi_shm_file (0);
  unlink (D.11514);
  D.11515 = _wapi_shm_file (1);
  unlink (D.11515);
  goto <D.11516>;
  <D.11513>:
  _wapi_shm_sem_unlock (6);
  <D.11516>:
}


_wapi_shm_sem_lock (int sem)
{
  int _wapi_shm_disabled.13;
  int D.11520;

  _wapi_shm_disabled.13 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.13 != 0) goto <D.11518>; else goto <D.11519>;
  <D.11518>:
  D.11520 = noshm_sem_lock (sem);
  return D.11520;
  <D.11519>:
  D.11520 = shm_sem_lock (sem);
  return D.11520;
}


noshm_sem_lock (int sem)
{
  union mono_mutex_t * D.11522;
  int D.11523;
  int ret;

  D.11522 = &noshm_sems[sem];
  ret = pthread_mutex_lock (D.11522);
  D.11523 = ret;
  return D.11523;
}


shm_sem_lock (int sem)
{
  short unsigned int D.11525;
  int _wapi_sem_id.14;
  int * D.11528;
  int D.11529;
  int D.11535;
  struct sembuf ops;
  int ret;
  void retry = <<< error >>>;

  try
    {
      D.11525 = (short unsigned int) sem;
      ops.sem_num = D.11525;
      ops.sem_op = -1;
      ops.sem_flg = 4096;
      retry:
      <D.11235>:
      _wapi_sem_id.14 = _wapi_sem_id;
      ret = semop (_wapi_sem_id.14, &ops, 1);
      if (ret == -1) goto <D.11527>; else goto <D.11236>;
      <D.11527>:
      D.11528 = __errno_location ();
      D.11529 = *D.11528;
      if (D.11529 == 4) goto <D.11235>; else goto <D.11236>;
      <D.11236>:
      if (ret == -1) goto <D.11530>; else goto <D.11531>;
      <D.11530>:
      D.11528 = __errno_location ();
      D.11529 = *D.11528;
      if (D.11529 == 43) goto <D.11532>; else goto <D.11534>;
      <D.11534>:
      D.11528 = __errno_location ();
      D.11529 = *D.11528;
      if (D.11529 == 22) goto <D.11532>; else goto <D.11533>;
      <D.11532>:
      _wapi_shm_semaphores_init ();
      goto retry;
      <D.11533>:
      D.11528 = __errno_location ();
      ret = *D.11528;
      <D.11531>:
      D.11535 = ret;
      return D.11535;
    }
  finally
    {
      ops = {CLOBBER};
    }
}


_wapi_shm_sem_trylock (int sem)
{
  int _wapi_shm_disabled.15;
  int D.11541;

  _wapi_shm_disabled.15 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.15 != 0) goto <D.11539>; else goto <D.11540>;
  <D.11539>:
  D.11541 = noshm_sem_trylock (sem);
  return D.11541;
  <D.11540>:
  D.11541 = shm_sem_trylock (sem);
  return D.11541;
}


noshm_sem_trylock (int sem)
{
  union mono_mutex_t * D.11543;
  int D.11544;
  int ret;

  D.11543 = &noshm_sems[sem];
  ret = pthread_mutex_trylock (D.11543);
  D.11544 = ret;
  return D.11544;
}


shm_sem_trylock (int sem)
{
  short unsigned int D.11546;
  int _wapi_sem_id.16;
  int * D.11549;
  int D.11550;
  int D.11558;
  struct sembuf ops;
  int ret;
  void retry = <<< error >>>;

  try
    {
      D.11546 = (short unsigned int) sem;
      ops.sem_num = D.11546;
      ops.sem_op = -1;
      ops.sem_flg = 6144;
      retry:
      <D.11243>:
      _wapi_sem_id.16 = _wapi_sem_id;
      ret = semop (_wapi_sem_id.16, &ops, 1);
      if (ret == -1) goto <D.11548>; else goto <D.11244>;
      <D.11548>:
      D.11549 = __errno_location ();
      D.11550 = *D.11549;
      if (D.11550 == 4) goto <D.11243>; else goto <D.11244>;
      <D.11244>:
      if (ret == -1) goto <D.11551>; else goto <D.11552>;
      <D.11551>:
      D.11549 = __errno_location ();
      D.11550 = *D.11549;
      if (D.11550 == 43) goto <D.11553>; else goto <D.11555>;
      <D.11555>:
      D.11549 = __errno_location ();
      D.11550 = *D.11549;
      if (D.11550 == 22) goto <D.11553>; else goto <D.11554>;
      <D.11553>:
      _wapi_shm_semaphores_init ();
      goto retry;
      <D.11554>:
      D.11549 = __errno_location ();
      ret = *D.11549;
      <D.11552>:
      if (ret == 11) goto <D.11556>; else goto <D.11557>;
      <D.11556>:
      ret = 16;
      <D.11557>:
      D.11558 = ret;
      return D.11558;
    }
  finally
    {
      ops = {CLOBBER};
    }
}


_wapi_shm_sem_unlock (int sem)
{
  int _wapi_shm_disabled.17;
  int D.11564;

  _wapi_shm_disabled.17 = _wapi_shm_disabled;
  if (_wapi_shm_disabled.17 != 0) goto <D.11562>; else goto <D.11563>;
  <D.11562>:
  D.11564 = noshm_sem_unlock (sem);
  return D.11564;
  <D.11563>:
  D.11564 = shm_sem_unlock (sem);
  return D.11564;
}


noshm_sem_unlock (int sem)
{
  union mono_mutex_t * D.11566;
  int D.11567;
  int ret;

  D.11566 = &noshm_sems[sem];
  ret = pthread_mutex_unlock (D.11566);
  D.11567 = ret;
  return D.11567;
}


shm_sem_unlock (int sem)
{
  short unsigned int D.11569;
  int _wapi_sem_id.18;
  int * D.11572;
  int D.11573;
  int D.11579;
  struct sembuf ops;
  int ret;
  void retry = <<< error >>>;

  try
    {
      D.11569 = (short unsigned int) sem;
      ops.sem_num = D.11569;
      ops.sem_op = 1;
      ops.sem_flg = 4096;
      retry:
      <D.11251>:
      _wapi_sem_id.18 = _wapi_sem_id;
      ret = semop (_wapi_sem_id.18, &ops, 1);
      if (ret == -1) goto <D.11571>; else goto <D.11252>;
      <D.11571>:
      D.11572 = __errno_location ();
      D.11573 = *D.11572;
      if (D.11573 == 4) goto <D.11251>; else goto <D.11252>;
      <D.11252>:
      if (ret == -1) goto <D.11574>; else goto <D.11575>;
      <D.11574>:
      D.11572 = __errno_location ();
      D.11573 = *D.11572;
      if (D.11573 == 43) goto <D.11576>; else goto <D.11578>;
      <D.11578>:
      D.11572 = __errno_location ();
      D.11573 = *D.11572;
      if (D.11573 == 22) goto <D.11576>; else goto <D.11577>;
      <D.11576>:
      _wapi_shm_semaphores_init ();
      goto retry;
      <D.11577>:
      D.11572 = __errno_location ();
      ret = *D.11572;
      <D.11575>:
      D.11579 = ret;
      return D.11579;
    }
  finally
    {
      ops = {CLOBBER};
    }
}


