sgen_mark_bridge_object (struct MonoObject * obj)
{
  int D.17504;
  _Bool D.17505;
  int D.17506;
  struct MonoObject * D.17507;
  struct SgenHashTable * hash_table;

  D.17504 = sgen_ptr_in_nursery (obj);
  D.17505 = D.17504 == 0;
  D.17506 = (int) D.17505;
  hash_table = get_finalize_entry_hash_table (D.17506);
  D.17507 = tagged_object_apply (obj, 1);
  sgen_hash_table_set_key (hash_table, obj, D.17507);
}


sgen_ptr_in_nursery (void * p)
{
  gboolean D.17508;
  int sgen_nursery_bits.0;
  int D.17510;
  int D.17511;
  unsigned int D.17512;
  unsigned int p.1;
  unsigned int D.17514;
  char * sgen_nursery_start.2;
  unsigned int sgen_nursery_start.3;
  _Bool D.17517;

  sgen_nursery_bits.0 = sgen_nursery_bits;
  D.17510 = 1 << sgen_nursery_bits.0;
  D.17511 = -D.17510;
  D.17512 = (unsigned int) D.17511;
  p.1 = (unsigned int) p;
  D.17514 = D.17512 & p.1;
  sgen_nursery_start.2 = sgen_nursery_start;
  sgen_nursery_start.3 = (unsigned int) sgen_nursery_start.2;
  D.17517 = D.17514 == sgen_nursery_start.3;
  D.17508 = (gboolean) D.17517;
  return D.17508;
}


get_finalize_entry_hash_table (int generation)
{
  struct SgenHashTable * D.17519;

  switch (generation) <default: <D.17212>, case 0: <D.17210>, case 1: <D.17211>>
  <D.17210>:
  D.17519 = &minor_finalizable_hash;
  return D.17519;
  <D.17211>:
  D.17519 = &major_finalizable_hash;
  return D.17519;
  <D.17212>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "sgen-fin-weak-hash.c", 94);
}


tagged_object_equals (struct MonoObject * a, struct MonoObject * b)
{
  gboolean D.17521;
  struct MonoObject * D.17522;
  struct MonoObject * D.17523;
  _Bool D.17524;

  D.17522 = tagged_object_get_object (a);
  D.17523 = tagged_object_get_object (b);
  D.17524 = D.17522 == D.17523;
  D.17521 = (gboolean) D.17524;
  return D.17521;
}


tagged_object_get_object (struct MonoObject * object)
{
  struct MonoObject * D.17526;
  unsigned int object.4;
  unsigned int D.17528;

  object.4 = (unsigned int) object;
  D.17528 = object.4 & 4294967294;
  D.17526 = (struct MonoObject *) D.17528;
  return D.17526;
}


tagged_object_hash (struct MonoObject * o)
{
  int D.17530;
  struct MonoObject * D.17531;

  D.17531 = tagged_object_get_object (o);
  D.17530 = mono_object_hash (D.17531);
  return D.17530;
}


tagged_object_apply (void * object, int tag_bits)
{
  struct MonoObject * D.17533;
  unsigned int object.5;
  unsigned int tag_bits.6;
  unsigned int D.17536;

  object.5 = (unsigned int) object;
  tag_bits.6 = (unsigned int) tag_bits;
  D.17536 = object.5 | tag_bits.6;
  D.17533 = (struct MonoObject *) D.17536;
  return D.17533;
}


sgen_collect_bridge_objects (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.7;
  unsigned int D.17541;
  gboolean (*<T2be4>) (char *) D.17544;
  int D.17545;
  int D.17548;
  int D.17551;
  char * copy.8;
  int D.17557;
  struct SgenHashTableEntry * D.17559;
  unsigned int D.17560;
  unsigned int D.17561;
  int D.17564;
  struct MonoObject * D.17565;
  struct FILE * gc_debug_file.9;
  const char * D.17569;
  const char * D.17572;
  struct MonoObject * D.17573;
  struct SgenHashTableEntry * D.17574;
  unsigned int D.17575;
  void (*CopyOrMarkObjectFunc) (void * *, struct SgenGrayQueue *) copy_func;
  struct GrayQueue * queue;
  struct SgenHashTable * hash_table;
  struct MonoObject * object;
  void * dummy;
  char * copy;

  try
    {
      copy_func = ctx.copy_func;
      queue = ctx.queue;
      hash_table = get_finalize_entry_hash_table (generation);
      no_finalize.7 = no_finalize;
      if (no_finalize.7 != 0) goto <D.17539>; else goto <D.17540>;
      <D.17539>:
      return;
      <D.17540>:
      {
        struct SgenHashTable * __hash_table;
        struct SgenHashTableEntry * * __table;
        guint __i;

        __hash_table = hash_table;
        __table = __hash_table->table;
        __i = 0;
        goto <D.17239>;
        <D.17238>:
        {
          struct SgenHashTableEntry * * __iter;
          struct SgenHashTableEntry * * __next;

          D.17541 = __i * 4;
          __iter = __table + D.17541;
          goto <D.17236>;
          <D.17235>:
          {
            struct SgenHashTableEntry * __entry;

            __entry = *__iter;
            __next = &__entry->next;
            object = __entry->key;
            dummy = &__entry->data;
            {
              int tag;

              tag = tagged_object_get_tag (object);
              object = tagged_object_get_object (object);
              if (tag == 1) goto <D.17542>; else goto <D.17543>;
              <D.17542>:
              // predicted unlikely by continue predictor.
              goto <D.17234>;
              <D.17543>:
              D.17544 = major_collector.is_object_live;
              D.17545 = D.17544 (object);
              if (D.17545 != 0) goto <D.17546>; else goto <D.17547>;
              <D.17546>:
              // predicted unlikely by continue predictor.
              goto <D.17234>;
              <D.17547>:
              D.17548 = sgen_gc_is_object_ready_for_finalization (object);
              if (D.17548 == 0) goto <D.17549>; else goto <D.17550>;
              <D.17549>:
              // predicted unlikely by continue predictor.
              goto <D.17234>;
              <D.17550>:
              D.17551 = sgen_is_bridge_object (object);
              if (D.17551 == 0) goto <D.17552>; else goto <D.17553>;
              <D.17552>:
              // predicted unlikely by continue predictor.
              goto <D.17234>;
              <D.17553>:
              copy = object;
              copy_func (&copy, queue);
              copy.8 = copy;
              sgen_bridge_register_finalized_object (copy.8);
              if (hash_table == &minor_finalizable_hash) goto <D.17556>; else goto <D.17555>;
              <D.17556>:
              copy.8 = copy;
              D.17557 = sgen_ptr_in_nursery (copy.8);
              if (D.17557 == 0) goto <D.17558>; else goto <D.17555>;
              <D.17558>:
              D.17559 = *__next;
              *__iter = D.17559;
              __next = __iter;
              D.17560 = __hash_table->num_entries;
              D.17561 = D.17560 + 4294967295;
              __hash_table->num_entries = D.17561;
              if (1 != 0) goto <D.17562>; else goto <D.17563>;
              <D.17562>:
              D.17564 = __hash_table->entry_mem_type;
              sgen_free_internal (__entry, D.17564);
              <D.17563>:
              copy.8 = copy;
              D.17565 = tagged_object_apply (copy.8, tag);
              sgen_hash_table_replace (&major_finalizable_hash, D.17565, 0B, 0B);
              if (0 != 0) goto <D.17566>; else goto <D.17567>;
              <D.17566>:
              gc_debug_file.9 = gc_debug_file;
              copy.8 = copy;
              copy.8 = copy;
              D.17569 = sgen_safe_name (copy.8);
              fprintf (gc_debug_file.9, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy.8, D.17569, object);
              gc_debug_file.9 = gc_debug_file;
              fflush (gc_debug_file.9);
              <D.17567>:
              // predicted unlikely by continue predictor.
              goto <D.17234>;
              <D.17555>:
              if (0 != 0) goto <D.17570>; else goto <D.17571>;
              <D.17570>:
              gc_debug_file.9 = gc_debug_file;
              copy.8 = copy;
              copy.8 = copy;
              D.17572 = sgen_safe_name (copy.8);
              fprintf (gc_debug_file.9, "Updating object for finalization: %p (%s) (was at %p)\n", copy.8, D.17572, object);
              gc_debug_file.9 = gc_debug_file;
              fflush (gc_debug_file.9);
              <D.17571>:
              copy.8 = copy;
              D.17573 = tagged_object_apply (copy.8, tag);
              __entry->key = D.17573;
            }
          }
          <D.17234>:
          __iter = __next;
          <D.17236>:
          D.17574 = *__iter;
          if (D.17574 != 0B) goto <D.17235>; else goto <D.17237>;
          <D.17237>:
        }
        __i = __i + 1;
        <D.17239>:
        D.17575 = hash_table->size;
        if (D.17575 > __i) goto <D.17238>; else goto <D.17240>;
        <D.17240>:
      }
    }
  finally
    {
      copy = {CLOBBER};
    }
}


tagged_object_get_tag (struct MonoObject * object)
{
  int D.17579;
  int object.10;

  object.10 = (int) object;
  D.17579 = object.10 & 1;
  return D.17579;
}


sgen_finalize_in_range (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.11;
  unsigned int D.17585;
  gboolean (*<T2be4>) (char *) D.17586;
  int D.17587;
  struct SgenHashTableEntry * D.17592;
  unsigned int D.17593;
  unsigned int D.17594;
  int D.17597;
  int num_ready_finalizers.12;
  int num_ready_finalizers.13;
  struct MonoObject * copy.14;
  struct FILE * gc_debug_file.15;
  const char * D.17604;
  unsigned int D.17605;
  int D.17608;
  struct MonoObject * D.17612;
  const char * D.17615;
  const char * D.17618;
  struct MonoObject * D.17619;
  struct SgenHashTableEntry * D.17620;
  unsigned int D.17621;
  void (*CopyOrMarkObjectFunc) (void * *, struct SgenGrayQueue *) copy_func;
  struct GrayQueue * queue;
  struct SgenHashTable * hash_table;
  struct MonoObject * object;
  void * dummy;

  copy_func = ctx.copy_func;
  queue = ctx.queue;
  hash_table = get_finalize_entry_hash_table (generation);
  no_finalize.11 = no_finalize;
  if (no_finalize.11 != 0) goto <D.17583>; else goto <D.17584>;
  <D.17583>:
  return;
  <D.17584>:
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

    __hash_table = hash_table;
    __table = __hash_table->table;
    __i = 0;
    goto <D.17264>;
    <D.17263>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.17585 = __i * 4;
      __iter = __table + D.17585;
      goto <D.17261>;
      <D.17260>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        {
          int tag;

          tag = tagged_object_get_tag (object);
          object = tagged_object_get_object (object);
          D.17586 = major_collector.is_object_live;
          D.17587 = D.17586 (object);
          if (D.17587 == 0) goto <D.17588>; else goto <D.17589>;
          <D.17588>:
          {
            gboolean is_fin_ready;
            struct MonoObject * copy;

            try
              {
                is_fin_ready = sgen_gc_is_object_ready_for_finalization (object);
                copy = object;
                copy_func (&copy, queue);
                if (is_fin_ready != 0) goto <D.17590>; else goto <D.17591>;
                <D.17590>:
                D.17592 = *__next;
                *__iter = D.17592;
                __next = __iter;
                D.17593 = __hash_table->num_entries;
                D.17594 = D.17593 + 4294967295;
                __hash_table->num_entries = D.17594;
                if (1 != 0) goto <D.17595>; else goto <D.17596>;
                <D.17595>:
                D.17597 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.17597);
                <D.17596>:
                num_ready_finalizers.12 = num_ready_finalizers;
                num_ready_finalizers.13 = num_ready_finalizers.12 + 1;
                num_ready_finalizers = num_ready_finalizers.13;
                copy.14 = copy;
                sgen_queue_finalization_entry (copy.14);
                if (0 != 0) goto <D.17601>; else goto <D.17602>;
                <D.17601>:
                gc_debug_file.15 = gc_debug_file;
                copy.14 = copy;
                copy.14 = copy;
                D.17604 = sgen_safe_name (copy.14);
                num_ready_finalizers.12 = num_ready_finalizers;
                D.17605 = hash_table->num_entries;
                fprintf (gc_debug_file.15, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", copy.14, D.17604, object, num_ready_finalizers.12, D.17605);
                gc_debug_file.15 = gc_debug_file;
                fflush (gc_debug_file.15);
                <D.17602>:
                // predicted unlikely by continue predictor.
                goto <D.17259>;
                <D.17591>:
                if (hash_table == &minor_finalizable_hash) goto <D.17607>; else goto <D.17606>;
                <D.17607>:
                copy.14 = copy;
                D.17608 = sgen_ptr_in_nursery (copy.14);
                if (D.17608 == 0) goto <D.17609>; else goto <D.17606>;
                <D.17609>:
                D.17592 = *__next;
                *__iter = D.17592;
                __next = __iter;
                D.17593 = __hash_table->num_entries;
                D.17594 = D.17593 + 4294967295;
                __hash_table->num_entries = D.17594;
                if (1 != 0) goto <D.17610>; else goto <D.17611>;
                <D.17610>:
                D.17597 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.17597);
                <D.17611>:
                copy.14 = copy;
                D.17612 = tagged_object_apply (copy.14, tag);
                sgen_hash_table_replace (&major_finalizable_hash, D.17612, 0B, 0B);
                if (0 != 0) goto <D.17613>; else goto <D.17614>;
                <D.17613>:
                gc_debug_file.15 = gc_debug_file;
                copy.14 = copy;
                copy.14 = copy;
                D.17615 = sgen_safe_name (copy.14);
                fprintf (gc_debug_file.15, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy.14, D.17615, object);
                gc_debug_file.15 = gc_debug_file;
                fflush (gc_debug_file.15);
                <D.17614>:
                // predicted unlikely by continue predictor.
                goto <D.17259>;
                <D.17606>:
                if (0 != 0) goto <D.17616>; else goto <D.17617>;
                <D.17616>:
                gc_debug_file.15 = gc_debug_file;
                copy.14 = copy;
                copy.14 = copy;
                D.17618 = sgen_safe_name (copy.14);
                fprintf (gc_debug_file.15, "Updating object for finalization: %p (%s) (was at %p)\n", copy.14, D.17618, object);
                gc_debug_file.15 = gc_debug_file;
                fflush (gc_debug_file.15);
                <D.17617>:
                copy.14 = copy;
                D.17619 = tagged_object_apply (copy.14, tag);
                __entry->key = D.17619;
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.17589>:
        }
      }
      <D.17259>:
      __iter = __next;
      <D.17261>:
      D.17620 = *__iter;
      if (D.17620 != 0B) goto <D.17260>; else goto <D.17262>;
      <D.17262>:
    }
    __i = __i + 1;
    <D.17264>:
    D.17621 = hash_table->size;
    if (D.17621 > __i) goto <D.17263>; else goto <D.17265>;
    <D.17265>:
  }
}


sgen_process_fin_stage_entries ()
{
  lock_stage_for_processing (&next_fin_stage_entry);
  process_stage_entries (1024, &next_fin_stage_entry, &fin_stage_entries, process_fin_stage_entry);
}


process_fin_stage_entry (struct MonoObject * obj, void * user_data, int index)
{
  int D.17625;

  D.17625 = sgen_ptr_in_nursery (obj);
  if (D.17625 != 0) goto <D.17626>; else goto <D.17627>;
  <D.17626>:
  register_for_finalization (obj, user_data, 0);
  goto <D.17628>;
  <D.17627>:
  register_for_finalization (obj, user_data, 1);
  <D.17628>:
}


register_for_finalization (struct MonoObject * obj, void * user_data, int generation)
{
  int no_finalize.16;
  int iftmp.17;
  _Bool D.17637;
  long int D.17638;
  long int D.17639;
  int D.17644;
  struct FILE * gc_debug_file.18;
  struct MonoVTable * D.17650;
  struct MonoClass * D.17651;
  const char * D.17652;
  unsigned int D.17653;
  const char * D.17654;
  int D.17656;
  struct SgenHashTable * hash_table;

  hash_table = get_finalize_entry_hash_table (generation);
  no_finalize.16 = no_finalize;
  if (no_finalize.16 != 0) goto <D.17630>; else goto <D.17631>;
  <D.17630>:
  return;
  <D.17631>:
  if (user_data != 0B) goto <D.17635>; else goto <D.17633>;
  <D.17635>:
  if (user_data != mono_gc_run_finalize) goto <D.17636>; else goto <D.17633>;
  <D.17636>:
  iftmp.17 = 1;
  goto <D.17634>;
  <D.17633>:
  iftmp.17 = 0;
  <D.17634>:
  D.17637 = iftmp.17 != 0;
  D.17638 = (long int) D.17637;
  D.17639 = __builtin_expect (D.17638, 0);
  if (D.17639 != 0) goto <D.17640>; else goto <D.17641>;
  <D.17640>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-fin-weak-hash.c", 223, "user_data == NULL || user_data == mono_gc_run_finalize");
  <D.17641>:
  if (user_data != 0B) goto <D.17642>; else goto <D.17643>;
  <D.17642>:
  D.17644 = sgen_hash_table_replace (hash_table, obj, 0B, 0B);
  if (D.17644 != 0) goto <D.17645>; else goto <D.17646>;
  <D.17645>:
  if (0 != 0) goto <D.17647>; else goto <D.17648>;
  <D.17647>:
  gc_debug_file.18 = gc_debug_file;
  D.17650 = obj->vtable;
  D.17651 = D.17650->klass;
  D.17652 = D.17651->name;
  D.17653 = hash_table->num_entries;
  D.17654 = sgen_generation_name (generation);
  fprintf (gc_debug_file.18, "Added finalizer for object: %p (%s) (%d) to %s table\n", obj, D.17652, D.17653, D.17654);
  gc_debug_file.18 = gc_debug_file;
  fflush (gc_debug_file.18);
  <D.17648>:
  <D.17646>:
  goto <D.17655>;
  <D.17643>:
  D.17656 = sgen_hash_table_remove (hash_table, obj, 0B);
  if (D.17656 != 0) goto <D.17657>; else goto <D.17658>;
  <D.17657>:
  if (0 != 0) goto <D.17659>; else goto <D.17660>;
  <D.17659>:
  gc_debug_file.18 = gc_debug_file;
  D.17650 = obj->vtable;
  D.17651 = D.17650->klass;
  D.17652 = D.17651->name;
  D.17653 = hash_table->num_entries;
  fprintf (gc_debug_file.18, "Removed finalizer for object: %p (%s) (%d)\n", obj, D.17652, D.17653);
  gc_debug_file.18 = gc_debug_file;
  fflush (gc_debug_file.18);
  <D.17660>:
  <D.17658>:
  <D.17655>:
}


lock_stage_for_processing (volatile gint32 * next_entry)
{
  *next_entry = -1;
}


process_stage_entries (int num_entries, volatile gint32 * next_entry, struct StageEntry * entries, void (*<T2e91>) (struct MonoObject *, void *, int) process_func)
{
  int D.17662;
  unsigned int i.19;
  unsigned int D.17666;
  struct StageEntry * D.17667;
  volatile gint32 * D.17668;
  int D.17669;
  struct MonoObject * D.17673;
  void * D.17674;
  int i;
  void retry = <<< error >>>;

  D.17662 = *next_entry;
  if (D.17662 != -1) goto <D.17663>; else goto <D.17664>;
  <D.17663>:
  return;
  <D.17664>:
  i = 0;
  goto <D.17308>;
  <D.17307>:
  {
    gint32 state;

    retry:
    i.19 = (unsigned int) i;
    D.17666 = i.19 * 12;
    D.17667 = entries + D.17666;
    state = D.17667->state;
    switch (state) <default: <D.17305>, case 0: <D.17299>, case 1: <D.17302>, case 2: <D.17303>, case 3: <D.17300>>
    <D.17299>:
    <D.17300>:
    // predicted unlikely by continue predictor.
    goto <D.17301>;
    <D.17302>:
    i.19 = (unsigned int) i;
    D.17666 = i.19 * 12;
    D.17667 = entries + D.17666;
    D.17668 = &D.17667->state;
    D.17669 = InterlockedCompareExchange (D.17668, 3, 1);
    if (D.17669 != 1) goto retry; else goto <D.17670>;
    <D.17670>:
    // predicted unlikely by continue predictor.
    goto <D.17301>;
    <D.17303>:
    goto <D.17304>;
    <D.17305>:
    if (1 != 0) goto <D.17671>; else goto <D.17672>;
    <D.17671>:
    monoeg_g_log (0B, 4, "Invalid stage entry state");
    <D.17306>:
    goto <D.17306>;
    <D.17672>:
    goto <D.17304>;
    <D.17304>:
    i.19 = (unsigned int) i;
    D.17666 = i.19 * 12;
    D.17667 = entries + D.17666;
    D.17673 = D.17667->obj;
    i.19 = (unsigned int) i;
    D.17666 = i.19 * 12;
    D.17667 = entries + D.17666;
    D.17674 = D.17667->user_data;
    process_func (D.17673, D.17674, i);
    i.19 = (unsigned int) i;
    D.17666 = i.19 * 12;
    D.17667 = entries + D.17666;
    D.17667->obj = 0B;
    i.19 = (unsigned int) i;
    D.17666 = i.19 * 12;
    D.17667 = entries + D.17666;
    D.17667->user_data = 0B;
    mono_memory_write_barrier ();
    i.19 = (unsigned int) i;
    D.17666 = i.19 * 12;
    D.17667 = entries + D.17666;
    D.17667->state = 0;
  }
  <D.17301>:
  i = i + 1;
  <D.17308>:
  if (i < num_entries) goto <D.17307>; else goto <D.17309>;
  <D.17309>:
  mono_memory_write_barrier ();
  *next_entry = 0;
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.17678;
  unsigned int comp.20;
  unsigned int exch.21;
  unsigned int D.17681;

  comp.20 = (unsigned int) comp;
  exch.21 = (unsigned int) exch;
  D.17681 = __sync_val_compare_and_swap_4 (dest, comp.20, exch.21);
  D.17678 = (gint32) D.17681;
  return D.17678;
}


mono_memory_write_barrier ()
{
  mono_memory_barrier ();
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


mono_gc_register_for_finalization (struct MonoObject * obj, void * user_data)
{
  int D.17683;
  int D.17686;

  goto <D.17344>;
  <D.17343>:
  D.17683 = try_lock_stage_for_processing (1024, &next_fin_stage_entry);
  if (D.17683 != 0) goto <D.17684>; else goto <D.17685>;
  <D.17684>:
  pthread_mutex_lock (&gc_mutex);
  process_stage_entries (1024, &next_fin_stage_entry, &fin_stage_entries, process_fin_stage_entry);
  sgen_gc_unlock ();
  <D.17685>:
  <D.17344>:
  D.17686 = add_stage_entry (1024, &next_fin_stage_entry, &fin_stage_entries, obj, user_data);
  if (D.17686 == -1) goto <D.17343>; else goto <D.17345>;
  <D.17345>:
}


try_lock_stage_for_processing (int num_entries, volatile gint32 * next_entry)
{
  gboolean D.17689;
  int D.17690;
  _Bool D.17691;
  gint32 old;

  old = *next_entry;
  if (old < num_entries) goto <D.17687>; else goto <D.17688>;
  <D.17687>:
  D.17689 = 0;
  return D.17689;
  <D.17688>:
  D.17690 = InterlockedCompareExchange (next_entry, -1, old);
  D.17691 = D.17690 == old;
  D.17689 = (gboolean) D.17691;
  return D.17689;
}


add_stage_entry (int num_entries, volatile gint32 * next_entry, struct StageEntry * entries, struct MonoObject * obj, void * user_data)
{
  int D.17695;
  unsigned int index.22;
  unsigned int D.17701;
  struct StageEntry * D.17702;
  int D.17703;
  volatile gint32 * D.17705;
  int D.17706;
  int D.17707;
  int D.17710;
  int iftmp.23;
  _Bool D.17718;
  long int D.17719;
  long int D.17720;
  volatile gint32 * D.17723;
  int iftmp.24;
  _Bool D.17731;
  long int D.17732;
  long int D.17733;
  _Bool D.17736;
  long int D.17737;
  long int D.17738;
  gint32 index;
  gint32 new_next_entry;
  gint32 old_next_entry;
  gint32 previous_state;
  void retry = <<< error >>>;

  retry:
  <D.17327>:
  index = *next_entry;
  if (index >= num_entries) goto <D.17693>; else goto <D.17694>;
  <D.17693>:
  D.17695 = -1;
  return D.17695;
  <D.17694>:
  if (index < 0) goto <D.17696>; else goto <D.17697>;
  <D.17696>:
  goto <D.17323>;
  <D.17322>:
  monoeg_g_usleep (200);
  <D.17323>:
  index = *next_entry;
  if (index < 0) goto <D.17322>; else goto <D.17324>;
  <D.17324>:
  // predicted unlikely by continue predictor.
  goto <D.17325>;
  <D.17697>:
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17703 = D.17702->state;
  if (D.17703 != 0) goto <D.17698>; else goto <D.17704>;
  <D.17704>:
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17705 = &D.17702->state;
  D.17706 = InterlockedCompareExchange (D.17705, 1, 0);
  if (D.17706 != 0) goto <D.17698>; else goto <D.17699>;
  <D.17698>:
  D.17707 = *next_entry;
  if (D.17707 == index) goto <D.17708>; else goto <D.17709>;
  <D.17708>:
  D.17710 = index + 1;
  InterlockedCompareExchange (next_entry, D.17710, index);
  <D.17709>:
  // predicted unlikely by continue predictor.
  goto <D.17325>;
  <D.17699>:
  mono_memory_write_barrier ();
  D.17710 = index + 1;
  old_next_entry = InterlockedCompareExchange (next_entry, D.17710, index);
  if (old_next_entry < index) goto <D.17711>; else goto <D.17712>;
  <D.17711>:
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17702->state = 0;
  // predicted unlikely by continue predictor.
  goto <D.17325>;
  <D.17712>:
  goto <D.17326>;
  <D.17325>:
  goto <D.17327>;
  <D.17326>:
  if (index < 0) goto <D.17714>; else goto <D.17717>;
  <D.17717>:
  if (index >= num_entries) goto <D.17714>; else goto <D.17715>;
  <D.17714>:
  iftmp.23 = 1;
  goto <D.17716>;
  <D.17715>:
  iftmp.23 = 0;
  <D.17716>:
  D.17718 = iftmp.23 != 0;
  D.17719 = (long int) D.17718;
  D.17720 = __builtin_expect (D.17719, 0);
  if (D.17720 != 0) goto <D.17721>; else goto <D.17722>;
  <D.17721>:
  monoeg_g_log (0B, 4, "Invalid index");
  <D.17328>:
  goto <D.17328>;
  <D.17722>:
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17702->obj = obj;
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17702->user_data = user_data;
  mono_memory_write_barrier ();
  new_next_entry = *next_entry;
  mono_memory_read_barrier ();
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17723 = &D.17702->state;
  previous_state = InterlockedCompareExchange (D.17723, 2, 1);
  if (previous_state == 1) goto <D.17724>; else goto <D.17725>;
  <D.17724>:
  if (new_next_entry < index) goto <D.17729>; else goto <D.17727>;
  <D.17729>:
  if (new_next_entry >= 0) goto <D.17730>; else goto <D.17727>;
  <D.17730>:
  iftmp.24 = 1;
  goto <D.17728>;
  <D.17727>:
  iftmp.24 = 0;
  <D.17728>:
  D.17731 = iftmp.24 != 0;
  D.17732 = (long int) D.17731;
  D.17733 = __builtin_expect (D.17732, 0);
  if (D.17733 != 0) goto <D.17734>; else goto <D.17735>;
  <D.17734>:
  monoeg_g_log (0B, 4, "Invalid next entry index - as long as we\'re busy, other thread can only increment or invalidate it");
  <D.17329>:
  goto <D.17329>;
  <D.17735>:
  D.17695 = index;
  return D.17695;
  <D.17725>:
  D.17736 = previous_state != 3;
  D.17737 = (long int) D.17736;
  D.17738 = __builtin_expect (D.17737, 0);
  if (D.17738 != 0) goto <D.17739>; else goto <D.17740>;
  <D.17739>:
  monoeg_g_log (0B, 4, "Invalid state transition - other thread can only make busy state invalid");
  <D.17330>:
  goto <D.17330>;
  <D.17740>:
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17702->obj = 0B;
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17702->user_data = 0B;
  mono_memory_write_barrier ();
  index.22 = (unsigned int) index;
  D.17701 = index.22 * 12;
  D.17702 = entries + D.17701;
  D.17702->state = 0;
  goto retry;
}


mono_memory_read_barrier ()
{
  mono_memory_barrier ();
}


mono_gc_finalizers_for_domain (struct MonoDomain * domain, struct MonoObject * * out_array, int out_size)
{
  unsigned int result.25;
  unsigned int D.17745;
  struct MonoObject * * D.17746;
  int D.17747;
  int D.17748;
  int D.17749;
  int result;

  pthread_mutex_lock (&gc_mutex);
  sgen_process_fin_stage_entries ();
  result = finalizers_for_domain (domain, out_array, out_size, &minor_finalizable_hash);
  if (result < out_size) goto <D.17742>; else goto <D.17743>;
  <D.17742>:
  result.25 = (unsigned int) result;
  D.17745 = result.25 * 4;
  D.17746 = out_array + D.17745;
  D.17747 = out_size - result;
  D.17748 = finalizers_for_domain (domain, D.17746, D.17747, &major_finalizable_hash);
  result = D.17748 + result;
  <D.17743>:
  sgen_gc_unlock ();
  D.17749 = result;
  return D.17749;
}


finalizers_for_domain (struct MonoDomain * domain, struct MonoObject * * out_array, int out_size, struct SgenHashTable * hash_table)
{
  int no_finalize.26;
  int D.17756;
  unsigned int D.17757;
  struct MonoVTable * D.17758;
  struct MonoDomain * D.17759;
  struct SgenHashTableEntry * D.17762;
  unsigned int D.17763;
  unsigned int D.17764;
  int D.17767;
  int count.27;
  unsigned int count.28;
  unsigned int D.17770;
  struct MonoObject * * D.17771;
  struct FILE * gc_debug_file.29;
  const char * D.17775;
  int num_ready_finalizers.30;
  unsigned int D.17777;
  struct SgenHashTableEntry * D.17780;
  unsigned int D.17781;
  struct MonoObject * object;
  void * dummy;
  int count;

  no_finalize.26 = no_finalize;
  if (no_finalize.26 != 0) goto <D.17751>; else goto <D.17754>;
  <D.17754>:
  if (out_size == 0) goto <D.17751>; else goto <D.17755>;
  <D.17755>:
  if (out_array == 0B) goto <D.17751>; else goto <D.17752>;
  <D.17751>:
  D.17756 = 0;
  return D.17756;
  <D.17752>:
  count = 0;
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

    __hash_table = hash_table;
    __table = __hash_table->table;
    __i = 0;
    goto <D.17366>;
    <D.17365>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.17757 = __i * 4;
      __iter = __table + D.17757;
      goto <D.17363>;
      <D.17362>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.17758 = object->vtable;
        D.17759 = D.17758->domain;
        if (D.17759 == domain) goto <D.17760>; else goto <D.17761>;
        <D.17760>:
        D.17762 = *__next;
        *__iter = D.17762;
        __next = __iter;
        D.17763 = __hash_table->num_entries;
        D.17764 = D.17763 + 4294967295;
        __hash_table->num_entries = D.17764;
        if (1 != 0) goto <D.17765>; else goto <D.17766>;
        <D.17765>:
        D.17767 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.17767);
        <D.17766>:
        count.27 = count;
        count = count.27 + 1;
        count.28 = (unsigned int) count.27;
        D.17770 = count.28 * 4;
        D.17771 = out_array + D.17770;
        *D.17771 = object;
        if (0 != 0) goto <D.17772>; else goto <D.17773>;
        <D.17772>:
        gc_debug_file.29 = gc_debug_file;
        D.17775 = sgen_safe_name (object);
        num_ready_finalizers.30 = num_ready_finalizers;
        D.17777 = hash_table->num_entries;
        fprintf (gc_debug_file.29, "Collecting object for finalization: %p (%s) (%d/%d)\n", object, D.17775, num_ready_finalizers.30, D.17777);
        gc_debug_file.29 = gc_debug_file;
        fflush (gc_debug_file.29);
        <D.17773>:
        if (count == out_size) goto <D.17778>; else goto <D.17779>;
        <D.17778>:
        D.17756 = count;
        return D.17756;
        <D.17779>:
        // predicted unlikely by continue predictor.
        goto <D.17361>;
        <D.17761>:
      }
      <D.17361>:
      __iter = __next;
      <D.17363>:
      D.17780 = *__iter;
      if (D.17780 != 0B) goto <D.17362>; else goto <D.17364>;
      <D.17364>:
    }
    __i = __i + 1;
    <D.17366>:
    D.17781 = hash_table->size;
    if (D.17781 > __i) goto <D.17365>; else goto <D.17367>;
    <D.17367>:
  }
  D.17756 = count;
  return D.17756;
}


sgen_null_link_in_range (int generation, gboolean before_finalization, struct ScanCopyContext ctx)
{
  unsigned int D.17783;
  void * D.17784;
  struct FILE * gc_debug_file.31;
  long unsigned int D.17790;
  long unsigned int D.17791;
  _Bool D.17792;
  long unsigned int D.17795;
  long unsigned int D.17796;
  gboolean (*<T2be4>) (char *) D.17801;
  int D.17802;
  int D.17805;
  struct SgenHashTableEntry * D.17810;
  unsigned int D.17811;
  unsigned int D.17812;
  int D.17815;
  char * copy.32;
  int D.17819;
  _Bool D.17823;
  long int D.17824;
  long int D.17825;
  long unsigned int iftmp.33;
  long unsigned int copy.34;
  long unsigned int D.17833;
  long unsigned int D.17834;
  void * D.17835;
  long unsigned int iftmp.35;
  long unsigned int D.17842;
  long unsigned int D.17843;
  void * D.17844;
  void * D.17847;
  struct SgenHashTableEntry * D.17848;
  unsigned int D.17849;
  void (*CopyOrMarkObjectFunc) (void * *, struct SgenGrayQueue *) copy_func;
  struct GrayQueue * queue;
  void * * link;
  void * dummy;
  struct SgenHashTable * hash;

  copy_func = ctx.copy_func;
  queue = ctx.queue;
  hash = get_dislink_hash_table (generation);
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

    __hash_table = hash;
    __table = __hash_table->table;
    __i = 0;
    goto <D.17412>;
    <D.17411>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.17783 = __i * 4;
      __iter = __table + D.17783;
      goto <D.17409>;
      <D.17408>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        link = __entry->key;
        dummy = &__entry->data;
        {
          char * object;
          gboolean track;

          D.17784 = *link;
          if (D.17784 == 0B) goto <D.17785>; else goto <D.17786>;
          <D.17785>:
          if (0 != 0) goto <D.17787>; else goto <D.17788>;
          <D.17787>:
          gc_debug_file.31 = gc_debug_file;
          fprintf (gc_debug_file.31, "Dislink %p was externally nullified\n", link);
          gc_debug_file.31 = gc_debug_file;
          fflush (gc_debug_file.31);
          <D.17788>:
          // predicted unlikely by continue predictor.
          goto <D.17406>;
          <D.17786>:
          D.17784 = *link;
          D.17790 = (long unsigned int) D.17784;
          D.17791 = D.17790 & 1;
          D.17792 = D.17791 == 0;
          track = (gboolean) D.17792;
          if (track != before_finalization) goto <D.17793>; else goto <D.17794>;
          <D.17793>:
          D.17784 = *link;
          D.17790 = (long unsigned int) D.17784;
          D.17795 = ~D.17790;
          D.17796 = D.17795 & 4294967292;
          object = (char *) D.17796;
          if (object == 0B) goto <D.17797>; else goto <D.17798>;
          <D.17797>:
          if (0 != 0) goto <D.17799>; else goto <D.17800>;
          <D.17799>:
          gc_debug_file.31 = gc_debug_file;
          fprintf (gc_debug_file.31, "Dislink %p with a hidden null object\n", link);
          gc_debug_file.31 = gc_debug_file;
          fflush (gc_debug_file.31);
          <D.17800>:
          // predicted unlikely by continue predictor.
          goto <D.17406>;
          <D.17798>:
          D.17801 = major_collector.is_object_live;
          D.17802 = D.17801 (object);
          if (D.17802 == 0) goto <D.17803>; else goto <D.17804>;
          <D.17803>:
          D.17805 = sgen_gc_is_object_ready_for_finalization (object);
          if (D.17805 != 0) goto <D.17806>; else goto <D.17807>;
          <D.17806>:
          *link = 0B;
          if (0 != 0) goto <D.17808>; else goto <D.17809>;
          <D.17808>:
          gc_debug_file.31 = gc_debug_file;
          fprintf (gc_debug_file.31, "Dislink nullified at %p to GCed object %p\n", link, object);
          gc_debug_file.31 = gc_debug_file;
          fflush (gc_debug_file.31);
          <D.17809>:
          D.17810 = *__next;
          *__iter = D.17810;
          __next = __iter;
          D.17811 = __hash_table->num_entries;
          D.17812 = D.17811 + 4294967295;
          __hash_table->num_entries = D.17812;
          if (1 != 0) goto <D.17813>; else goto <D.17814>;
          <D.17813>:
          D.17815 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.17815);
          <D.17814>:
          // predicted unlikely by continue predictor.
          goto <D.17406>;
          <D.17807>:
          {
            char * copy;

            try
              {
                copy = object;
                copy_func (&copy, queue);
                if (hash == &minor_disappearing_link_hash) goto <D.17817>; else goto <D.17816>;
                <D.17817>:
                copy.32 = copy;
                D.17819 = sgen_ptr_in_nursery (copy.32);
                if (D.17819 == 0) goto <D.17820>; else goto <D.17816>;
                <D.17820>:
                D.17810 = *__next;
                *__iter = D.17810;
                __next = __iter;
                D.17811 = __hash_table->num_entries;
                D.17812 = D.17811 + 4294967295;
                __hash_table->num_entries = D.17812;
                if (1 != 0) goto <D.17821>; else goto <D.17822>;
                <D.17821>:
                D.17815 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.17815);
                <D.17822>:
                copy.32 = copy;
                D.17823 = copy.32 == 0B;
                D.17824 = (long int) D.17823;
                D.17825 = __builtin_expect (D.17824, 0);
                if (D.17825 != 0) goto <D.17826>; else goto <D.17827>;
                <D.17826>:
                monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-fin-weak-hash.c", 700, "copy");
                <D.17827>:
                if (track != 0) goto <D.17829>; else goto <D.17830>;
                <D.17829>:
                iftmp.33 = 1;
                goto <D.17831>;
                <D.17830>:
                iftmp.33 = 0;
                <D.17831>:
                copy.32 = copy;
                copy.34 = (long unsigned int) copy.32;
                D.17833 = iftmp.33 | copy.34;
                D.17834 = ~D.17833;
                D.17835 = (void *) D.17834;
                *link = D.17835;
                copy.32 = copy;
                add_or_remove_disappearing_link (copy.32, link, 1);
                if (0 != 0) goto <D.17836>; else goto <D.17837>;
                <D.17836>:
                gc_debug_file.31 = gc_debug_file;
                copy.32 = copy;
                fprintf (gc_debug_file.31, "Upgraded dislink at %p to major because object %p moved to %p\n", link, object, copy.32);
                gc_debug_file.31 = gc_debug_file;
                fflush (gc_debug_file.31);
                <D.17837>:
                // predicted unlikely by continue predictor.
                goto <D.17406>;
                <D.17816>:
                if (track != 0) goto <D.17839>; else goto <D.17840>;
                <D.17839>:
                iftmp.35 = 1;
                goto <D.17841>;
                <D.17840>:
                iftmp.35 = 0;
                <D.17841>:
                copy.32 = copy;
                copy.34 = (long unsigned int) copy.32;
                D.17842 = iftmp.35 | copy.34;
                D.17843 = ~D.17842;
                D.17844 = (void *) D.17843;
                *link = D.17844;
                if (0 != 0) goto <D.17845>; else goto <D.17846>;
                <D.17845>:
                gc_debug_file.31 = gc_debug_file;
                D.17784 = *link;
                D.17790 = (long unsigned int) D.17784;
                D.17795 = ~D.17790;
                D.17796 = D.17795 & 4294967292;
                D.17847 = (void *) D.17796;
                fprintf (gc_debug_file.31, "Updated dislink at %p to %p\n", link, D.17847);
                gc_debug_file.31 = gc_debug_file;
                fflush (gc_debug_file.31);
                <D.17846>:
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.17804>:
          <D.17794>:
        }
      }
      <D.17406>:
      __iter = __next;
      <D.17409>:
      D.17848 = *__iter;
      if (D.17848 != 0B) goto <D.17408>; else goto <D.17410>;
      <D.17410>:
    }
    __i = __i + 1;
    <D.17412>:
    D.17849 = hash->size;
    if (D.17849 > __i) goto <D.17411>; else goto <D.17413>;
    <D.17413>:
  }
}


get_dislink_hash_table (int generation)
{
  struct SgenHashTable * D.17852;

  switch (generation) <default: <D.17381>, case 0: <D.17379>, case 1: <D.17380>>
  <D.17379>:
  D.17852 = &minor_disappearing_link_hash;
  return D.17852;
  <D.17380>:
  D.17852 = &major_disappearing_link_hash;
  return D.17852;
  <D.17381>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "sgen-fin-weak-hash.c", 608);
}


add_or_remove_disappearing_link (struct MonoObject * obj, void * * link, int generation)
{
  int D.17856;
  struct FILE * gc_debug_file.36;
  unsigned int D.17862;
  const char * D.17863;
  struct MonoVTable * D.17866;
  struct MonoClass * D.17867;
  const char * D.17868;
  const char * D.17869;
  struct SgenHashTable * hash_table;

  hash_table = get_dislink_hash_table (generation);
  if (obj == 0B) goto <D.17854>; else goto <D.17855>;
  <D.17854>:
  D.17856 = sgen_hash_table_remove (hash_table, link, 0B);
  if (D.17856 != 0) goto <D.17857>; else goto <D.17858>;
  <D.17857>:
  if (0 != 0) goto <D.17859>; else goto <D.17860>;
  <D.17859>:
  gc_debug_file.36 = gc_debug_file;
  D.17862 = hash_table->num_entries;
  D.17863 = sgen_generation_name (generation);
  fprintf (gc_debug_file.36, "Removed dislink %p (%d) from %s table\n", link, D.17862, D.17863);
  gc_debug_file.36 = gc_debug_file;
  fflush (gc_debug_file.36);
  <D.17860>:
  <D.17858>:
  return;
  <D.17855>:
  sgen_hash_table_replace (hash_table, link, 0B, 0B);
  if (0 != 0) goto <D.17864>; else goto <D.17865>;
  <D.17864>:
  gc_debug_file.36 = gc_debug_file;
  D.17866 = obj->vtable;
  D.17867 = D.17866->klass;
  D.17868 = D.17867->name;
  D.17869 = sgen_generation_name (generation);
  fprintf (gc_debug_file.36, "Added dislink for object: %p (%s) at %p to %s table\n", obj, D.17868, link, D.17869);
  gc_debug_file.36 = gc_debug_file;
  fflush (gc_debug_file.36);
  <D.17865>:
}


sgen_null_links_for_domain (struct MonoDomain * domain, int generation)
{
  unsigned int D.17871;
  void * D.17872;
  long unsigned int D.17873;
  long unsigned int D.17874;
  long unsigned int D.17875;
  struct MonoVTable * D.17880;
  struct FILE * gc_debug_file.37;
  struct SgenHashTableEntry * D.17888;
  unsigned int D.17889;
  unsigned int D.17890;
  int D.17893;
  struct SgenHashTableEntry * D.17894;
  unsigned int D.17895;
  void * * link;
  void * dummy;
  struct SgenHashTable * hash;

  hash = get_dislink_hash_table (generation);
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

    __hash_table = hash;
    __table = __hash_table->table;
    __i = 0;
    goto <D.17434>;
    <D.17433>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.17871 = __i * 4;
      __iter = __table + D.17871;
      goto <D.17431>;
      <D.17430>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        link = __entry->key;
        dummy = &__entry->data;
        {
          char * object;

          D.17872 = *link;
          D.17873 = (long unsigned int) D.17872;
          D.17874 = ~D.17873;
          D.17875 = D.17874 & 4294967292;
          object = (char *) D.17875;
          D.17872 = *link;
          if (D.17872 != 0B) goto <D.17876>; else goto <D.17877>;
          <D.17876>:
          if (object != 0B) goto <D.17878>; else goto <D.17879>;
          <D.17878>:
          D.17880 = MEM[(struct MonoObject *)object].vtable;
          if (D.17880 == 0B) goto <D.17881>; else goto <D.17882>;
          <D.17881>:
          {
            gboolean free;

            free = 1;
            D.17872 = *link;
            if (D.17872 != 0B) goto <D.17883>; else goto <D.17884>;
            <D.17883>:
            *link = 0B;
            free = 0;
            if (0 != 0) goto <D.17885>; else goto <D.17886>;
            <D.17885>:
            gc_debug_file.37 = gc_debug_file;
            fprintf (gc_debug_file.37, "Disappearing link %p not freed\n", link);
            gc_debug_file.37 = gc_debug_file;
            fflush (gc_debug_file.37);
            <D.17886>:
            <D.17884>:
            D.17888 = *__next;
            *__iter = D.17888;
            __next = __iter;
            D.17889 = __hash_table->num_entries;
            D.17890 = D.17889 + 4294967295;
            __hash_table->num_entries = D.17890;
            if (free != 0) goto <D.17891>; else goto <D.17892>;
            <D.17891>:
            D.17893 = __hash_table->entry_mem_type;
            sgen_free_internal (__entry, D.17893);
            <D.17892>:
            // predicted unlikely by continue predictor.
            goto <D.17429>;
          }
          <D.17882>:
          <D.17879>:
          <D.17877>:
        }
      }
      <D.17429>:
      __iter = __next;
      <D.17431>:
      D.17894 = *__iter;
      if (D.17894 != 0B) goto <D.17430>; else goto <D.17432>;
      <D.17432>:
    }
    __i = __i + 1;
    <D.17434>:
    D.17895 = hash->size;
    if (D.17895 > __i) goto <D.17433>; else goto <D.17435>;
    <D.17435>:
  }
}


sgen_null_links_with_predicate (int generation, mono_bool (*WeakLinkAlivePredicateFunc) (struct MonoObject *, void *) predicate, void * data)
{
  unsigned int D.17896;
  void * D.17897;
  long unsigned int D.17898;
  long unsigned int D.17899;
  long unsigned int D.17900;
  struct FILE * gc_debug_file.38;
  struct SgenHashTableEntry * D.17908;
  unsigned int D.17909;
  unsigned int D.17910;
  int D.17913;
  struct SgenHashTableEntry * D.17914;
  unsigned int D.17915;
  void * * link;
  void * dummy;
  struct SgenHashTable * hash;

  hash = get_dislink_hash_table (generation);
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

    __hash_table = hash;
    __table = __hash_table->table;
    __i = 0;
    goto <D.17457>;
    <D.17456>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.17896 = __i * 4;
      __iter = __table + D.17896;
      goto <D.17454>;
      <D.17453>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        link = __entry->key;
        dummy = &__entry->data;
        {
          char * object;
          mono_bool is_alive;

          D.17897 = *link;
          D.17898 = (long unsigned int) D.17897;
          D.17899 = ~D.17898;
          D.17900 = D.17899 & 4294967292;
          object = (char *) D.17900;
          D.17897 = *link;
          if (D.17897 == 0B) goto <D.17901>; else goto <D.17902>;
          <D.17901>:
          // predicted unlikely by continue predictor.
          goto <D.17452>;
          <D.17902>:
          is_alive = predicate (object, data);
          if (is_alive == 0) goto <D.17903>; else goto <D.17904>;
          <D.17903>:
          *link = 0B;
          if (0 != 0) goto <D.17905>; else goto <D.17906>;
          <D.17905>:
          gc_debug_file.38 = gc_debug_file;
          fprintf (gc_debug_file.38, "Dislink nullified by predicate at %p to GCed object %p\n", link, object);
          gc_debug_file.38 = gc_debug_file;
          fflush (gc_debug_file.38);
          <D.17906>:
          D.17908 = *__next;
          *__iter = D.17908;
          __next = __iter;
          D.17909 = __hash_table->num_entries;
          D.17910 = D.17909 + 4294967295;
          __hash_table->num_entries = D.17910;
          if (1 != 0) goto <D.17911>; else goto <D.17912>;
          <D.17911>:
          D.17913 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.17913);
          <D.17912>:
          // predicted unlikely by continue predictor.
          goto <D.17452>;
          <D.17904>:
        }
      }
      <D.17452>:
      __iter = __next;
      <D.17454>:
      D.17914 = *__iter;
      if (D.17914 != 0B) goto <D.17453>; else goto <D.17455>;
      <D.17455>:
    }
    __i = __i + 1;
    <D.17457>:
    D.17915 = hash->size;
    if (D.17915 > __i) goto <D.17456>; else goto <D.17458>;
    <D.17458>:
  }
}


sgen_remove_finalizers_for_domain (struct MonoDomain * domain, int generation)
{
  unsigned int D.17916;
  struct MonoVTable * D.17917;
  struct MonoDomain * D.17918;
  struct FILE * gc_debug_file.39;
  const char * D.17924;
  struct SgenHashTableEntry * D.17925;
  unsigned int D.17926;
  unsigned int D.17927;
  int D.17930;
  struct SgenHashTableEntry * D.17931;
  unsigned int D.17932;
  struct SgenHashTable * hash_table;
  struct MonoObject * object;
  void * dummy;

  hash_table = get_finalize_entry_hash_table (generation);
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

    __hash_table = hash_table;
    __table = __hash_table->table;
    __i = 0;
    goto <D.17477>;
    <D.17476>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.17916 = __i * 4;
      __iter = __table + D.17916;
      goto <D.17474>;
      <D.17473>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.17917 = object->vtable;
        D.17918 = D.17917->domain;
        if (D.17918 == domain) goto <D.17919>; else goto <D.17920>;
        <D.17919>:
        if (0 != 0) goto <D.17921>; else goto <D.17922>;
        <D.17921>:
        gc_debug_file.39 = gc_debug_file;
        D.17924 = sgen_safe_name (object);
        fprintf (gc_debug_file.39, "Unregistering finalizer for object: %p (%s)\n", object, D.17924);
        gc_debug_file.39 = gc_debug_file;
        fflush (gc_debug_file.39);
        <D.17922>:
        D.17925 = *__next;
        *__iter = D.17925;
        __next = __iter;
        D.17926 = __hash_table->num_entries;
        D.17927 = D.17926 + 4294967295;
        __hash_table->num_entries = D.17927;
        if (1 != 0) goto <D.17928>; else goto <D.17929>;
        <D.17928>:
        D.17930 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.17930);
        <D.17929>:
        // predicted unlikely by continue predictor.
        goto <D.17472>;
        <D.17920>:
      }
      <D.17472>:
      __iter = __next;
      <D.17474>:
      D.17931 = *__iter;
      if (D.17931 != 0B) goto <D.17473>; else goto <D.17475>;
      <D.17475>:
    }
    __i = __i + 1;
    <D.17477>:
    D.17932 = hash_table->size;
    if (D.17932 > __i) goto <D.17476>; else goto <D.17478>;
    <D.17478>:
  }
}


sgen_process_dislink_stage_entries ()
{
  lock_stage_for_processing (&next_dislink_stage_entry);
  process_stage_entries (1024, &next_dislink_stage_entry, &dislink_stage_entries, process_dislink_stage_entry);
}


process_dislink_stage_entry (struct MonoObject * obj, void * _link, int index)
{
  int D.17937;
  void * * link;

  link = _link;
  if (index >= 0) goto <D.17933>; else goto <D.17934>;
  <D.17933>:
  <D.17934>:
  add_or_remove_disappearing_link (0B, link, 0);
  add_or_remove_disappearing_link (0B, link, 1);
  if (obj != 0B) goto <D.17935>; else goto <D.17936>;
  <D.17935>:
  D.17937 = sgen_ptr_in_nursery (obj);
  if (D.17937 != 0) goto <D.17938>; else goto <D.17939>;
  <D.17938>:
  add_or_remove_disappearing_link (obj, link, 0);
  goto <D.17940>;
  <D.17939>:
  add_or_remove_disappearing_link (obj, link, 1);
  <D.17940>:
  <D.17936>:
}


sgen_register_disappearing_link (struct MonoObject * obj, void * * link, gboolean track, gboolean in_gc)
{
  long unsigned int iftmp.40;
  long unsigned int obj.41;
  long unsigned int D.17948;
  long unsigned int D.17949;
  void * D.17950;
  int D.17955;

  if (obj != 0B) goto <D.17941>; else goto <D.17942>;
  <D.17941>:
  if (track != 0) goto <D.17944>; else goto <D.17945>;
  <D.17944>:
  iftmp.40 = 1;
  goto <D.17946>;
  <D.17945>:
  iftmp.40 = 0;
  <D.17946>:
  obj.41 = (long unsigned int) obj;
  D.17948 = iftmp.40 | obj.41;
  D.17949 = ~D.17948;
  D.17950 = (void *) D.17949;
  *link = D.17950;
  goto <D.17951>;
  <D.17942>:
  *link = 0B;
  <D.17951>:
  if (in_gc != 0) goto <D.17952>; else goto <D.17953>;
  <D.17952>:
  process_dislink_stage_entry (obj, link, -1);
  goto <D.17954>;
  <D.17953>:
  {
    int index;

    goto <D.17498>;
    <D.17497>:
    D.17955 = try_lock_stage_for_processing (1024, &next_dislink_stage_entry);
    if (D.17955 != 0) goto <D.17956>; else goto <D.17957>;
    <D.17956>:
    pthread_mutex_lock (&gc_mutex);
    process_stage_entries (1024, &next_dislink_stage_entry, &dislink_stage_entries, process_dislink_stage_entry);
    sgen_gc_unlock ();
    <D.17957>:
    <D.17498>:
    index = add_stage_entry (1024, &next_dislink_stage_entry, &dislink_stage_entries, obj, link);
    if (index == -1) goto <D.17497>; else goto <D.17499>;
    <D.17499>:
  }
  <D.17954>:
}


sgen_init_fin_weak_hash ()
{

}


