mono_debugger_lock ()
{
  int initialized.0;
  _Bool D.16880;
  long int D.16881;
  long int D.16882;
  _Bool D.16887;
  long int D.16888;
  long int D.16889;
  unsigned int debugger_lock_level.1;
  unsigned int debugger_lock_level.2;

  initialized.0 = initialized;
  D.16880 = initialized.0 == 0;
  D.16881 = (long int) D.16880;
  D.16882 = __builtin_expect (D.16881, 0);
  if (D.16882 != 0) goto <D.16883>; else goto <D.16884>;
  <D.16883>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 45, "initialized");
  <D.16884>:
  {
    int ret;

    ret = pthread_mutex_lock (&debugger_lock_mutex.mutex);
    if (ret != 0) goto <D.16885>; else goto <D.16886>;
    <D.16885>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.16886>:
    D.16887 = ret != 0;
    D.16888 = (long int) D.16887;
    D.16889 = __builtin_expect (D.16888, 0);
    if (D.16889 != 0) goto <D.16890>; else goto <D.16891>;
    <D.16890>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 46, "ret == 0");
    <D.16891>:
  }
  debugger_lock_level.1 = debugger_lock_level;
  debugger_lock_level.2 = debugger_lock_level.1 + 1;
  debugger_lock_level = debugger_lock_level.2;
}


mono_debugger_unlock ()
{
  int initialized.3;
  _Bool D.16895;
  long int D.16896;
  long int D.16897;
  unsigned int debugger_lock_level.4;
  unsigned int debugger_lock_level.5;
  _Bool D.16904;
  long int D.16905;
  long int D.16906;

  initialized.3 = initialized;
  D.16895 = initialized.3 == 0;
  D.16896 = (long int) D.16895;
  D.16897 = __builtin_expect (D.16896, 0);
  if (D.16897 != 0) goto <D.16898>; else goto <D.16899>;
  <D.16898>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 53, "initialized");
  <D.16899>:
  debugger_lock_level.4 = debugger_lock_level;
  debugger_lock_level.5 = debugger_lock_level.4 + 4294967295;
  debugger_lock_level = debugger_lock_level.5;
  {
    int ret;

    ret = pthread_mutex_unlock (&debugger_lock_mutex.mutex);
    if (ret != 0) goto <D.16902>; else goto <D.16903>;
    <D.16902>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.16903>:
    D.16904 = ret != 0;
    D.16905 = (long int) D.16904;
    D.16906 = __builtin_expect (D.16905, 0);
    if (D.16906 != 0) goto <D.16907>; else goto <D.16908>;
    <D.16907>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 55, "ret == 0");
    <D.16908>:
  }
}


mono_debugger_initialize ()
{
  InitializeCriticalSection (&debugger_lock_mutex);
  initialized = 1;
}


mono_debugger_insert_method_breakpoint (struct MonoMethod * method, guint64 index)
{
  unsigned int D.16909;
  struct MonoDebugMethodAddressList * D.16910;
  struct GPtrArray * method_breakpoints.6;
  struct GPtrArray * method_breakpoints.7;
  struct MonoDebugMethodAddressList * D.16915;
  struct MethodBreakpointInfo * info;

  info = monoeg_malloc0 (24);
  info->method = method;
  D.16909 = (unsigned int) index;
  info->index = D.16909;
  D.16910 = mono_debug_lookup_method_addresses (method);
  info->address_list = D.16910;
  method_breakpoints.6 = method_breakpoints;
  if (method_breakpoints.6 == 0B) goto <D.16912>; else goto <D.16913>;
  <D.16912>:
  method_breakpoints.7 = monoeg_g_ptr_array_new ();
  method_breakpoints = method_breakpoints.7;
  <D.16913>:
  method_breakpoints.6 = method_breakpoints;
  monoeg_g_ptr_array_add (method_breakpoints.6, info);
  D.16915 = info->address_list;
  return D.16915;
}


mono_debugger_remove_method_breakpoint (guint64 index)
{
  struct GPtrArray * method_breakpoints.8;
  int D.16920;
  void * * D.16921;
  long unsigned int D.16922;
  long unsigned int D.16923;
  void * * D.16924;
  unsigned int D.16925;
  long unsigned int D.16926;
  struct MonoDebugMethodAddressList * D.16929;
  unsigned int i.9;
  unsigned int D.16931;
  int i;

  method_breakpoints.8 = method_breakpoints;
  if (method_breakpoints.8 == 0B) goto <D.16918>; else goto <D.16919>;
  <D.16918>:
  D.16920 = 0;
  return D.16920;
  <D.16919>:
  i = 0;
  goto <D.16876>;
  <D.16875>:
  {
    struct MethodBreakpointInfo * info;

    method_breakpoints.8 = method_breakpoints;
    D.16921 = method_breakpoints.8->pdata;
    D.16922 = (long unsigned int) i;
    D.16923 = D.16922 * 8;
    D.16924 = D.16921 + D.16923;
    info = *D.16924;
    D.16925 = info->index;
    D.16926 = (long unsigned int) D.16925;
    if (D.16926 != index) goto <D.16927>; else goto <D.16928>;
    <D.16927>:
    // predicted unlikely by continue predictor.
    goto <D.16874>;
    <D.16928>:
    method_breakpoints.8 = method_breakpoints;
    monoeg_g_ptr_array_remove (method_breakpoints.8, info);
    D.16929 = info->address_list;
    monoeg_g_free (D.16929);
    monoeg_g_free (info);
    D.16920 = 1;
    return D.16920;
  }
  <D.16874>:
  i = i + 1;
  <D.16876>:
  i.9 = (unsigned int) i;
  method_breakpoints.8 = method_breakpoints;
  D.16931 = method_breakpoints.8->len;
  if (i.9 < D.16931) goto <D.16875>; else goto <D.16877>;
  <D.16877>:
  D.16920 = 0;
  return D.16920;
}


