mono_debugger_lock ()
{
  int initialized.0;
  _Bool D.16516;
  long int D.16517;
  long int D.16518;
  _Bool D.16523;
  long int D.16524;
  long int D.16525;
  unsigned int debugger_lock_level.1;
  unsigned int debugger_lock_level.2;

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

    ret = pthread_mutex_lock (&debugger_lock_mutex.mutex);
    if (ret != 0) goto <D.16521>; else goto <D.16522>;
    <D.16521>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.16522>:
    D.16523 = ret != 0;
    D.16524 = (long int) D.16523;
    D.16525 = __builtin_expect (D.16524, 0);
    if (D.16525 != 0) goto <D.16526>; else goto <D.16527>;
    <D.16526>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 46, "ret == 0");
    <D.16527>:
  }
  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.16531;
  long int D.16532;
  long int D.16533;
  unsigned int debugger_lock_level.4;
  unsigned int debugger_lock_level.5;
  _Bool D.16540;
  long int D.16541;
  long int D.16542;

  initialized.3 = initialized;
  D.16531 = initialized.3 == 0;
  D.16532 = (long int) D.16531;
  D.16533 = __builtin_expect (D.16532, 0);
  if (D.16533 != 0) goto <D.16534>; else goto <D.16535>;
  <D.16534>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 53, "initialized");
  <D.16535>:
  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.16538>; else goto <D.16539>;
    <D.16538>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.16539>:
    D.16540 = ret != 0;
    D.16541 = (long int) D.16540;
    D.16542 = __builtin_expect (D.16541, 0);
    if (D.16542 != 0) goto <D.16543>; else goto <D.16544>;
    <D.16543>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 55, "ret == 0");
    <D.16544>:
  }
}


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


mono_debugger_insert_method_breakpoint (struct MonoMethod * method, guint64 index)
{
  unsigned int D.16545;
  struct MonoDebugMethodAddressList * D.16546;
  struct GPtrArray * method_breakpoints.6;
  struct GPtrArray * method_breakpoints.7;
  struct MonoDebugMethodAddressList * D.16551;
  struct MethodBreakpointInfo * info;

  info = monoeg_malloc0 (12);
  info->method = method;
  D.16545 = (unsigned int) index;
  info->index = D.16545;
  D.16546 = mono_debug_lookup_method_addresses (method);
  info->address_list = D.16546;
  method_breakpoints.6 = method_breakpoints;
  if (method_breakpoints.6 == 0B) goto <D.16548>; else goto <D.16549>;
  <D.16548>:
  method_breakpoints.7 = monoeg_g_ptr_array_new ();
  method_breakpoints = method_breakpoints.7;
  <D.16549>:
  method_breakpoints.6 = method_breakpoints;
  monoeg_g_ptr_array_add (method_breakpoints.6, info);
  D.16551 = info->address_list;
  return D.16551;
}


mono_debugger_remove_method_breakpoint (guint64 index)
{
  struct GPtrArray * method_breakpoints.8;
  int D.16556;
  void * * D.16557;
  unsigned int i.9;
  unsigned int D.16559;
  void * * D.16560;
  unsigned int D.16561;
  long long unsigned int D.16562;
  struct MonoDebugMethodAddressList * D.16565;
  unsigned int i.10;
  unsigned int D.16567;
  int i;

  method_breakpoints.8 = method_breakpoints;
  if (method_breakpoints.8 == 0B) goto <D.16554>; else goto <D.16555>;
  <D.16554>:
  D.16556 = 0;
  return D.16556;
  <D.16555>:
  i = 0;
  goto <D.16512>;
  <D.16511>:
  {
    struct MethodBreakpointInfo * info;

    method_breakpoints.8 = method_breakpoints;
    D.16557 = method_breakpoints.8->pdata;
    i.9 = (unsigned int) i;
    D.16559 = i.9 * 4;
    D.16560 = D.16557 + D.16559;
    info = *D.16560;
    D.16561 = info->index;
    D.16562 = (long long unsigned int) D.16561;
    if (D.16562 != index) goto <D.16563>; else goto <D.16564>;
    <D.16563>:
    // predicted unlikely by continue predictor.
    goto <D.16510>;
    <D.16564>:
    method_breakpoints.8 = method_breakpoints;
    monoeg_g_ptr_array_remove (method_breakpoints.8, info);
    D.16565 = info->address_list;
    monoeg_g_free (D.16565);
    monoeg_g_free (info);
    D.16556 = 1;
    return D.16556;
  }
  <D.16510>:
  i = i + 1;
  <D.16512>:
  i.10 = (unsigned int) i;
  method_breakpoints.8 = method_breakpoints;
  D.16567 = method_breakpoints.8->len;
  if (i.10 < D.16567) goto <D.16511>; else goto <D.16513>;
  <D.16513>:
  D.16556 = 0;
  return D.16556;
}


