mutex_is_owned (void * handle)
{
  gboolean D.10636;
  struct _WapiHandle_mutex * mutex_handle.0;
  unsigned int D.10639;
  int D.10641;
  int D.10642;
  long unsigned int D.10644;
  long unsigned int D.10645;
  int D.10646;
  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.10634>; else goto <D.10635>;
      <D.10634>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.10636 = 0;
      return D.10636;
      <D.10635>:
      mutex_handle.0 = mutex_handle;
      D.10639 = mutex_handle.0->recursion;
      if (D.10639 != 0) goto <D.10640>; else goto <D.10637>;
      <D.10640>:
      mutex_handle.0 = mutex_handle;
      D.10641 = mutex_handle.0->pid;
      D.10642 = _wapi_getpid ();
      if (D.10641 == D.10642) goto <D.10643>; else goto <D.10637>;
      <D.10643>:
      mutex_handle.0 = mutex_handle;
      D.10644 = mutex_handle.0->tid;
      D.10645 = pthread_self ();
      D.10646 = pthread_equal (D.10644, D.10645);
      if (D.10646 != 0) goto <D.10647>; else goto <D.10637>;
      <D.10647>:
      D.10636 = 1;
      return D.10636;
      <D.10637>:
      D.10636 = 0;
      return D.10636;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


__attribute__((__gnu_inline__, const, __leaf__, __nothrow__))
pthread_equal (pthread_t __thread1, pthread_t __thread2)
{
  int D.10650;
  _Bool D.10651;

  D.10651 = __thread1 == __thread2;
  D.10650 = (int) D.10651;
  return D.10650;
}


mutex_own (void * handle)
{
  gboolean D.10655;
  struct _WapiHandle_mutex * mutex_handle.1;
  int D.10657;
  long unsigned int D.10658;
  unsigned int D.10659;
  unsigned int D.10660;
  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.10653>; else goto <D.10654>;
      <D.10653>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.10655 = 0;
      return D.10655;
      <D.10654>:
      _wapi_thread_own_mutex (handle);
      _wapi_handle_set_signal_state (handle, 0, 0);
      mutex_handle.1 = mutex_handle;
      D.10657 = _wapi_getpid ();
      mutex_handle.1->pid = D.10657;
      mutex_handle.1 = mutex_handle;
      D.10658 = pthread_self ();
      mutex_handle.1->tid = D.10658;
      mutex_handle.1 = mutex_handle;
      D.10659 = mutex_handle.1->recursion;
      D.10660 = D.10659 + 1;
      mutex_handle.1->recursion = D.10660;
      D.10655 = 1;
      return D.10655;
    }
  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.10670;
  <unnamed type> D.10672;
  <unnamed type> D.10674;
  <unnamed type> D.10676;
  _Bool D.10677;
  long int D.10678;
  long int D.10679;
  unsigned int D.10682;
  struct _WapiHandleUnshared * D.10683;
  long unsigned int D.10684;
  long unsigned int D.10685;
  long unsigned int D.10686;
  long int D.10689;
  long int D.10690;
  union mono_mutex_t * _wapi_global_signal_mutex.4;
  _Bool D.10696;
  long int D.10697;
  long int D.10698;
  union pthread_cond_t * D.10703;
  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.10664>; else goto <D.10665>;
  <D.10664>:
  return;
  <D.10665>:
  D.10670 = _wapi_handle_type (handle);
  if (D.10670 == 9) goto <D.10667>; else goto <D.10671>;
  <D.10671>:
  D.10672 = _wapi_handle_type (handle);
  if (D.10672 == 11) goto <D.10667>; else goto <D.10673>;
  <D.10673>:
  D.10674 = _wapi_handle_type (handle);
  if (D.10674 == 12) goto <D.10667>; else goto <D.10675>;
  <D.10675>:
  D.10676 = _wapi_handle_type (handle);
  if (D.10676 == 13) goto <D.10667>; else goto <D.10668>;
  <D.10667>:
  iftmp.3 = 1;
  goto <D.10669>;
  <D.10668>:
  iftmp.3 = 0;
  <D.10669>:
  D.10677 = iftmp.3 != 0;
  D.10678 = (long int) D.10677;
  D.10679 = __builtin_expect (D.10678, 0);
  if (D.10679 != 0) goto <D.10680>; else goto <D.10681>;
  <D.10680>:
  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.10681>:
  D.10682 = idx / 256;
  D.10683 = _wapi_private_handles[D.10682];
  D.10684 = (long unsigned int) idx;
  D.10685 = D.10684 & 255;
  D.10686 = D.10685 * 200;
  handle_data = D.10683 + D.10686;
  if (state == 1) goto <D.10687>; else goto <D.10688>;
  <D.10687>:
  {
    struct __pthread_unwind_buf_t __cancel_buf;
    void (*<Tc6>) (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.10689 = (long int) __not_first_call;
        D.10690 = __builtin_expect (D.10689, 0);
        if (D.10690 != 0) goto <D.10691>; else goto <D.10692>;
        <D.10691>:
        __cancel_routine (__cancel_arg);
        __pthread_unwind_next (&__cancel_buf);
        <D.10692>:
        __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.10694>; else goto <D.10695>;
        <D.10694>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d for global signal mutex", thr_ret);
        <D.10695>:
        D.10696 = thr_ret != 0;
        D.10697 = (long int) D.10696;
        D.10698 = __builtin_expect (D.10697, 0);
        if (D.10698 != 0) goto <D.10699>; else goto <D.10700>;
        <D.10699>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 151, "thr_ret == 0");
        <D.10700>:
        handle_data->signalled = state;
        if (broadcast == 1) goto <D.10701>; else goto <D.10702>;
        <D.10701>:
        D.10703 = &handle_data->signal_cond;
        thr_ret = pthread_cond_broadcast (D.10703);
        if (thr_ret != 0) goto <D.10704>; else goto <D.10705>;
        <D.10704>:
        monoeg_g_log (0B, 16, "Bad call to pthread_cond_broadcast result %d for handle %p", thr_ret, handle);
        <D.10705>:
        D.10696 = thr_ret != 0;
        D.10697 = (long int) D.10696;
        D.10698 = __builtin_expect (D.10697, 0);
        if (D.10698 != 0) goto <D.10706>; else goto <D.10707>;
        <D.10706>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 162, "thr_ret == 0");
        <D.10707>:
        goto <D.10708>;
        <D.10702>:
        D.10703 = &handle_data->signal_cond;
        thr_ret = pthread_cond_signal (D.10703);
        if (thr_ret != 0) goto <D.10709>; else goto <D.10710>;
        <D.10709>:
        monoeg_g_log (0B, 16, "Bad call to pthread_cond_signal result %d for handle %p", thr_ret, handle);
        <D.10710>:
        D.10696 = thr_ret != 0;
        D.10697 = (long int) D.10696;
        D.10698 = __builtin_expect (D.10697, 0);
        if (D.10698 != 0) goto <D.10711>; else goto <D.10712>;
        <D.10711>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 167, "thr_ret == 0");
        <D.10712>:
        <D.10708>:
        _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.10714>; else goto <D.10715>;
        <D.10714>:
        monoeg_g_log (0B, 16, "Bad call to pthread_cond_broadcast result %d for handle %p", thr_ret, handle);
        <D.10715>:
        D.10696 = thr_ret != 0;
        D.10697 = (long int) D.10696;
        D.10698 = __builtin_expect (D.10697, 0);
        if (D.10698 != 0) goto <D.10716>; else goto <D.10717>;
        <D.10716>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 176, "thr_ret == 0");
        <D.10717>:
        _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.10718>; else goto <D.10719>;
        <D.10718>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d for global signal mutex", thr_ret);
        <D.10719>:
        D.10696 = thr_ret != 0;
        D.10697 = (long int) D.10696;
        D.10698 = __builtin_expect (D.10697, 0);
        if (D.10698 != 0) goto <D.10720>; else goto <D.10721>;
        <D.10720>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/io-layer/handles-private.h", 181, "thr_ret == 0");
        <D.10721>:
        __pthread_unregister_cancel (&__cancel_buf);
        if (0 != 0) goto <D.10722>; else goto <D.10723>;
        <D.10722>:
        __cancel_routine (__cancel_arg);
        <D.10723>:
      }
    finally
      {
        __cancel_buf = {CLOBBER};
      }
  }
  goto <D.10724>;
  <D.10688>:
  handle_data->signalled = state;
  <D.10724>:
}


__attribute__((__unused__))
mono_mutex_unlock_in_cleanup (union mono_mutex_t * mutex)
{
  int D.10735;

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


_wapi_handle_type (void * handle)
{
  long int handle.6;
  unsigned int D.10742;
  struct _WapiHandleUnshared * D.10743;
  WapiHandleType D.10744;
  unsigned int D.10745;
  struct _WapiHandleUnshared * D.10746;
  long unsigned int D.10747;
  long unsigned int D.10748;
  long unsigned int D.10749;
  struct _WapiHandleUnshared * D.10750;
  guint32 idx;

  handle.6 = (long int) handle;
  idx = (guint32) handle.6;
  if (idx > 4194303) goto <D.10738>; else goto <D.10740>;
  <D.10740>:
  if (idx > 268435455) goto <D.10738>; else goto <D.10741>;
  <D.10741>:
  D.10742 = idx / 256;
  D.10743 = _wapi_private_handles[D.10742];
  if (D.10743 == 0B) goto <D.10738>; else goto <D.10739>;
  <D.10738>:
  D.10744 = 0;
  return D.10744;
  <D.10739>:
  D.10745 = idx / 256;
  D.10746 = _wapi_private_handles[D.10745];
  D.10747 = (long unsigned int) idx;
  D.10748 = D.10747 & 255;
  D.10749 = D.10748 * 200;
  D.10750 = D.10746 + D.10749;
  D.10744 = D.10750->type;
  return D.10744;
}


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


_wapi_mutex_details (void * handle_info)
{
  int D.10752;
  long unsigned int D.10753;
  unsigned int D.10754;
  struct _WapiHandle_mutex * mut;

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


namedmutex_prewait (void * handle)
{
  struct _WapiHandle_namedmutex * namedmutex_handle.7;
  unsigned int D.10758;
  int D.10762;
  int D.10763;
  unsigned int D.10767;
  _Bool D.10770;
  long int D.10771;
  long int D.10772;
  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.10755>; else goto <D.10756>;
      <D.10755>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      return;
      <D.10756>:
      namedmutex_handle.7 = namedmutex_handle;
      D.10758 = namedmutex_handle.7->recursion;
      if (D.10758 == 0) goto <D.10759>; else goto <D.10760>;
      <D.10759>:
      goto <D.10761>;
      <D.10760>:
      namedmutex_handle.7 = namedmutex_handle;
      D.10762 = namedmutex_handle.7->pid;
      D.10763 = _wapi_getpid ();
      if (D.10762 == D.10763) goto <D.10764>; else goto <D.10765>;
      <D.10764>:
      goto <D.10766>;
      <D.10765>:
      {
        int thr_ret;
        void * proc_handle;

        namedmutex_handle.7 = namedmutex_handle;
        D.10762 = namedmutex_handle.7->pid;
        D.10767 = (unsigned int) D.10762;
        proc_handle = OpenProcess (0, 0, D.10767);
        if (proc_handle == 0B) goto <D.10768>; else goto <D.10769>;
        <D.10768>:
        thr_ret = _wapi_handle_lock_shared_handles ();
        D.10770 = thr_ret != 0;
        D.10771 = (long int) D.10770;
        D.10772 = __builtin_expect (D.10771, 0);
        if (D.10772 != 0) goto <D.10773>; else goto <D.10774>;
        <D.10773>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 274, "thr_ret == 0");
        <D.10774>:
        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.10775>;
        <D.10769>:
        <D.10775>:
        if (proc_handle != 0B) goto <D.10776>; else goto <D.10777>;
        <D.10776>:
        CloseProcess (proc_handle);
        <D.10777>:
      }
      <D.10766>:
      <D.10761>:
    }
  finally
    {
      namedmutex_handle = {CLOBBER};
    }
}


_wapi_handle_lock_shared_handles ()
{
  int D.10781;

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


_wapi_shared_handle_set_signal_state (void * handle, gboolean state)
{
  long int handle.8;
  int iftmp.9;
  <unnamed type> D.10789;
  <unnamed type> D.10791;
  <unnamed type> D.10793;
  <unnamed type> D.10795;
  _Bool D.10797;
  long int D.10798;
  long int D.10799;
  unsigned int D.10802;
  struct _WapiHandleUnshared * D.10803;
  long unsigned int D.10804;
  long unsigned int D.10805;
  long unsigned int D.10806;
  struct _WapiHandleSharedLayout * _wapi_shared_layout.10;
  unsigned int D.10808;
  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.10784>; else goto <D.10785>;
  <D.10784>:
  return;
  <D.10785>:
  D.10789 = _wapi_handle_type (handle);
  if (D.10789 != 9) goto <D.10790>; else goto <D.10787>;
  <D.10790>:
  D.10791 = _wapi_handle_type (handle);
  if (D.10791 != 11) goto <D.10792>; else goto <D.10787>;
  <D.10792>:
  D.10793 = _wapi_handle_type (handle);
  if (D.10793 != 12) goto <D.10794>; else goto <D.10787>;
  <D.10794>:
  D.10795 = _wapi_handle_type (handle);
  if (D.10795 != 13) goto <D.10796>; else goto <D.10787>;
  <D.10796>:
  iftmp.9 = 1;
  goto <D.10788>;
  <D.10787>:
  iftmp.9 = 0;
  <D.10788>:
  D.10797 = iftmp.9 != 0;
  D.10798 = (long int) D.10797;
  D.10799 = __builtin_expect (D.10798, 0);
  if (D.10799 != 0) goto <D.10800>; else goto <D.10801>;
  <D.10800>:
  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.10801>:
  D.10802 = idx / 256;
  D.10803 = _wapi_private_handles[D.10802];
  D.10804 = (long unsigned int) idx;
  D.10805 = D.10804 & 255;
  D.10806 = D.10805 * 200;
  handle_data = D.10803 + D.10806;
  ref = &handle_data->u.shared;
  _wapi_shared_layout.10 = _wapi_shared_layout;
  D.10808 = ref->offset;
  shared_data = &_wapi_shared_layout.10->handles[D.10808];
  shared_data->signalled = state;
}


_wapi_handle_unlock_shared_handles ()
{
  int D.10810;

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


namedmutex_is_owned (void * handle)
{
  gboolean D.10814;
  struct _WapiHandle_namedmutex * namedmutex_handle.11;
  unsigned int D.10817;
  int D.10819;
  int D.10820;
  long unsigned int D.10822;
  long unsigned int D.10823;
  int D.10824;
  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.10812>; else goto <D.10813>;
      <D.10812>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.10814 = 0;
      return D.10814;
      <D.10813>:
      namedmutex_handle.11 = namedmutex_handle;
      D.10817 = namedmutex_handle.11->recursion;
      if (D.10817 != 0) goto <D.10818>; else goto <D.10815>;
      <D.10818>:
      namedmutex_handle.11 = namedmutex_handle;
      D.10819 = namedmutex_handle.11->pid;
      D.10820 = _wapi_getpid ();
      if (D.10819 == D.10820) goto <D.10821>; else goto <D.10815>;
      <D.10821>:
      namedmutex_handle.11 = namedmutex_handle;
      D.10822 = namedmutex_handle.11->tid;
      D.10823 = pthread_self ();
      D.10824 = pthread_equal (D.10822, D.10823);
      if (D.10824 != 0) goto <D.10825>; else goto <D.10815>;
      <D.10825>:
      D.10814 = 1;
      return D.10814;
      <D.10815>:
      D.10814 = 0;
      return D.10814;
    }
  finally
    {
      namedmutex_handle = {CLOBBER};
    }
}


namedmutex_own (void * handle)
{
  gboolean D.10830;
  struct _WapiHandle_namedmutex * namedmutex_handle.12;
  int D.10832;
  long unsigned int D.10833;
  unsigned int D.10834;
  unsigned int D.10835;
  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.10828>; else goto <D.10829>;
      <D.10828>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      D.10830 = 0;
      return D.10830;
      <D.10829>:
      _wapi_thread_own_mutex (handle);
      namedmutex_handle.12 = namedmutex_handle;
      D.10832 = _wapi_getpid ();
      namedmutex_handle.12->pid = D.10832;
      namedmutex_handle.12 = namedmutex_handle;
      D.10833 = pthread_self ();
      namedmutex_handle.12->tid = D.10833;
      namedmutex_handle.12 = namedmutex_handle;
      D.10834 = namedmutex_handle.12->recursion;
      D.10835 = D.10834 + 1;
      namedmutex_handle.12->recursion = D.10835;
      _wapi_shared_handle_set_signal_state (handle, 0);
      D.10830 = 1;
      return D.10830;
    }
  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.10838>; else goto <D.10839>;
  <D.10838>:
  mutex_abandon (data, pid, tid);
  goto <D.10840>;
  <D.10839>:
  if (type == 11) goto <D.10841>; else goto <D.10842>;
  <D.10841>:
  namedmutex_abandon (data, pid, tid);
  goto <D.10843>;
  <D.10842>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "mutexes.c", 369);
  <D.10843>:
  <D.10840>:
}


mutex_abandon (void * handle, pid_t pid, pthread_t tid)
{
  long int D.10846;
  long int D.10847;
  _Bool D.10850;
  long int D.10851;
  long int D.10852;
  struct _WapiHandle_mutex * mutex_handle.13;
  int D.10856;
  long unsigned int D.10859;
  int D.10860;
  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.10844>; else goto <D.10845>;
      <D.10844>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      return;
      <D.10845>:
      {
        struct __pthread_unwind_buf_t __cancel_buf;
        void (*<Tc6>) (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.10846 = (long int) __not_first_call;
            D.10847 = __builtin_expect (D.10846, 0);
            if (D.10847 != 0) goto <D.10848>; else goto <D.10849>;
            <D.10848>:
            __cancel_routine (__cancel_arg);
            __pthread_unwind_next (&__cancel_buf);
            <D.10849>:
            __pthread_register_cancel (&__cancel_buf);
            thr_ret = _wapi_handle_lock_handle (handle);
            D.10850 = thr_ret != 0;
            D.10851 = (long int) D.10850;
            D.10852 = __builtin_expect (D.10851, 0);
            if (D.10852 != 0) goto <D.10853>; else goto <D.10854>;
            <D.10853>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 307, "thr_ret == 0");
            <D.10854>:
            mutex_handle.13 = mutex_handle;
            D.10856 = mutex_handle.13->pid;
            if (D.10856 == pid) goto <D.10857>; else goto <D.10858>;
            <D.10857>:
            mutex_handle.13 = mutex_handle;
            D.10859 = mutex_handle.13->tid;
            D.10860 = pthread_equal (D.10859, tid);
            if (D.10860 != 0) goto <D.10861>; else goto <D.10862>;
            <D.10861>:
            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.10862>:
            <D.10858>:
            thr_ret = _wapi_handle_unlock_handle (handle);
            D.10850 = thr_ret != 0;
            D.10851 = (long int) D.10850;
            D.10852 = __builtin_expect (D.10851, 0);
            if (D.10852 != 0) goto <D.10863>; else goto <D.10864>;
            <D.10863>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 321, "thr_ret == 0");
            <D.10864>:
            __pthread_unregister_cancel (&__cancel_buf);
            if (0 != 0) goto <D.10865>; else goto <D.10866>;
            <D.10865>:
            __cancel_routine (__cancel_arg);
            <D.10866>:
          }
        finally
          {
            __cancel_buf = {CLOBBER};
          }
      }
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


_wapi_handle_lock_handle (void * handle)
{
  long int handle.14;
  int D.10876;
  <unnamed type> D.10879;
  <unnamed type> D.10881;
  <unnamed type> D.10883;
  <unnamed type> D.10885;
  unsigned int D.10886;
  struct _WapiHandleUnshared * D.10887;
  long unsigned int D.10888;
  long unsigned int D.10889;
  long unsigned int D.10890;
  struct _WapiHandleUnshared * D.10891;
  union mono_mutex_t * D.10892;
  guint32 idx;

  handle.14 = (long int) handle;
  idx = (guint32) handle.14;
  if (idx > 4194303) goto <D.10874>; else goto <D.10875>;
  <D.10874>:
  D.10876 = 0;
  return D.10876;
  <D.10875>:
  _wapi_handle_ref (handle);
  D.10879 = _wapi_handle_type (handle);
  if (D.10879 == 9) goto <D.10877>; else goto <D.10880>;
  <D.10880>:
  D.10881 = _wapi_handle_type (handle);
  if (D.10881 == 11) goto <D.10877>; else goto <D.10882>;
  <D.10882>:
  D.10883 = _wapi_handle_type (handle);
  if (D.10883 == 12) goto <D.10877>; else goto <D.10884>;
  <D.10884>:
  D.10885 = _wapi_handle_type (handle);
  if (D.10885 == 13) goto <D.10877>; else goto <D.10878>;
  <D.10877>:
  D.10876 = 0;
  return D.10876;
  <D.10878>:
  D.10886 = idx / 256;
  D.10887 = _wapi_private_handles[D.10886];
  D.10888 = (long unsigned int) idx;
  D.10889 = D.10888 & 255;
  D.10890 = D.10889 * 200;
  D.10891 = D.10887 + D.10890;
  D.10892 = &D.10891->signal_mutex;
  D.10876 = pthread_mutex_lock (D.10892);
  return D.10876;
}


_wapi_handle_unlock_handle (void * handle)
{
  long int handle.15;
  int D.10897;
  <unnamed type> D.10900;
  <unnamed type> D.10902;
  <unnamed type> D.10904;
  <unnamed type> D.10906;
  unsigned int D.10907;
  struct _WapiHandleUnshared * D.10908;
  long unsigned int D.10909;
  long unsigned int D.10910;
  long unsigned int D.10911;
  struct _WapiHandleUnshared * D.10912;
  union mono_mutex_t * D.10913;
  guint32 idx;
  int ret;

  handle.15 = (long int) handle;
  idx = (guint32) handle.15;
  if (idx > 4194303) goto <D.10895>; else goto <D.10896>;
  <D.10895>:
  D.10897 = 0;
  return D.10897;
  <D.10896>:
  D.10900 = _wapi_handle_type (handle);
  if (D.10900 == 9) goto <D.10898>; else goto <D.10901>;
  <D.10901>:
  D.10902 = _wapi_handle_type (handle);
  if (D.10902 == 11) goto <D.10898>; else goto <D.10903>;
  <D.10903>:
  D.10904 = _wapi_handle_type (handle);
  if (D.10904 == 12) goto <D.10898>; else goto <D.10905>;
  <D.10905>:
  D.10906 = _wapi_handle_type (handle);
  if (D.10906 == 13) goto <D.10898>; else goto <D.10899>;
  <D.10898>:
  _wapi_handle_unref (handle);
  D.10897 = 0;
  return D.10897;
  <D.10899>:
  D.10907 = idx / 256;
  D.10908 = _wapi_private_handles[D.10907];
  D.10909 = (long unsigned int) idx;
  D.10910 = D.10909 & 255;
  D.10911 = D.10910 * 200;
  D.10912 = D.10908 + D.10911;
  D.10913 = &D.10912->signal_mutex;
  ret = pthread_mutex_unlock (D.10913);
  _wapi_handle_unref (handle);
  D.10897 = ret;
  return D.10897;
}


namedmutex_abandon (void * handle, pid_t pid, pthread_t tid)
{
  _Bool D.10917;
  long int D.10918;
  long int D.10919;
  struct _WapiHandle_namedmutex * mutex_handle.16;
  int D.10923;
  long unsigned int D.10926;
  int D.10927;
  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.10915>; else goto <D.10916>;
      <D.10915>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      return;
      <D.10916>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.10917 = thr_ret != 0;
      D.10918 = (long int) D.10917;
      D.10919 = __builtin_expect (D.10918, 0);
      if (D.10919 != 0) goto <D.10920>; else goto <D.10921>;
      <D.10920>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 340, "thr_ret == 0");
      <D.10921>:
      mutex_handle.16 = mutex_handle;
      D.10923 = mutex_handle.16->pid;
      if (D.10923 == pid) goto <D.10924>; else goto <D.10925>;
      <D.10924>:
      mutex_handle.16 = mutex_handle;
      D.10926 = mutex_handle.16->tid;
      D.10927 = pthread_equal (D.10926, tid);
      if (D.10927 != 0) goto <D.10928>; else goto <D.10929>;
      <D.10928>:
      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.10929>:
      <D.10925>:
      _wapi_handle_unlock_shared_handles ();
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


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

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


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


mutex_create (struct WapiSecurityAttributes * security, gboolean owned)
{
  void * D.10939;
  long int D.10940;
  long int D.10941;
  _Bool D.10944;
  long int D.10945;
  long int D.10946;
  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.10937>; else goto <D.10938>;
      <D.10937>:
      monoeg_g_log (0B, 16, "%s: error creating mutex handle", &__func__);
      SetLastError (31);
      D.10939 = 0B;
      return D.10939;
      <D.10938>:
      {
        struct __pthread_unwind_buf_t __cancel_buf;
        void (*<Tc6>) (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.10940 = (long int) __not_first_call;
            D.10941 = __builtin_expect (D.10940, 0);
            if (D.10941 != 0) goto <D.10942>; else goto <D.10943>;
            <D.10942>:
            __cancel_routine (__cancel_arg);
            __pthread_unwind_next (&__cancel_buf);
            <D.10943>:
            __pthread_register_cancel (&__cancel_buf);
            thr_ret = _wapi_handle_lock_handle (handle);
            D.10944 = thr_ret != 0;
            D.10945 = (long int) D.10944;
            D.10946 = __builtin_expect (D.10945, 0);
            if (D.10946 != 0) goto <D.10947>; else goto <D.10948>;
            <D.10947>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 398, "thr_ret == 0");
            <D.10948>:
            if (owned == 1) goto <D.10949>; else goto <D.10950>;
            <D.10949>:
            mutex_own (handle);
            goto <D.10951>;
            <D.10950>:
            _wapi_handle_set_signal_state (handle, 1, 0);
            <D.10951>:
            thr_ret = _wapi_handle_unlock_handle (handle);
            D.10944 = thr_ret != 0;
            D.10945 = (long int) D.10944;
            D.10946 = __builtin_expect (D.10945, 0);
            if (D.10946 != 0) goto <D.10952>; else goto <D.10953>;
            <D.10952>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 409, "thr_ret == 0");
            <D.10953>:
            __pthread_unregister_cancel (&__cancel_buf);
            if (0 != 0) goto <D.10954>; else goto <D.10955>;
            <D.10954>:
            __cancel_routine (__cancel_arg);
            <D.10955>:
          }
        finally
          {
            __cancel_buf = {CLOBBER};
          }
      }
      D.10939 = handle;
      return D.10939;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


namedmutex_create (struct WapiSecurityAttributes * security, gboolean owned, const gunichar2 * name)
{
  _Bool D.10961;
  long int D.10962;
  long int D.10963;
  long unsigned int D.10972;
  long unsigned int D.10975;
  long unsigned int D.10977;
  unsigned int offset.17;
  void * D.10989;
  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.10961 = thr_ret != 0;
      D.10962 = (long int) D.10961;
      D.10963 = __builtin_expect (D.10962, 0);
      if (D.10963 != 0) goto <D.10964>; else goto <D.10965>;
      <D.10964>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 430, "thr_ret == 0");
      <D.10965>:
      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.10966>; else goto <D.10967>;
      <D.10966>:
      SetLastError (6);
      goto cleanup;
      <D.10967>:
      if (offset != 0) goto <D.10968>; else goto <D.10969>;
      <D.10968>:
      SetLastError (183);
      <D.10969>:
      if (offset == 0) goto <D.10970>; else goto <D.10971>;
      <D.10970>:
      D.10972 = __strlen_g (utf8_name);
      if (D.10972 <= 259) goto <D.10973>; else goto <D.10974>;
      <D.10973>:
      D.10975 = __strlen_g (utf8_name);
      namelen = (guint32) D.10975;
      goto <D.10976>;
      <D.10974>:
      namelen = 260;
      <D.10976>:
      D.10977 = (long unsigned int) namelen;
      memcpy (&namedmutex_handle.sharedns.name, utf8_name, D.10977);
      handle = _wapi_handle_new (11, &namedmutex_handle);
      goto <D.10978>;
      <D.10971>:
      offset.17 = (unsigned int) offset;
      handle = _wapi_handle_new_from_offset (11, offset.17, 1);
      <D.10978>:
      if (handle == -1B) goto <D.10980>; else goto <D.10981>;
      <D.10980>:
      monoeg_g_log (0B, 16, "%s: error creating mutex handle", &__func__);
      SetLastError (31);
      goto cleanup;
      <D.10981>:
      ret = handle;
      if (offset == 0) goto <D.10982>; else goto <D.10983>;
      <D.10982>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.10961 = thr_ret != 0;
      D.10962 = (long int) D.10961;
      D.10963 = __builtin_expect (D.10962, 0);
      if (D.10963 != 0) goto <D.10984>; else goto <D.10985>;
      <D.10984>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 493, "thr_ret == 0");
      <D.10985>:
      if (owned == 1) goto <D.10986>; else goto <D.10987>;
      <D.10986>:
      namedmutex_own (handle);
      goto <D.10988>;
      <D.10987>:
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.10988>:
      _wapi_handle_unlock_shared_handles ();
      <D.10983>:
      cleanup:
      monoeg_g_free (utf8_name);
      _wapi_namespace_unlock (0B);
      D.10989 = ret;
      return D.10989;
    }
  finally
    {
      namedmutex_handle = {CLOBBER};
    }
}


_wapi_namespace_lock ()
{
  int D.10992;

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


__attribute__((__gnu_inline__))
__strlen_g (const char * __str)
{
  size_t D.10994;
  long int __ptr.18;
  long int __str.19;
  long int D.10997;
  char * __ptr;
  char * __tmp;

  __ptr = 0B;
  __tmp = __str;
  __asm__ __volatile__("   la    0,0
0: srst  %0,%1
   jo    0b
" : "=&a" __ptr, "=&a" __tmp : "0" __ptr, "1" __tmp : "0", "memory", "cc");
  __ptr.18 = (long int) __ptr;
  __str.19 = (long int) __str;
  D.10997 = __ptr.18 - __str.19;
  D.10994 = (size_t) D.10997;
  return D.10994;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.10999;
  long unsigned int D.11000;

  D.11000 = __builtin_object_size (__dest, 0);
  D.10999 = __builtin___memcpy_chk (__dest, __src, __len, D.11000);
  return D.10999;
}


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

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


ReleaseMutex (void * handle)
{
  gboolean D.11006;
  gboolean (*<T16f9>) (void *) D.11007;
  WapiHandleType type;

  if (handle == 0B) goto <D.11004>; else goto <D.11005>;
  <D.11004>:
  SetLastError (6);
  D.11006 = 0;
  return D.11006;
  <D.11005>:
  type = _wapi_handle_type (handle);
  D.11007 = mutex_ops[type].release;
  if (D.11007 == 0B) goto <D.11008>; else goto <D.11009>;
  <D.11008>:
  SetLastError (6);
  D.11006 = 0;
  return D.11006;
  <D.11009>:
  D.11007 = mutex_ops[type].release;
  D.11006 = D.11007 (handle);
  return D.11006;
}


namedmutex_release (void * handle)
{
  gboolean D.11013;
  _Bool D.11014;
  long int D.11015;
  long int D.11016;
  struct _WapiHandle_namedmutex * mutex_handle.20;
  long unsigned int D.11020;
  int D.11021;
  int D.11023;
  unsigned int D.11025;
  unsigned int D.11026;
  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.11011>; else goto <D.11012>;
      <D.11011>:
      monoeg_g_log (0B, 16, "%s: error looking up named mutex handle %p", &__func__, handle);
      D.11013 = 0;
      return D.11013;
      <D.11012>:
      thr_ret = _wapi_handle_lock_shared_handles ();
      D.11014 = thr_ret != 0;
      D.11015 = (long int) D.11014;
      D.11016 = __builtin_expect (D.11015, 0);
      if (D.11016 != 0) goto <D.11017>; else goto <D.11018>;
      <D.11017>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 616, "thr_ret == 0");
      <D.11018>:
      mutex_handle.20 = mutex_handle;
      D.11020 = mutex_handle.20->tid;
      D.11021 = pthread_equal (D.11020, tid);
      if (D.11021 == 0) goto cleanup; else goto <D.11022>;
      <D.11022>:
      mutex_handle.20 = mutex_handle;
      D.11023 = mutex_handle.20->pid;
      if (D.11023 != pid) goto cleanup; else goto <D.11024>;
      <D.11024>:
      ret = 1;
      mutex_handle.20 = mutex_handle;
      D.11025 = mutex_handle.20->recursion;
      D.11026 = D.11025 + 4294967295;
      mutex_handle.20->recursion = D.11026;
      mutex_handle.20 = mutex_handle;
      D.11025 = mutex_handle.20->recursion;
      if (D.11025 == 0) goto <D.11027>; else goto <D.11028>;
      <D.11027>:
      _wapi_thread_disown_mutex (handle);
      mutex_handle.20 = mutex_handle;
      mutex_handle.20->pid = 0;
      mutex_handle.20 = mutex_handle;
      mutex_handle.20->tid = 0;
      _wapi_shared_handle_set_signal_state (handle, 1);
      <D.11028>:
      cleanup:
      _wapi_handle_unlock_shared_handles ();
      D.11013 = ret;
      return D.11013;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


mutex_release (void * handle)
{
  gboolean D.11033;
  long int D.11034;
  long int D.11035;
  _Bool D.11038;
  long int D.11039;
  long int D.11040;
  struct _WapiHandle_mutex * mutex_handle.21;
  long unsigned int D.11044;
  int D.11045;
  int D.11047;
  unsigned int D.11049;
  unsigned int D.11050;
  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.11031>; else goto <D.11032>;
      <D.11031>:
      monoeg_g_log (0B, 16, "%s: error looking up mutex handle %p", &__func__, handle);
      D.11033 = 0;
      return D.11033;
      <D.11032>:
      {
        struct __pthread_unwind_buf_t __cancel_buf;
        void (*<Tc6>) (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.11034 = (long int) __not_first_call;
            D.11035 = __builtin_expect (D.11034, 0);
            if (D.11035 != 0) goto <D.11036>; else goto <D.11037>;
            <D.11036>:
            __cancel_routine (__cancel_arg);
            __pthread_unwind_next (&__cancel_buf);
            <D.11037>:
            __pthread_register_cancel (&__cancel_buf);
            thr_ret = _wapi_handle_lock_handle (handle);
            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", "mutexes.c", 565, "thr_ret == 0");
            <D.11042>:
            mutex_handle.21 = mutex_handle;
            D.11044 = mutex_handle.21->tid;
            D.11045 = pthread_equal (D.11044, tid);
            if (D.11045 == 0) goto cleanup; else goto <D.11046>;
            <D.11046>:
            mutex_handle.21 = mutex_handle;
            D.11047 = mutex_handle.21->pid;
            if (D.11047 != pid) goto cleanup; else goto <D.11048>;
            <D.11048>:
            ret = 1;
            mutex_handle.21 = mutex_handle;
            D.11049 = mutex_handle.21->recursion;
            D.11050 = D.11049 + 4294967295;
            mutex_handle.21->recursion = D.11050;
            mutex_handle.21 = mutex_handle;
            D.11049 = mutex_handle.21->recursion;
            if (D.11049 == 0) goto <D.11051>; else goto <D.11052>;
            <D.11051>:
            _wapi_thread_disown_mutex (handle);
            mutex_handle.21 = mutex_handle;
            mutex_handle.21->pid = 0;
            mutex_handle.21 = mutex_handle;
            mutex_handle.21->tid = 0;
            _wapi_handle_set_signal_state (handle, 1, 0);
            <D.11052>:
            cleanup:
            thr_ret = _wapi_handle_unlock_handle (handle);
            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", "mutexes.c", 592, "thr_ret == 0");
            <D.11054>:
            __pthread_unregister_cancel (&__cancel_buf);
            if (0 != 0) goto <D.11055>; else goto <D.11056>;
            <D.11055>:
            __cancel_routine (__cancel_arg);
            <D.11056>:
          }
        finally
          {
            __cancel_buf = {CLOBBER};
          }
      }
      D.11033 = ret;
      return D.11033;
    }
  finally
    {
      mutex_handle = {CLOBBER};
    }
}


OpenMutex (guint32 access, gboolean inherit, const gunichar2 * name)
{
  _Bool D.11063;
  long int D.11064;
  long int D.11065;
  unsigned int offset.22;
  void * D.11075;
  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.11063 = thr_ret != 0;
  D.11064 = (long int) D.11063;
  D.11065 = __builtin_expect (D.11064, 0);
  if (D.11065 != 0) goto <D.11066>; else goto <D.11067>;
  <D.11066>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mutexes.c", 689, "thr_ret == 0");
  <D.11067>:
  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.11068>; else goto <D.11069>;
  <D.11068>:
  SetLastError (6);
  goto cleanup;
  <D.11069>:
  if (offset == 0) goto <D.11070>; else goto <D.11071>;
  <D.11070>:
  SetLastError (2);
  goto cleanup;
  <D.11071>:
  offset.22 = (unsigned int) offset;
  handle = _wapi_handle_new_from_offset (11, offset.22, 1);
  if (handle == -1B) goto <D.11073>; else goto <D.11074>;
  <D.11073>:
  monoeg_g_log (0B, 16, "%s: error opening named mutex handle", &__func__);
  SetLastError (31);
  goto cleanup;
  <D.11074>:
  ret = handle;
  cleanup:
  monoeg_g_free (utf8_name);
  _wapi_namespace_unlock (0B);
  D.11075 = ret;
  return D.11075;
}


