mutex_is_owned (void * handle)
{
  gboolean D.10978;
  struct _WapiHandle_mutex * mutex_handle.0;
  unsigned int D.10981;
  int D.10983;
  int D.10984;
  long unsigned int D.10986;
  long unsigned int D.10987;
  int D.10988;
  struct _WapiHandle_mutex * mutex_handle;
  gboolean ok;
  static const char __func__[15] = "mutex_is_owned";

  try
    {
      ok = _wapi_lookup_handle (handle, 5, &mutex_handle);
      if (ok == 0) goto <D.10976>; else goto <D.10977>;
      <D.10976>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.10978 = 0;
      return D.10978;
      <D.10977>:
      mutex_handle.0 = mutex_handle;
      D.10981 = mutex_handle.0->recursion;
      if (D.10981 != 0) goto <D.10982>; else goto <D.10979>;
      <D.10982>:
      mutex_handle.0 = mutex_handle;
      D.10983 = mutex_handle.0->pid;
      D.10984 = _wapi_getpid ();
      if (D.10983 == D.10984) goto <D.10985>; else goto <D.10979>;
      <D.10985>:
      mutex_handle.0 = mutex_handle;
      D.10986 = mutex_handle.0->tid;
      D.10987 = pthread_self ();
      D.10988 = pthread_equal (D.10986, D.10987);
      if (D.10988 != 0) goto <D.10989>; else goto <D.10979>;
      <D.10989>:
      D.10978 = 1;
      return D.10978;
      <D.10979>:
      D.10978 = 0;
      return D.10978;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


pthread_equal (pthread_t __thread1, pthread_t __thread2)
{
  int D.10992;
  _Bool D.10993;

  D.10993 = __thread1 == __thread2;
  D.10992 = (int) D.10993;
  return D.10992;
}


mutex_own (void * handle)
{
  gboolean D.10997;
  struct _WapiHandle_mutex * mutex_handle.1;
  int D.10999;
  long unsigned int D.11000;
  unsigned int D.11001;
  unsigned int D.11002;
  struct _WapiHandle_mutex * mutex_handle;
  gboolean ok;
  static const char __func__[10] = "mutex_own";

  try
    {
      ok = _wapi_lookup_handle (handle, 5, &mutex_handle);
      if (ok == 0) goto <D.10995>; else goto <D.10996>;
      <D.10995>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.10997 = 0;
      return D.10997;
      <D.10996>:
      _wapi_thread_own_mutex (handle);
      _wapi_handle_set_signal_state (handle, 0, 0);
      mutex_handle.1 = mutex_handle;
      D.10999 = _wapi_getpid ();
      mutex_handle.1->pid = D.10999;
      mutex_handle.1 = mutex_handle;
      D.11000 = pthread_self ();
      mutex_handle.1->tid = D.11000;
      mutex_handle.1 = mutex_handle;
      D.11001 = mutex_handle.1->recursion;
      D.11002 = D.11001 + 1;
      mutex_handle.1->recursion = D.11002;
      D.10997 = 1;
      return D.10997;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


_wapi_handle_set_signal_state (void * handle, gboolean state, gboolean broadcast)
{
  long int handle.2;
  int iftmp.3;
  <unnamed type> D.11012;
  <unnamed type> D.11014;
  <unnamed type> D.11016;
  <unnamed type> D.11018;
  _Bool D.11019;
  long int D.11020;
  long int D.11021;
  unsigned int D.11024;
  struct _WapiHandleUnshared * D.11025;
  long unsigned int D.11026;
  long unsigned int D.11027;
  long unsigned int D.11028;
  long int D.11031;
  long int D.11032;
  union mono_mutex_t * _wapi_global_signal_mutex.4;
  _Bool D.11038;
  long int D.11039;
  long int D.11040;
  union pthread_cond_t * D.11045;
  union pthread_cond_t * _wapi_global_signal_cond.5;
  guint32 idx;
  struct _WapiHandleUnshared * handle_data;
  int thr_ret;

  handle.2 = (long int) handle;
  idx = (guint32) handle.2;
  if (idx > 4194303) goto <D.11006>; else goto <D.11007>;
  <D.11006>:
  return;
  <D.11007>:
  D.11012 = _wapi_handle_type (handle);
  if (D.11012 == 9) goto <D.11009>; else goto <D.11013>;
  <D.11013>:
  D.11014 = _wapi_handle_type (handle);
  if (D.11014 == 11) goto <D.11009>; else goto <D.11015>;
  <D.11015>:
  D.11016 = _wapi_handle_type (handle);
  if (D.11016 == 12) goto <D.11009>; else goto <D.11017>;
  <D.11017>:
  D.11018 = _wapi_handle_type (handle);
  if (D.11018 == 13) goto <D.11009>; else goto <D.11010>;
  <D.11009>:
  iftmp.3 = 1;
  goto <D.11011>;
  <D.11010>:
  iftmp.3 = 0;
  <D.11011>:
  D.11019 = iftmp.3 != 0;
  D.11020 = (long int) D.11019;
  D.11021 = __builtin_expect (D.11020, 0);
  if (D.11021 != 0) goto <D.11022>; else goto <D.11023>;
  <D.11022>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 132, "!_WAPI_SHARED_HANDLE(_wapi_handle_type (handle))");
  <D.11023>:
  D.11024 = idx / 256;
  D.11025 = _wapi_private_handles[D.11024];
  D.11026 = (long unsigned int) idx;
  D.11027 = D.11026 & 255;
  D.11028 = D.11027 * 200;
  handle_data = D.11025 + D.11028;
  if (state == 1) goto <D.11029>; else goto <D.11030>;
  <D.11029>:
  {
    struct __pthread_unwind_buf_t __cancel_buf;
    void (*<Tbf>) (void *) __cancel_routine;
    void * __cancel_arg;
    int __not_first_call;

    try
      {
        __cancel_routine = mono_mutex_unlock_in_cleanup;
        __cancel_arg = _wapi_global_signal_mutex;
        __not_first_call = __sigsetjmp (&__cancel_buf.__cancel_jmp_buf, 0);
        D.11031 = (long int) __not_first_call;
        D.11032 = __builtin_expect (D.11031, 0);
        if (D.11032 != 0) goto <D.11033>; else goto <D.11034>;
        <D.11033>:
        __cancel_routine (__cancel_arg);
        __pthread_unwind_next (&__cancel_buf);
        <D.11034>:
        __pthread_register_cancel (&__cancel_buf);
        _wapi_global_signal_mutex.4 = _wapi_global_signal_mutex;
        thr_ret = pthread_mutex_lock (_wapi_global_signal_mutex.4);
        if (thr_ret != 0) goto <D.11036>; else goto <D.11037>;
        <D.11036>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d for global signal mutex", thr_ret);
        <D.11037>:
        D.11038 = thr_ret != 0;
        D.11039 = (long int) D.11038;
        D.11040 = __builtin_expect (D.11039, 0);
        if (D.11040 != 0) goto <D.11041>; else goto <D.11042>;
        <D.11041>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 151, "thr_ret == 0");
        <D.11042>:
        handle_data->signalled = state;
        if (broadcast == 1) goto <D.11043>; else goto <D.11044>;
        <D.11043>:
        D.11045 = &handle_data->signal_cond;
        thr_ret = pthread_cond_broadcast (D.11045);
        if (thr_ret != 0) goto <D.11046>; else goto <D.11047>;
        <D.11046>:
        monoeg_g_log (0B, 16, "Bad call to pthread_cond_broadcast result %d for handle %p", thr_ret, handle);
        <D.11047>:
        D.11038 = thr_ret != 0;
        D.11039 = (long int) D.11038;
        D.11040 = __builtin_expect (D.11039, 0);
        if (D.11040 != 0) goto <D.11048>; else goto <D.11049>;
        <D.11048>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 162, "thr_ret == 0");
        <D.11049>:
        goto <D.11050>;
        <D.11044>:
        D.11045 = &handle_data->signal_cond;
        thr_ret = pthread_cond_signal (D.11045);
        if (thr_ret != 0) goto <D.11051>; else goto <D.11052>;
        <D.11051>:
        monoeg_g_log (0B, 16, "Bad call to pthread_cond_signal result %d for handle %p", thr_ret, handle);
        <D.11052>:
        D.11038 = thr_ret != 0;
        D.11039 = (long int) D.11038;
        D.11040 = __builtin_expect (D.11039, 0);
        if (D.11040 != 0) goto <D.11053>; else goto <D.11054>;
        <D.11053>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 167, "thr_ret == 0");
        <D.11054>:
        <D.11050>:
        _wapi_global_signal_cond.5 = _wapi_global_signal_cond;
        thr_ret = pthread_cond_broadcast (_wapi_global_signal_cond.5);
        if (thr_ret != 0) goto <D.11056>; else goto <D.11057>;
        <D.11056>:
        monoeg_g_log (0B, 16, "Bad call to pthread_cond_broadcast result %d for handle %p", thr_ret, handle);
        <D.11057>:
        D.11038 = thr_ret != 0;
        D.11039 = (long int) D.11038;
        D.11040 = __builtin_expect (D.11039, 0);
        if (D.11040 != 0) goto <D.11058>; else goto <D.11059>;
        <D.11058>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 176, "thr_ret == 0");
        <D.11059>:
        _wapi_global_signal_mutex.4 = _wapi_global_signal_mutex;
        thr_ret = pthread_mutex_unlock (_wapi_global_signal_mutex.4);
        if (thr_ret != 0) goto <D.11060>; else goto <D.11061>;
        <D.11060>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d for global signal mutex", thr_ret);
        <D.11061>:
        D.11038 = thr_ret != 0;
        D.11039 = (long int) D.11038;
        D.11040 = __builtin_expect (D.11039, 0);
        if (D.11040 != 0) goto <D.11062>; else goto <D.11063>;
        <D.11062>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 181, "thr_ret == 0");
        <D.11063>:
        __pthread_unregister_cancel (&__cancel_buf);
        if (0 != 0) goto <D.11064>; else goto <D.11065>;
        <D.11064>:
        __cancel_routine (__cancel_arg);
        <D.11065>:
      }
    finally
      {
        __cancel_buf = {CLOBBER};
      }
  }
  goto <D.11066>;
  <D.11030>:
  handle_data->signalled = state;
  <D.11066>:
}


mono_mutex_unlock_in_cleanup (union mono_mutex_t * mutex)
{
  int D.11077;

  D.11077 = pthread_mutex_unlock (mutex);
  return D.11077;
}


_wapi_handle_type (void * handle)
{
  long int handle.6;
  unsigned int D.11084;
  struct _WapiHandleUnshared * D.11085;
  WapiHandleType D.11086;
  unsigned int D.11087;
  struct _WapiHandleUnshared * D.11088;
  long unsigned int D.11089;
  long unsigned int D.11090;
  long unsigned int D.11091;
  struct _WapiHandleUnshared * D.11092;
  guint32 idx;

  handle.6 = (long int) handle;
  idx = (guint32) handle.6;
  if (idx > 4194303) goto <D.11080>; else goto <D.11082>;
  <D.11082>:
  if (idx > 268435455) goto <D.11080>; else goto <D.11083>;
  <D.11083>:
  D.11084 = idx / 256;
  D.11085 = _wapi_private_handles[D.11084];
  if (D.11085 == 0B) goto <D.11080>; else goto <D.11081>;
  <D.11080>:
  D.11086 = 0;
  return D.11086;
  <D.11081>:
  D.11087 = idx / 256;
  D.11088 = _wapi_private_handles[D.11087];
  D.11089 = (long unsigned int) idx;
  D.11090 = D.11089 & 255;
  D.11091 = D.11090 * 200;
  D.11092 = D.11088 + D.11091;
  D.11086 = D.11092->type;
  return D.11086;
}


mutex_signal (void * handle)
{
  ReleaseMutex (handle);
}


_wapi_mutex_details (void * handle_info)
{
  int D.11094;
  long unsigned int D.11095;
  unsigned int D.11096;
  struct _WapiHandle_mutex * mut;

  mut = handle_info;
  D.11094 = mut->pid;
  D.11095 = mut->tid;
  D.11096 = mut->recursion;
  monoeg_g_print ("own: %5d:%5ld, count: %5u", D.11094, D.11095, D.11096);
}


namedmutex_prewait (void * handle)
{
  struct _WapiHandle_namedmutex * namedmutex_handle.7;
  unsigned int D.11100;
  int D.11104;
  int D.11105;
  unsigned int D.11109;
  _Bool D.11112;
  long int D.11113;
  long int D.11114;
  struct _WapiHandle_namedmutex * namedmutex_handle;
  gboolean ok;
  static const char __func__[19] = "namedmutex_prewait";

  try
    {
      ok = _wapi_lookup_handle (handle, 11, &namedmutex_handle);
      if (ok == 0) goto <D.11097>; else goto <D.11098>;
      <D.11097>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      return;
      <D.11098>:
      namedmutex_handle.7 = namedmutex_handle;
      D.11100 = namedmutex_handle.7->recursion;
      if (D.11100 == 0) goto <D.11101>; else goto <D.11102>;
      <D.11101>:
      goto <D.11103>;
      <D.11102>:
      namedmutex_handle.7 = namedmutex_handle;
      D.11104 = namedmutex_handle.7->pid;
      D.11105 = _wapi_getpid ();
      if (D.11104 == D.11105) goto <D.11106>; else goto <D.11107>;
      <D.11106>:
      goto <D.11108>;
      <D.11107>:
      {
        int thr_ret;
        void * proc_handle;

        namedmutex_handle.7 = namedmutex_handle;
        D.11104 = namedmutex_handle.7->pid;
        D.11109 = (unsigned int) D.11104;
        proc_handle = OpenProcess (0, 0, D.11109);
        if (proc_handle == 0B) goto <D.11110>; else goto <D.11111>;
        <D.11110>:
        thr_ret = _wapi_handle_lock_shared_handles ();
        D.11112 = thr_ret != 0;
        D.11113 = (long int) D.11112;
        D.11114 = __builtin_expect (D.11113, 0);
        if (D.11114 != 0) goto <D.11115>; else goto <D.11116>;
        <D.11115>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 274, "thr_ret == 0");
        <D.11116>:
        namedmutex_handle.7 = namedmutex_handle;
        namedmutex_handle.7->pid = 0;
        namedmutex_handle.7 = namedmutex_handle;
        namedmutex_handle.7->tid = 0;
        namedmutex_handle.7 = namedmutex_handle;
        namedmutex_handle.7->recursion = 0;
        _wapi_shared_handle_set_signal_state (handle, 1);
        _wapi_handle_unlock_shared_handles ();
        goto <D.11117>;
        <D.11111>:
        <D.11117>:
        if (proc_handle != 0B) goto <D.11118>; else goto <D.11119>;
        <D.11118>:
        CloseProcess (proc_handle);
        <D.11119>:
      }
      <D.11108>:
      <D.11103>:
    }
  finally
    {
      namedmutex_handle = {CLOBBER};
    }
}


_wapi_handle_lock_shared_handles ()
{
  int D.11123;

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


_wapi_shared_handle_set_signal_state (void * handle, gboolean state)
{
  long int handle.8;
  int iftmp.9;
  <unnamed type> D.11131;
  <unnamed type> D.11133;
  <unnamed type> D.11135;
  <unnamed type> D.11137;
  _Bool D.11139;
  long int D.11140;
  long int D.11141;
  unsigned int D.11144;
  struct _WapiHandleUnshared * D.11145;
  long unsigned int D.11146;
  long unsigned int D.11147;
  long unsigned int D.11148;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.10;
  unsigned int D.11150;
  guint32 idx;
  struct _WapiHandleUnshared * handle_data;
  struct _WapiHandle_shared_ref * ref;
  struct _WapiHandleShared * shared_data;

  handle.8 = (long int) handle;
  idx = (guint32) handle.8;
  if (idx > 4194303) goto <D.11126>; else goto <D.11127>;
  <D.11126>:
  return;
  <D.11127>:
  D.11131 = _wapi_handle_type (handle);
  if (D.11131 != 9) goto <D.11132>; else goto <D.11129>;
  <D.11132>:
  D.11133 = _wapi_handle_type (handle);
  if (D.11133 != 11) goto <D.11134>; else goto <D.11129>;
  <D.11134>:
  D.11135 = _wapi_handle_type (handle);
  if (D.11135 != 12) goto <D.11136>; else goto <D.11129>;
  <D.11136>:
  D.11137 = _wapi_handle_type (handle);
  if (D.11137 != 13) goto <D.11138>; else goto <D.11129>;
  <D.11138>:
  iftmp.9 = 1;
  goto <D.11130>;
  <D.11129>:
  iftmp.9 = 0;
  <D.11130>:
  D.11139 = iftmp.9 != 0;
  D.11140 = (long int) D.11139;
  D.11141 = __builtin_expect (D.11140, 0);
  if (D.11141 != 0) goto <D.11142>; else goto <D.11143>;
  <D.11142>:
  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.11143>:
  D.11144 = idx / 256;
  D.11145 = _wapi_private_handles[D.11144];
  D.11146 = (long unsigned int) idx;
  D.11147 = D.11146 & 255;
  D.11148 = D.11147 * 200;
  handle_data = D.11145 + D.11148;
  ref = &handle_data->u.shared;
  _wapi_shared_layout.10 = _wapi_shared_layout;
  D.11150 = ref->offset;
  shared_data = &_wapi_shared_layout.10->handles[D.11150];
  shared_data->signalled = state;
}


_wapi_handle_unlock_shared_handles ()
{
  int D.11152;

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


namedmutex_is_owned (void * handle)
{
  gboolean D.11156;
  struct _WapiHandle_namedmutex * namedmutex_handle.11;
  unsigned int D.11159;
  int D.11161;
  int D.11162;
  long unsigned int D.11164;
  long unsigned int D.11165;
  int D.11166;
  struct _WapiHandle_namedmutex * namedmutex_handle;
  gboolean ok;
  static const char __func__[20] = "namedmutex_is_owned";

  try
    {
      ok = _wapi_lookup_handle (handle, 11, &namedmutex_handle);
      if (ok == 0) goto <D.11154>; else goto <D.11155>;
      <D.11154>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.11156 = 0;
      return D.11156;
      <D.11155>:
      namedmutex_handle.11 = namedmutex_handle;
      D.11159 = namedmutex_handle.11->recursion;
      if (D.11159 != 0) goto <D.11160>; else goto <D.11157>;
      <D.11160>:
      namedmutex_handle.11 = namedmutex_handle;
      D.11161 = namedmutex_handle.11->pid;
      D.11162 = _wapi_getpid ();
      if (D.11161 == D.11162) goto <D.11163>; else goto <D.11157>;
      <D.11163>:
      namedmutex_handle.11 = namedmutex_handle;
      D.11164 = namedmutex_handle.11->tid;
      D.11165 = pthread_self ();
      D.11166 = pthread_equal (D.11164, D.11165);
      if (D.11166 != 0) goto <D.11167>; else goto <D.11157>;
      <D.11167>:
      D.11156 = 1;
      return D.11156;
      <D.11157>:
      D.11156 = 0;
      return D.11156;
    }
  finally
    {
      namedmutex_handle = {CLOBBER};
    }
}


namedmutex_own (void * handle)
{
  gboolean D.11172;
  struct _WapiHandle_namedmutex * namedmutex_handle.12;
  int D.11174;
  long unsigned int D.11175;
  unsigned int D.11176;
  unsigned int D.11177;
  struct _WapiHandle_namedmutex * namedmutex_handle;
  gboolean ok;
  static const char __func__[15] = "namedmutex_own";

  try
    {
      ok = _wapi_lookup_handle (handle, 11, &namedmutex_handle);
      if (ok == 0) goto <D.11170>; else goto <D.11171>;
      <D.11170>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      D.11172 = 0;
      return D.11172;
      <D.11171>:
      _wapi_thread_own_mutex (handle);
      namedmutex_handle.12 = namedmutex_handle;
      D.11174 = _wapi_getpid ();
      namedmutex_handle.12->pid = D.11174;
      namedmutex_handle.12 = namedmutex_handle;
      D.11175 = pthread_self ();
      namedmutex_handle.12->tid = D.11175;
      namedmutex_handle.12 = namedmutex_handle;
      D.11176 = namedmutex_handle.12->recursion;
      D.11177 = D.11176 + 1;
      namedmutex_handle.12->recursion = D.11177;
      _wapi_shared_handle_set_signal_state (handle, 0);
      D.11172 = 1;
      return D.11172;
    }
  finally
    {
      namedmutex_handle = {CLOBBER};
    }
}


namedmutex_signal (void * handle)
{
  ReleaseMutex (handle);
}


_wapi_mutex_abandon (void * data, pid_t pid, pthread_t tid)
{
  WapiHandleType type;

  type = _wapi_handle_type (data);
  if (type == 5) goto <D.11180>; else goto <D.11181>;
  <D.11180>:
  mutex_abandon (data, pid, tid);
  goto <D.11182>;
  <D.11181>:
  if (type == 11) goto <D.11183>; else goto <D.11184>;
  <D.11183>:
  namedmutex_abandon (data, pid, tid);
  goto <D.11185>;
  <D.11184>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "mutexes.c", 369);
  <D.11185>:
  <D.11182>:
}


mutex_abandon (void * handle, pid_t pid, pthread_t tid)
{
  long int D.11188;
  long int D.11189;
  _Bool D.11192;
  long int D.11193;
  long int D.11194;
  struct _WapiHandle_mutex * mutex_handle.13;
  int D.11198;
  long unsigned int D.11201;
  int D.11202;
  struct _WapiHandle_mutex * mutex_handle;
  gboolean ok;
  int thr_ret;
  static const char __func__[14] = "mutex_abandon";

  try
    {
      ok = _wapi_lookup_handle (handle, 5, &mutex_handle);
      if (ok == 0) goto <D.11186>; else goto <D.11187>;
      <D.11186>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      return;
      <D.11187>:
      {
        struct __pthread_unwind_buf_t __cancel_buf;
        void (*<Tbf>) (void *) __cancel_routine;
        void * __cancel_arg;
        int __not_first_call;

        try
          {
            __cancel_routine = _wapi_handle_unlock_handle;
            __cancel_arg = handle;
            __not_first_call = __sigsetjmp (&__cancel_buf.__cancel_jmp_buf, 0);
            D.11188 = (long int) __not_first_call;
            D.11189 = __builtin_expect (D.11188, 0);
            if (D.11189 != 0) goto <D.11190>; else goto <D.11191>;
            <D.11190>:
            __cancel_routine (__cancel_arg);
            __pthread_unwind_next (&__cancel_buf);
            <D.11191>:
            __pthread_register_cancel (&__cancel_buf);
            thr_ret = _wapi_handle_lock_handle (handle);
            D.11192 = thr_ret != 0;
            D.11193 = (long int) D.11192;
            D.11194 = __builtin_expect (D.11193, 0);
            if (D.11194 != 0) goto <D.11195>; else goto <D.11196>;
            <D.11195>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 307, "thr_ret == 0");
            <D.11196>:
            mutex_handle.13 = mutex_handle;
            D.11198 = mutex_handle.13->pid;
            if (D.11198 == pid) goto <D.11199>; else goto <D.11200>;
            <D.11199>:
            mutex_handle.13 = mutex_handle;
            D.11201 = mutex_handle.13->tid;
            D.11202 = pthread_equal (D.11201, tid);
            if (D.11202 != 0) goto <D.11203>; else goto <D.11204>;
            <D.11203>:
            mutex_handle.13 = mutex_handle;
            mutex_handle.13->recursion = 0;
            mutex_handle.13 = mutex_handle;
            mutex_handle.13->pid = 0;
            mutex_handle.13 = mutex_handle;
            mutex_handle.13->tid = 0;
            _wapi_handle_set_signal_state (handle, 1, 0);
            <D.11204>:
            <D.11200>:
            thr_ret = _wapi_handle_unlock_handle (handle);
            D.11192 = thr_ret != 0;
            D.11193 = (long int) D.11192;
            D.11194 = __builtin_expect (D.11193, 0);
            if (D.11194 != 0) goto <D.11205>; else goto <D.11206>;
            <D.11205>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 321, "thr_ret == 0");
            <D.11206>:
            __pthread_unregister_cancel (&__cancel_buf);
            if (0 != 0) goto <D.11207>; else goto <D.11208>;
            <D.11207>:
            __cancel_routine (__cancel_arg);
            <D.11208>:
          }
        finally
          {
            __cancel_buf = {CLOBBER};
          }
      }
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


_wapi_handle_lock_handle (void * handle)
{
  long int handle.14;
  int D.11218;
  <unnamed type> D.11221;
  <unnamed type> D.11223;
  <unnamed type> D.11225;
  <unnamed type> D.11227;
  unsigned int D.11228;
  struct _WapiHandleUnshared * D.11229;
  long unsigned int D.11230;
  long unsigned int D.11231;
  long unsigned int D.11232;
  struct _WapiHandleUnshared * D.11233;
  union mono_mutex_t * D.11234;
  guint32 idx;

  handle.14 = (long int) handle;
  idx = (guint32) handle.14;
  if (idx > 4194303) goto <D.11216>; else goto <D.11217>;
  <D.11216>:
  D.11218 = 0;
  return D.11218;
  <D.11217>:
  _wapi_handle_ref (handle);
  D.11221 = _wapi_handle_type (handle);
  if (D.11221 == 9) goto <D.11219>; else goto <D.11222>;
  <D.11222>:
  D.11223 = _wapi_handle_type (handle);
  if (D.11223 == 11) goto <D.11219>; else goto <D.11224>;
  <D.11224>:
  D.11225 = _wapi_handle_type (handle);
  if (D.11225 == 12) goto <D.11219>; else goto <D.11226>;
  <D.11226>:
  D.11227 = _wapi_handle_type (handle);
  if (D.11227 == 13) goto <D.11219>; else goto <D.11220>;
  <D.11219>:
  D.11218 = 0;
  return D.11218;
  <D.11220>:
  D.11228 = idx / 256;
  D.11229 = _wapi_private_handles[D.11228];
  D.11230 = (long unsigned int) idx;
  D.11231 = D.11230 & 255;
  D.11232 = D.11231 * 200;
  D.11233 = D.11229 + D.11232;
  D.11234 = &D.11233->signal_mutex;
  D.11218 = pthread_mutex_lock (D.11234);
  return D.11218;
}


_wapi_handle_unlock_handle (void * handle)
{
  long int handle.15;
  int D.11239;
  <unnamed type> D.11242;
  <unnamed type> D.11244;
  <unnamed type> D.11246;
  <unnamed type> D.11248;
  unsigned int D.11249;
  struct _WapiHandleUnshared * D.11250;
  long unsigned int D.11251;
  long unsigned int D.11252;
  long unsigned int D.11253;
  struct _WapiHandleUnshared * D.11254;
  union mono_mutex_t * D.11255;
  guint32 idx;
  int ret;

  handle.15 = (long int) handle;
  idx = (guint32) handle.15;
  if (idx > 4194303) goto <D.11237>; else goto <D.11238>;
  <D.11237>:
  D.11239 = 0;
  return D.11239;
  <D.11238>:
  D.11242 = _wapi_handle_type (handle);
  if (D.11242 == 9) goto <D.11240>; else goto <D.11243>;
  <D.11243>:
  D.11244 = _wapi_handle_type (handle);
  if (D.11244 == 11) goto <D.11240>; else goto <D.11245>;
  <D.11245>:
  D.11246 = _wapi_handle_type (handle);
  if (D.11246 == 12) goto <D.11240>; else goto <D.11247>;
  <D.11247>:
  D.11248 = _wapi_handle_type (handle);
  if (D.11248 == 13) goto <D.11240>; else goto <D.11241>;
  <D.11240>:
  _wapi_handle_unref (handle);
  D.11239 = 0;
  return D.11239;
  <D.11241>:
  D.11249 = idx / 256;
  D.11250 = _wapi_private_handles[D.11249];
  D.11251 = (long unsigned int) idx;
  D.11252 = D.11251 & 255;
  D.11253 = D.11252 * 200;
  D.11254 = D.11250 + D.11253;
  D.11255 = &D.11254->signal_mutex;
  ret = pthread_mutex_unlock (D.11255);
  _wapi_handle_unref (handle);
  D.11239 = ret;
  return D.11239;
}


namedmutex_abandon (void * handle, pid_t pid, pthread_t tid)
{
  _Bool D.11259;
  long int D.11260;
  long int D.11261;
  struct _WapiHandle_namedmutex * mutex_handle.16;
  int D.11265;
  long unsigned int D.11268;
  int D.11269;
  struct _WapiHandle_namedmutex * mutex_handle;
  gboolean ok;
  int thr_ret;
  static const char __func__[19] = "namedmutex_abandon";

  try
    {
      ok = _wapi_lookup_handle (handle, 11, &mutex_handle);
      if (ok == 0) goto <D.11257>; else goto <D.11258>;
      <D.11257>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      return;
      <D.11258>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.11259 = thr_ret != 0;
      D.11260 = (long int) D.11259;
      D.11261 = __builtin_expect (D.11260, 0);
      if (D.11261 != 0) goto <D.11262>; else goto <D.11263>;
      <D.11262>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 340, "thr_ret == 0");
      <D.11263>:
      mutex_handle.16 = mutex_handle;
      D.11265 = mutex_handle.16->pid;
      if (D.11265 == pid) goto <D.11266>; else goto <D.11267>;
      <D.11266>:
      mutex_handle.16 = mutex_handle;
      D.11268 = mutex_handle.16->tid;
      D.11269 = pthread_equal (D.11268, tid);
      if (D.11269 != 0) goto <D.11270>; else goto <D.11271>;
      <D.11270>:
      mutex_handle.16 = mutex_handle;
      mutex_handle.16->recursion = 0;
      mutex_handle.16 = mutex_handle;
      mutex_handle.16->pid = 0;
      mutex_handle.16 = mutex_handle;
      mutex_handle.16->tid = 0;
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.11271>:
      <D.11267>:
      _wapi_handle_unlock_shared_handles ();
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


CreateMutex (struct WapiSecurityAttributes * security, gboolean owned, const gunichar2 * name)
{
  void * D.11277;

  mono_once (&mutex_ops_once, mutex_ops_init);
  if (name == 0B) goto <D.11275>; else goto <D.11276>;
  <D.11275>:
  D.11277 = mutex_create (security, owned);
  return D.11277;
  <D.11276>:
  D.11277 = namedmutex_create (security, owned, name);
  return D.11277;
}


mutex_ops_init ()
{
  _wapi_handle_register_capabilities (5, 7);
  _wapi_handle_register_capabilities (11, 7);
}


mutex_create (struct WapiSecurityAttributes * security, gboolean owned)
{
  void * D.11281;
  long int D.11282;
  long int D.11283;
  _Bool D.11286;
  long int D.11287;
  long int D.11288;
  struct _WapiHandle_mutex mutex_handle;
  void * handle;
  int thr_ret;
  static const char __func__[13] = "mutex_create";

  try
    {
      mutex_handle = {};
      SetLastError (0);
      handle = _wapi_handle_new (5, &mutex_handle);
      if (handle == -1B) goto <D.11279>; else goto <D.11280>;
      <D.11279>:
      monoeg_g_log (0B, 16, "%s: error creating mutex handle", &__func__);
      SetLastError (31);
      D.11281 = 0B;
      return D.11281;
      <D.11280>:
      {
        struct __pthread_unwind_buf_t __cancel_buf;
        void (*<Tbf>) (void *) __cancel_routine;
        void * __cancel_arg;
        int __not_first_call;

        try
          {
            __cancel_routine = _wapi_handle_unlock_handle;
            __cancel_arg = handle;
            __not_first_call = __sigsetjmp (&__cancel_buf.__cancel_jmp_buf, 0);
            D.11282 = (long int) __not_first_call;
            D.11283 = __builtin_expect (D.11282, 0);
            if (D.11283 != 0) goto <D.11284>; else goto <D.11285>;
            <D.11284>:
            __cancel_routine (__cancel_arg);
            __pthread_unwind_next (&__cancel_buf);
            <D.11285>:
            __pthread_register_cancel (&__cancel_buf);
            thr_ret = _wapi_handle_lock_handle (handle);
            D.11286 = thr_ret != 0;
            D.11287 = (long int) D.11286;
            D.11288 = __builtin_expect (D.11287, 0);
            if (D.11288 != 0) goto <D.11289>; else goto <D.11290>;
            <D.11289>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 398, "thr_ret == 0");
            <D.11290>:
            if (owned == 1) goto <D.11291>; else goto <D.11292>;
            <D.11291>:
            mutex_own (handle);
            goto <D.11293>;
            <D.11292>:
            _wapi_handle_set_signal_state (handle, 1, 0);
            <D.11293>:
            thr_ret = _wapi_handle_unlock_handle (handle);
            D.11286 = thr_ret != 0;
            D.11287 = (long int) D.11286;
            D.11288 = __builtin_expect (D.11287, 0);
            if (D.11288 != 0) goto <D.11294>; else goto <D.11295>;
            <D.11294>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 409, "thr_ret == 0");
            <D.11295>:
            __pthread_unregister_cancel (&__cancel_buf);
            if (0 != 0) goto <D.11296>; else goto <D.11297>;
            <D.11296>:
            __cancel_routine (__cancel_arg);
            <D.11297>:
          }
        finally
          {
            __cancel_buf = {CLOBBER};
          }
      }
      D.11281 = handle;
      return D.11281;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


namedmutex_create (struct WapiSecurityAttributes * security, gboolean owned, const gunichar2 * name)
{
  _Bool D.11303;
  long int D.11304;
  long int D.11305;
  long unsigned int D.11314;
  long unsigned int D.11317;
  long unsigned int D.11319;
  unsigned int offset.17;
  void * D.11331;
  struct _WapiHandle_namedmutex namedmutex_handle;
  void * handle;
  gchar * utf8_name;
  int thr_ret;
  void * ret;
  guint32 namelen;
  gint32 offset;
  void cleanup = <<< error >>>;
  static const char __func__[18] = "namedmutex_create";

  try
    {
      namedmutex_handle = {};
      ret = 0B;
      thr_ret = _wapi_namespace_lock ();
      D.11303 = thr_ret != 0;
      D.11304 = (long int) D.11303;
      D.11305 = __builtin_expect (D.11304, 0);
      if (D.11305 != 0) goto <D.11306>; else goto <D.11307>;
      <D.11306>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 430, "thr_ret == 0");
      <D.11307>:
      SetLastError (0);
      utf8_name = monoeg_g_utf16_to_utf8 (name, -1, 0B, 0B, 0B);
      offset = _wapi_search_handle_namespace (11, utf8_name);
      if (offset == -1) goto <D.11308>; else goto <D.11309>;
      <D.11308>:
      SetLastError (6);
      goto cleanup;
      <D.11309>:
      if (offset != 0) goto <D.11310>; else goto <D.11311>;
      <D.11310>:
      SetLastError (183);
      <D.11311>:
      if (offset == 0) goto <D.11312>; else goto <D.11313>;
      <D.11312>:
      D.11314 = strlen (utf8_name);
      if (D.11314 <= 259) goto <D.11315>; else goto <D.11316>;
      <D.11315>:
      D.11317 = strlen (utf8_name);
      namelen = (guint32) D.11317;
      goto <D.11318>;
      <D.11316>:
      namelen = 260;
      <D.11318>:
      D.11319 = (long unsigned int) namelen;
      memcpy (&namedmutex_handle.sharedns.name, utf8_name, D.11319);
      handle = _wapi_handle_new (11, &namedmutex_handle);
      goto <D.11320>;
      <D.11313>:
      offset.17 = (unsigned int) offset;
      handle = _wapi_handle_new_from_offset (11, offset.17, 1);
      <D.11320>:
      if (handle == -1B) goto <D.11322>; else goto <D.11323>;
      <D.11322>:
      monoeg_g_log (0B, 16, "%s: error creating mutex handle", &__func__);
      SetLastError (31);
      goto cleanup;
      <D.11323>:
      ret = handle;
      if (offset == 0) goto <D.11324>; else goto <D.11325>;
      <D.11324>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.11303 = thr_ret != 0;
      D.11304 = (long int) D.11303;
      D.11305 = __builtin_expect (D.11304, 0);
      if (D.11305 != 0) goto <D.11326>; else goto <D.11327>;
      <D.11326>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 493, "thr_ret == 0");
      <D.11327>:
      if (owned == 1) goto <D.11328>; else goto <D.11329>;
      <D.11328>:
      namedmutex_own (handle);
      goto <D.11330>;
      <D.11329>:
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.11330>:
      _wapi_handle_unlock_shared_handles ();
      <D.11325>:
      cleanup:
      monoeg_g_free (utf8_name);
      _wapi_namespace_unlock (0B);
      D.11331 = ret;
      return D.11331;
    }
  finally
    {
      namedmutex_handle = {CLOBBER};
    }
}


_wapi_namespace_lock ()
{
  int D.11334;

  D.11334 = _wapi_shm_sem_lock (0);
  return D.11334;
}


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

  D.11337 = __builtin_object_size (__dest, 0);
  D.11336 = __builtin___memcpy_chk (__dest, __src, __len, D.11337);
  return D.11336;
}


_wapi_namespace_unlock (void * data)
{
  int D.11339;

  D.11339 = _wapi_shm_sem_unlock (0);
  return D.11339;
}


ReleaseMutex (void * handle)
{
  gboolean D.11343;
  gboolean (*<T1616>) (void *) D.11344;
  WapiHandleType type;

  if (handle == 0B) goto <D.11341>; else goto <D.11342>;
  <D.11341>:
  SetLastError (6);
  D.11343 = 0;
  return D.11343;
  <D.11342>:
  type = _wapi_handle_type (handle);
  D.11344 = mutex_ops[type].release;
  if (D.11344 == 0B) goto <D.11345>; else goto <D.11346>;
  <D.11345>:
  SetLastError (6);
  D.11343 = 0;
  return D.11343;
  <D.11346>:
  D.11344 = mutex_ops[type].release;
  D.11343 = D.11344 (handle);
  return D.11343;
}


namedmutex_release (void * handle)
{
  gboolean D.11350;
  _Bool D.11351;
  long int D.11352;
  long int D.11353;
  struct _WapiHandle_namedmutex * mutex_handle.18;
  long unsigned int D.11357;
  int D.11358;
  int D.11360;
  unsigned int D.11362;
  unsigned int D.11363;
  struct _WapiHandle_namedmutex * mutex_handle;
  gboolean ok;
  pthread_t tid;
  pid_t pid;
  int thr_ret;
  gboolean ret;
  static const char __func__[19] = "namedmutex_release";
  void cleanup = <<< error >>>;

  try
    {
      tid = pthread_self ();
      pid = _wapi_getpid ();
      ret = 0;
      ok = _wapi_lookup_handle (handle, 11, &mutex_handle);
      if (ok == 0) goto <D.11348>; else goto <D.11349>;
      <D.11348>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      D.11350 = 0;
      return D.11350;
      <D.11349>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.11351 = thr_ret != 0;
      D.11352 = (long int) D.11351;
      D.11353 = __builtin_expect (D.11352, 0);
      if (D.11353 != 0) goto <D.11354>; else goto <D.11355>;
      <D.11354>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 616, "thr_ret == 0");
      <D.11355>:
      mutex_handle.18 = mutex_handle;
      D.11357 = mutex_handle.18->tid;
      D.11358 = pthread_equal (D.11357, tid);
      if (D.11358 == 0) goto cleanup; else goto <D.11359>;
      <D.11359>:
      mutex_handle.18 = mutex_handle;
      D.11360 = mutex_handle.18->pid;
      if (D.11360 != pid) goto cleanup; else goto <D.11361>;
      <D.11361>:
      ret = 1;
      mutex_handle.18 = mutex_handle;
      D.11362 = mutex_handle.18->recursion;
      D.11363 = D.11362 + 4294967295;
      mutex_handle.18->recursion = D.11363;
      mutex_handle.18 = mutex_handle;
      D.11362 = mutex_handle.18->recursion;
      if (D.11362 == 0) goto <D.11364>; else goto <D.11365>;
      <D.11364>:
      _wapi_thread_disown_mutex (handle);
      mutex_handle.18 = mutex_handle;
      mutex_handle.18->pid = 0;
      mutex_handle.18 = mutex_handle;
      mutex_handle.18->tid = 0;
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.11365>:
      cleanup:
      _wapi_handle_unlock_shared_handles ();
      D.11350 = ret;
      return D.11350;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


mutex_release (void * handle)
{
  gboolean D.11370;
  long int D.11371;
  long int D.11372;
  _Bool D.11375;
  long int D.11376;
  long int D.11377;
  struct _WapiHandle_mutex * mutex_handle.19;
  long unsigned int D.11381;
  int D.11382;
  int D.11384;
  unsigned int D.11386;
  unsigned int D.11387;
  struct _WapiHandle_mutex * mutex_handle;
  gboolean ok;
  pthread_t tid;
  pid_t pid;
  int thr_ret;
  gboolean ret;
  static const char __func__[14] = "mutex_release";
  void cleanup = <<< error >>>;

  try
    {
      tid = pthread_self ();
      pid = _wapi_getpid ();
      ret = 0;
      ok = _wapi_lookup_handle (handle, 5, &mutex_handle);
      if (ok == 0) goto <D.11368>; else goto <D.11369>;
      <D.11368>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.11370 = 0;
      return D.11370;
      <D.11369>:
      {
        struct __pthread_unwind_buf_t __cancel_buf;
        void (*<Tbf>) (void *) __cancel_routine;
        void * __cancel_arg;
        int __not_first_call;

        try
          {
            __cancel_routine = _wapi_handle_unlock_handle;
            __cancel_arg = handle;
            __not_first_call = __sigsetjmp (&__cancel_buf.__cancel_jmp_buf, 0);
            D.11371 = (long int) __not_first_call;
            D.11372 = __builtin_expect (D.11371, 0);
            if (D.11372 != 0) goto <D.11373>; else goto <D.11374>;
            <D.11373>:
            __cancel_routine (__cancel_arg);
            __pthread_unwind_next (&__cancel_buf);
            <D.11374>:
            __pthread_register_cancel (&__cancel_buf);
            thr_ret = _wapi_handle_lock_handle (handle);
            D.11375 = thr_ret != 0;
            D.11376 = (long int) D.11375;
            D.11377 = __builtin_expect (D.11376, 0);
            if (D.11377 != 0) goto <D.11378>; else goto <D.11379>;
            <D.11378>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 565, "thr_ret == 0");
            <D.11379>:
            mutex_handle.19 = mutex_handle;
            D.11381 = mutex_handle.19->tid;
            D.11382 = pthread_equal (D.11381, tid);
            if (D.11382 == 0) goto cleanup; else goto <D.11383>;
            <D.11383>:
            mutex_handle.19 = mutex_handle;
            D.11384 = mutex_handle.19->pid;
            if (D.11384 != pid) goto cleanup; else goto <D.11385>;
            <D.11385>:
            ret = 1;
            mutex_handle.19 = mutex_handle;
            D.11386 = mutex_handle.19->recursion;
            D.11387 = D.11386 + 4294967295;
            mutex_handle.19->recursion = D.11387;
            mutex_handle.19 = mutex_handle;
            D.11386 = mutex_handle.19->recursion;
            if (D.11386 == 0) goto <D.11388>; else goto <D.11389>;
            <D.11388>:
            _wapi_thread_disown_mutex (handle);
            mutex_handle.19 = mutex_handle;
            mutex_handle.19->pid = 0;
            mutex_handle.19 = mutex_handle;
            mutex_handle.19->tid = 0;
            _wapi_handle_set_signal_state (handle, 1, 0);
            <D.11389>:
            cleanup:
            thr_ret = _wapi_handle_unlock_handle (handle);
            D.11375 = thr_ret != 0;
            D.11376 = (long int) D.11375;
            D.11377 = __builtin_expect (D.11376, 0);
            if (D.11377 != 0) goto <D.11390>; else goto <D.11391>;
            <D.11390>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 592, "thr_ret == 0");
            <D.11391>:
            __pthread_unregister_cancel (&__cancel_buf);
            if (0 != 0) goto <D.11392>; else goto <D.11393>;
            <D.11392>:
            __cancel_routine (__cancel_arg);
            <D.11393>:
          }
        finally
          {
            __cancel_buf = {CLOBBER};
          }
      }
      D.11370 = ret;
      return D.11370;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


OpenMutex (guint32 access, gboolean inherit, const gunichar2 * name)
{
  _Bool D.11400;
  long int D.11401;
  long int D.11402;
  unsigned int offset.20;
  void * D.11412;
  void * handle;
  gchar * utf8_name;
  int thr_ret;
  void * ret;
  gint32 offset;
  void cleanup = <<< error >>>;
  static const char __func__[10] = "OpenMutex";

  ret = 0B;
  mono_once (&mutex_ops_once, mutex_ops_init);
  thr_ret = _wapi_namespace_lock ();
  D.11400 = thr_ret != 0;
  D.11401 = (long int) D.11400;
  D.11402 = __builtin_expect (D.11401, 0);
  if (D.11402 != 0) goto <D.11403>; else goto <D.11404>;
  <D.11403>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 689, "thr_ret == 0");
  <D.11404>:
  utf8_name = monoeg_g_utf16_to_utf8 (name, -1, 0B, 0B, 0B);
  offset = _wapi_search_handle_namespace (11, utf8_name);
  if (offset == -1) goto <D.11405>; else goto <D.11406>;
  <D.11405>:
  SetLastError (6);
  goto cleanup;
  <D.11406>:
  if (offset == 0) goto <D.11407>; else goto <D.11408>;
  <D.11407>:
  SetLastError (2);
  goto cleanup;
  <D.11408>:
  offset.20 = (unsigned int) offset;
  handle = _wapi_handle_new_from_offset (11, offset.20, 1);
  if (handle == -1B) goto <D.11410>; else goto <D.11411>;
  <D.11410>:
  monoeg_g_log (0B, 16, "%s: error opening named mutex handle", &__func__);
  SetLastError (31);
  goto cleanup;
  <D.11411>:
  ret = handle;
  cleanup:
  monoeg_g_free (utf8_name);
  _wapi_namespace_unlock (0B);
  D.11412 = ret;
  return D.11412;
}


