mono_debugger_lock ()
{
  int initialized.0;
  _Bool D.16488;
  long int D.16489;
  long int D.16490;
  _Bool D.16495;
  long int D.16496;
  long int D.16497;
  unsigned int debugger_lock_level.1;
  unsigned int debugger_lock_level.2;

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

    ret = pthread_mutex_lock (&debugger_lock_mutex.mutex);
    if (ret != 0) goto <D.16493>; else goto <D.16494>;
    <D.16493>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.16494>:
    D.16495 = ret != 0;
    D.16496 = (long int) D.16495;
    D.16497 = __builtin_expect (D.16496, 0);
    if (D.16497 != 0) goto <D.16498>; else goto <D.16499>;
    <D.16498>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 46, "ret == 0");
    <D.16499>:
  }
  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.16503;
  long int D.16504;
  long int D.16505;
  unsigned int debugger_lock_level.4;
  unsigned int debugger_lock_level.5;
  _Bool D.16512;
  long int D.16513;
  long int D.16514;

  initialized.3 = initialized;
  D.16503 = initialized.3 == 0;
  D.16504 = (long int) D.16503;
  D.16505 = __builtin_expect (D.16504, 0);
  if (D.16505 != 0) goto <D.16506>; else goto <D.16507>;
  <D.16506>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 53, "initialized");
  <D.16507>:
  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.16510>; else goto <D.16511>;
    <D.16510>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.16511>:
    D.16512 = ret != 0;
    D.16513 = (long int) D.16512;
    D.16514 = __builtin_expect (D.16513, 0);
    if (D.16514 != 0) goto <D.16515>; else goto <D.16516>;
    <D.16515>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-debug-debugger.c", 55, "ret == 0");
    <D.16516>:
  }
}


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


mono_debugger_insert_method_breakpoint (struct MonoMethod * method, guint64 index)
{
  unsigned int D.16517;
  struct MonoDebugMethodAddressList * D.16518;
  struct GPtrArray * method_breakpoints.6;
  struct GPtrArray * method_breakpoints.7;
  struct MonoDebugMethodAddressList * D.16523;
  struct MethodBreakpointInfo * info;

  info = monoeg_malloc0 (12);
  info->method = method;
  D.16517 = (unsigned int) index;
  info->index = D.16517;
  D.16518 = mono_debug_lookup_method_addresses (method);
  info->address_list = D.16518;
  method_breakpoints.6 = method_breakpoints;
  if (method_breakpoints.6 == 0B) goto <D.16520>; else goto <D.16521>;
  <D.16520>:
  method_breakpoints.7 = monoeg_g_ptr_array_new ();
  method_breakpoints = method_breakpoints.7;
  <D.16521>:
  method_breakpoints.6 = method_breakpoints;
  monoeg_g_ptr_array_add (method_breakpoints.6, info);
  D.16523 = info->address_list;
  return D.16523;
}


mono_debugger_remove_method_breakpoint (guint64 index)
{
  struct GPtrArray * method_breakpoints.8;
  int D.16528;
  void * * D.16529;
  unsigned int i.9;
  unsigned int D.16531;
  void * * D.16532;
  unsigned int D.16533;
  long long unsigned int D.16534;
  struct MonoDebugMethodAddressList * D.16537;
  unsigned int i.10;
  unsigned int D.16539;
  int i;

  method_breakpoints.8 = method_breakpoints;
  if (method_breakpoints.8 == 0B) goto <D.16526>; else goto <D.16527>;
  <D.16526>:
  D.16528 = 0;
  return D.16528;
  <D.16527>:
  i = 0;
  goto <D.16484>;
  <D.16483>:
  {
    struct MethodBreakpointInfo * info;

    method_breakpoints.8 = method_breakpoints;
    D.16529 = method_breakpoints.8->pdata;
    i.9 = (unsigned int) i;
    D.16531 = i.9 * 4;
    D.16532 = D.16529 + D.16531;
    info = *D.16532;
    D.16533 = info->index;
    D.16534 = (long long unsigned int) D.16533;
    if (D.16534 != index) goto <D.16535>; else goto <D.16536>;
    <D.16535>:
    // predicted unlikely by continue predictor.
    goto <D.16482>;
    <D.16536>:
    method_breakpoints.8 = method_breakpoints;
    monoeg_g_ptr_array_remove (method_breakpoints.8, info);
    D.16537 = info->address_list;
    monoeg_g_free (D.16537);
    monoeg_g_free (info);
    D.16528 = 1;
    return D.16528;
  }
  <D.16482>:
  i = i + 1;
  <D.16484>:
  i.10 = (unsigned int) i;
  method_breakpoints.8 = method_breakpoints;
  D.16539 = method_breakpoints.8->len;
  if (i.10 < D.16539) goto <D.16483>; else goto <D.16485>;
  <D.16485>:
  D.16528 = 0;
  return D.16528;
}


