sgen_mark_bridge_object (struct MonoObject * obj)
{
  int D.17887;
  _Bool D.17888;
  int D.17889;
  struct MonoObject * D.17890;
  struct SgenHashTable * hash_table;

  D.17887 = sgen_ptr_in_nursery (obj);
  D.17888 = D.17887 == 0;
  D.17889 = (int) D.17888;
  hash_table = get_finalize_entry_hash_table (D.17889);
  D.17890 = tagged_object_apply (obj, 1);
  sgen_hash_table_set_key (hash_table, obj, D.17890);
}


sgen_ptr_in_nursery (void * p)
{
  gboolean D.17891;
  int sgen_nursery_bits.0;
  int D.17893;
  int D.17894;
  long unsigned int D.17895;
  long unsigned int p.1;
  long unsigned int D.17897;
  char * sgen_nursery_start.2;
  long unsigned int sgen_nursery_start.3;
  _Bool D.17900;

  sgen_nursery_bits.0 = sgen_nursery_bits;
  D.17893 = 1 << sgen_nursery_bits.0;
  D.17894 = -D.17893;
  D.17895 = (long unsigned int) D.17894;
  p.1 = (long unsigned int) p;
  D.17897 = D.17895 & p.1;
  sgen_nursery_start.2 = sgen_nursery_start;
  sgen_nursery_start.3 = (long unsigned int) sgen_nursery_start.2;
  D.17900 = D.17897 == sgen_nursery_start.3;
  D.17891 = (gboolean) D.17900;
  return D.17891;
}


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

  switch (generation) <default: <D.17595>, case 0: <D.17593>, case 1: <D.17594>>
  <D.17593>:
  D.17902 = &minor_finalizable_hash;
  return D.17902;
  <D.17594>:
  D.17902 = &major_finalizable_hash;
  return D.17902;
  <D.17595>:
  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.17904;
  struct MonoObject * D.17905;
  struct MonoObject * D.17906;
  _Bool D.17907;

  D.17905 = tagged_object_get_object (a);
  D.17906 = tagged_object_get_object (b);
  D.17907 = D.17905 == D.17906;
  D.17904 = (gboolean) D.17907;
  return D.17904;
}


tagged_object_get_object (struct MonoObject * object)
{
  struct MonoObject * D.17909;
  long unsigned int object.4;
  long unsigned int D.17911;

  object.4 = (long unsigned int) object;
  D.17911 = object.4 & 18446744073709551614;
  D.17909 = (struct MonoObject *) D.17911;
  return D.17909;
}


tagged_object_hash (struct MonoObject * o)
{
  int D.17913;
  struct MonoObject * D.17914;

  D.17914 = tagged_object_get_object (o);
  D.17913 = mono_object_hash (D.17914);
  return D.17913;
}


tagged_object_apply (void * object, int tag_bits)
{
  struct MonoObject * D.17916;
  long unsigned int D.17917;
  long unsigned int object.5;
  long unsigned int D.17919;

  D.17917 = (long unsigned int) tag_bits;
  object.5 = (long unsigned int) object;
  D.17919 = D.17917 | object.5;
  D.17916 = (struct MonoObject *) D.17919;
  return D.17916;
}


sgen_collect_bridge_objects (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.6;
  long unsigned int D.17924;
  long unsigned int D.17925;
  gboolean (*<T2c96>) (char *) D.17928;
  int D.17929;
  int D.17932;
  int D.17935;
  char * copy.7;
  int D.17941;
  struct SgenHashTableEntry * D.17943;
  unsigned int D.17944;
  unsigned int D.17945;
  int D.17948;
  struct MonoObject * D.17949;
  const char * D.17952;
  struct FILE * gc_debug_file.8;
  const char * D.17956;
  struct MonoObject * D.17957;
  struct SgenHashTableEntry * D.17958;
  unsigned int D.17959;
  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.6 = no_finalize;
      if (no_finalize.6 != 0) goto <D.17922>; else goto <D.17923>;
      <D.17922>:
      return;
      <D.17923>:
      {
        struct SgenHashTable * __hash_table;
        struct SgenHashTableEntry * * __table;
        guint __i;

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

          D.17924 = (long unsigned int) __i;
          D.17925 = D.17924 * 8;
          __iter = __table + D.17925;
          goto <D.17619>;
          <D.17618>:
          {
            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.17926>; else goto <D.17927>;
              <D.17926>:
              // predicted unlikely by continue predictor.
              goto <D.17617>;
              <D.17927>:
              D.17928 = major_collector.is_object_live;
              D.17929 = D.17928 (object);
              if (D.17929 != 0) goto <D.17930>; else goto <D.17931>;
              <D.17930>:
              // predicted unlikely by continue predictor.
              goto <D.17617>;
              <D.17931>:
              D.17932 = sgen_gc_is_object_ready_for_finalization (object);
              if (D.17932 == 0) goto <D.17933>; else goto <D.17934>;
              <D.17933>:
              // predicted unlikely by continue predictor.
              goto <D.17617>;
              <D.17934>:
              D.17935 = sgen_is_bridge_object (object);
              if (D.17935 == 0) goto <D.17936>; else goto <D.17937>;
              <D.17936>:
              // predicted unlikely by continue predictor.
              goto <D.17617>;
              <D.17937>:
              copy = object;
              copy_func (&copy, queue);
              copy.7 = copy;
              sgen_bridge_register_finalized_object (copy.7);
              if (hash_table == &minor_finalizable_hash) goto <D.17940>; else goto <D.17939>;
              <D.17940>:
              copy.7 = copy;
              D.17941 = sgen_ptr_in_nursery (copy.7);
              if (D.17941 == 0) goto <D.17942>; else goto <D.17939>;
              <D.17942>:
              D.17943 = *__next;
              *__iter = D.17943;
              __next = __iter;
              D.17944 = __hash_table->num_entries;
              D.17945 = D.17944 + 4294967295;
              __hash_table->num_entries = D.17945;
              if (1 != 0) goto <D.17946>; else goto <D.17947>;
              <D.17946>:
              D.17948 = __hash_table->entry_mem_type;
              sgen_free_internal (__entry, D.17948);
              <D.17947>:
              copy.7 = copy;
              D.17949 = tagged_object_apply (copy.7, tag);
              sgen_hash_table_replace (&major_finalizable_hash, D.17949, 0B, 0B);
              if (0 != 0) goto <D.17950>; else goto <D.17951>;
              <D.17950>:
              copy.7 = copy;
              D.17952 = sgen_safe_name (copy.7);
              copy.7 = copy;
              gc_debug_file.8 = gc_debug_file;
              fprintf (gc_debug_file.8, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy.7, D.17952, object);
              gc_debug_file.8 = gc_debug_file;
              fflush (gc_debug_file.8);
              <D.17951>:
              // predicted unlikely by continue predictor.
              goto <D.17617>;
              <D.17939>:
              if (0 != 0) goto <D.17954>; else goto <D.17955>;
              <D.17954>:
              copy.7 = copy;
              D.17956 = sgen_safe_name (copy.7);
              copy.7 = copy;
              gc_debug_file.8 = gc_debug_file;
              fprintf (gc_debug_file.8, "Updating object for finalization: %p (%s) (was at %p)\n", copy.7, D.17956, object);
              gc_debug_file.8 = gc_debug_file;
              fflush (gc_debug_file.8);
              <D.17955>:
              copy.7 = copy;
              D.17957 = tagged_object_apply (copy.7, tag);
              __entry->key = D.17957;
            }
          }
          <D.17617>:
          __iter = __next;
          <D.17619>:
          D.17958 = *__iter;
          if (D.17958 != 0B) goto <D.17618>; else goto <D.17620>;
          <D.17620>:
        }
        __i = __i + 1;
        <D.17622>:
        D.17959 = hash_table->size;
        if (D.17959 > __i) goto <D.17621>; else goto <D.17623>;
        <D.17623>:
      }
    }
  finally
    {
      copy = {CLOBBER};
    }
}


tagged_object_get_tag (struct MonoObject * object)
{
  int D.17963;
  long int object.9;
  int D.17965;

  object.9 = (long int) object;
  D.17965 = (int) object.9;
  D.17963 = D.17965 & 1;
  return D.17963;
}


sgen_finalize_in_range (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.10;
  long unsigned int D.17970;
  long unsigned int D.17971;
  gboolean (*<T2c96>) (char *) D.17972;
  int D.17973;
  struct SgenHashTableEntry * D.17978;
  unsigned int D.17979;
  unsigned int D.17980;
  int D.17983;
  int num_ready_finalizers.11;
  int num_ready_finalizers.12;
  struct MonoObject * copy.13;
  unsigned int D.17989;
  const char * D.17990;
  struct FILE * gc_debug_file.14;
  int D.17994;
  struct MonoObject * D.17998;
  const char * D.18001;
  const char * D.18004;
  struct MonoObject * D.18005;
  struct SgenHashTableEntry * D.18006;
  unsigned int D.18007;
  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.10 = no_finalize;
  if (no_finalize.10 != 0) goto <D.17968>; else goto <D.17969>;
  <D.17968>:
  return;
  <D.17969>:
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

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

      D.17970 = (long unsigned int) __i;
      D.17971 = D.17970 * 8;
      __iter = __table + D.17971;
      goto <D.17644>;
      <D.17643>:
      {
        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.17972 = major_collector.is_object_live;
          D.17973 = D.17972 (object);
          if (D.17973 == 0) goto <D.17974>; else goto <D.17975>;
          <D.17974>:
          {
            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.17976>; else goto <D.17977>;
                <D.17976>:
                D.17978 = *__next;
                *__iter = D.17978;
                __next = __iter;
                D.17979 = __hash_table->num_entries;
                D.17980 = D.17979 + 4294967295;
                __hash_table->num_entries = D.17980;
                if (1 != 0) goto <D.17981>; else goto <D.17982>;
                <D.17981>:
                D.17983 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.17983);
                <D.17982>:
                num_ready_finalizers.11 = num_ready_finalizers;
                num_ready_finalizers.12 = num_ready_finalizers.11 + 1;
                num_ready_finalizers = num_ready_finalizers.12;
                copy.13 = copy;
                sgen_queue_finalization_entry (copy.13);
                if (0 != 0) goto <D.17987>; else goto <D.17988>;
                <D.17987>:
                D.17989 = hash_table->num_entries;
                num_ready_finalizers.11 = num_ready_finalizers;
                copy.13 = copy;
                D.17990 = sgen_safe_name (copy.13);
                copy.13 = copy;
                gc_debug_file.14 = gc_debug_file;
                fprintf (gc_debug_file.14, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", copy.13, D.17990, object, num_ready_finalizers.11, D.17989);
                gc_debug_file.14 = gc_debug_file;
                fflush (gc_debug_file.14);
                <D.17988>:
                // predicted unlikely by continue predictor.
                goto <D.17642>;
                <D.17977>:
                if (hash_table == &minor_finalizable_hash) goto <D.17993>; else goto <D.17992>;
                <D.17993>:
                copy.13 = copy;
                D.17994 = sgen_ptr_in_nursery (copy.13);
                if (D.17994 == 0) goto <D.17995>; else goto <D.17992>;
                <D.17995>:
                D.17978 = *__next;
                *__iter = D.17978;
                __next = __iter;
                D.17979 = __hash_table->num_entries;
                D.17980 = D.17979 + 4294967295;
                __hash_table->num_entries = D.17980;
                if (1 != 0) goto <D.17996>; else goto <D.17997>;
                <D.17996>:
                D.17983 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.17983);
                <D.17997>:
                copy.13 = copy;
                D.17998 = tagged_object_apply (copy.13, tag);
                sgen_hash_table_replace (&major_finalizable_hash, D.17998, 0B, 0B);
                if (0 != 0) goto <D.17999>; else goto <D.18000>;
                <D.17999>:
                copy.13 = copy;
                D.18001 = sgen_safe_name (copy.13);
                copy.13 = copy;
                gc_debug_file.14 = gc_debug_file;
                fprintf (gc_debug_file.14, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy.13, D.18001, object);
                gc_debug_file.14 = gc_debug_file;
                fflush (gc_debug_file.14);
                <D.18000>:
                // predicted unlikely by continue predictor.
                goto <D.17642>;
                <D.17992>:
                if (0 != 0) goto <D.18002>; else goto <D.18003>;
                <D.18002>:
                copy.13 = copy;
                D.18004 = sgen_safe_name (copy.13);
                copy.13 = copy;
                gc_debug_file.14 = gc_debug_file;
                fprintf (gc_debug_file.14, "Updating object for finalization: %p (%s) (was at %p)\n", copy.13, D.18004, object);
                gc_debug_file.14 = gc_debug_file;
                fflush (gc_debug_file.14);
                <D.18003>:
                copy.13 = copy;
                D.18005 = tagged_object_apply (copy.13, tag);
                __entry->key = D.18005;
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.17975>:
        }
      }
      <D.17642>:
      __iter = __next;
      <D.17644>:
      D.18006 = *__iter;
      if (D.18006 != 0B) goto <D.17643>; else goto <D.17645>;
      <D.17645>:
    }
    __i = __i + 1;
    <D.17647>:
    D.18007 = hash_table->size;
    if (D.18007 > __i) goto <D.17646>; else goto <D.17648>;
    <D.17648>:
  }
}


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.18011;

  D.18011 = sgen_ptr_in_nursery (obj);
  if (D.18011 != 0) goto <D.18012>; else goto <D.18013>;
  <D.18012>:
  register_for_finalization (obj, user_data, 0);
  goto <D.18014>;
  <D.18013>:
  register_for_finalization (obj, user_data, 1);
  <D.18014>:
}


register_for_finalization (struct MonoObject * obj, void * user_data, int generation)
{
  int no_finalize.15;
  int iftmp.16;
  _Bool D.18023;
  long int D.18024;
  long int D.18025;
  int D.18030;
  const char * D.18035;
  unsigned int D.18036;
  struct MonoVTable * D.18037;
  struct MonoClass * D.18038;
  const char * D.18039;
  struct FILE * gc_debug_file.17;
  int D.18042;
  struct SgenHashTable * hash_table;

  hash_table = get_finalize_entry_hash_table (generation);
  no_finalize.15 = no_finalize;
  if (no_finalize.15 != 0) goto <D.18016>; else goto <D.18017>;
  <D.18016>:
  return;
  <D.18017>:
  if (user_data != 0B) goto <D.18021>; else goto <D.18019>;
  <D.18021>:
  if (user_data != mono_gc_run_finalize) goto <D.18022>; else goto <D.18019>;
  <D.18022>:
  iftmp.16 = 1;
  goto <D.18020>;
  <D.18019>:
  iftmp.16 = 0;
  <D.18020>:
  D.18023 = iftmp.16 != 0;
  D.18024 = (long int) D.18023;
  D.18025 = __builtin_expect (D.18024, 0);
  if (D.18025 != 0) goto <D.18026>; else goto <D.18027>;
  <D.18026>:
  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.18027>:
  if (user_data != 0B) goto <D.18028>; else goto <D.18029>;
  <D.18028>:
  D.18030 = sgen_hash_table_replace (hash_table, obj, 0B, 0B);
  if (D.18030 != 0) goto <D.18031>; else goto <D.18032>;
  <D.18031>:
  if (0 != 0) goto <D.18033>; else goto <D.18034>;
  <D.18033>:
  D.18035 = sgen_generation_name (generation);
  D.18036 = hash_table->num_entries;
  D.18037 = obj->vtable;
  D.18038 = D.18037->klass;
  D.18039 = D.18038->name;
  gc_debug_file.17 = gc_debug_file;
  fprintf (gc_debug_file.17, "Added finalizer for object: %p (%s) (%d) to %s table\n", obj, D.18039, D.18036, D.18035);
  gc_debug_file.17 = gc_debug_file;
  fflush (gc_debug_file.17);
  <D.18034>:
  <D.18032>:
  goto <D.18041>;
  <D.18029>:
  D.18042 = sgen_hash_table_remove (hash_table, obj, 0B);
  if (D.18042 != 0) goto <D.18043>; else goto <D.18044>;
  <D.18043>:
  if (0 != 0) goto <D.18045>; else goto <D.18046>;
  <D.18045>:
  D.18036 = hash_table->num_entries;
  D.18037 = obj->vtable;
  D.18038 = D.18037->klass;
  D.18039 = D.18038->name;
  gc_debug_file.17 = gc_debug_file;
  fprintf (gc_debug_file.17, "Removed finalizer for object: %p (%s) (%d)\n", obj, D.18039, D.18036);
  gc_debug_file.17 = gc_debug_file;
  fflush (gc_debug_file.17);
  <D.18046>:
  <D.18044>:
  <D.18041>:
}


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 (*<T2f44>) (struct MonoObject *, void *, int) process_func)
{
  int D.18048;
  long unsigned int D.18051;
  long unsigned int D.18052;
  struct StageEntry * D.18053;
  volatile gint32 * D.18054;
  int D.18055;
  void * D.18059;
  struct MonoObject * D.18060;
  int i;
  void retry = <<< error >>>;

  D.18048 = *next_entry;
  if (D.18048 != -1) goto <D.18049>; else goto <D.18050>;
  <D.18049>:
  return;
  <D.18050>:
  i = 0;
  goto <D.17691>;
  <D.17690>:
  {
    gint32 state;

    retry:
    D.18051 = (long unsigned int) i;
    D.18052 = D.18051 * 24;
    D.18053 = entries + D.18052;
    state = D.18053->state;
    switch (state) <default: <D.17688>, case 0: <D.17682>, case 1: <D.17685>, case 2: <D.17686>, case 3: <D.17683>>
    <D.17682>:
    <D.17683>:
    // predicted unlikely by continue predictor.
    goto <D.17684>;
    <D.17685>:
    D.18051 = (long unsigned int) i;
    D.18052 = D.18051 * 24;
    D.18053 = entries + D.18052;
    D.18054 = &D.18053->state;
    D.18055 = InterlockedCompareExchange (D.18054, 3, 1);
    if (D.18055 != 1) goto retry; else goto <D.18056>;
    <D.18056>:
    // predicted unlikely by continue predictor.
    goto <D.17684>;
    <D.17686>:
    goto <D.17687>;
    <D.17688>:
    if (1 != 0) goto <D.18057>; else goto <D.18058>;
    <D.18057>:
    monoeg_g_log (0B, 4, "Invalid stage entry state");
    <D.17689>:
    goto <D.17689>;
    <D.18058>:
    goto <D.17687>;
    <D.17687>:
    D.18051 = (long unsigned int) i;
    D.18052 = D.18051 * 24;
    D.18053 = entries + D.18052;
    D.18059 = D.18053->user_data;
    D.18051 = (long unsigned int) i;
    D.18052 = D.18051 * 24;
    D.18053 = entries + D.18052;
    D.18060 = D.18053->obj;
    process_func (D.18060, D.18059, i);
    D.18051 = (long unsigned int) i;
    D.18052 = D.18051 * 24;
    D.18053 = entries + D.18052;
    D.18053->obj = 0B;
    D.18051 = (long unsigned int) i;
    D.18052 = D.18051 * 24;
    D.18053 = entries + D.18052;
    D.18053->user_data = 0B;
    mono_memory_write_barrier ();
    D.18051 = (long unsigned int) i;
    D.18052 = D.18051 * 24;
    D.18053 = entries + D.18052;
    D.18053->state = 0;
  }
  <D.17684>:
  i = i + 1;
  <D.17691>:
  if (i < num_entries) goto <D.17690>; else goto <D.17692>;
  <D.17692>:
  mono_memory_write_barrier ();
  *next_entry = 0;
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.18064;
  unsigned int exch.18;
  unsigned int comp.19;
  unsigned int D.18067;

  exch.18 = (unsigned int) exch;
  comp.19 = (unsigned int) comp;
  D.18067 = __sync_val_compare_and_swap_4 (dest, comp.19, exch.18);
  D.18064 = (gint32) D.18067;
  return D.18064;
}


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.18069;
  int D.18072;

  goto <D.17727>;
  <D.17726>:
  D.18069 = try_lock_stage_for_processing (1024, &next_fin_stage_entry);
  if (D.18069 != 0) goto <D.18070>; else goto <D.18071>;
  <D.18070>:
  pthread_mutex_lock (&gc_mutex);
  process_stage_entries (1024, &next_fin_stage_entry, &fin_stage_entries, process_fin_stage_entry);
  sgen_gc_unlock ();
  <D.18071>:
  <D.17727>:
  D.18072 = add_stage_entry (1024, &next_fin_stage_entry, &fin_stage_entries, obj, user_data);
  if (D.18072 == -1) goto <D.17726>; else goto <D.17728>;
  <D.17728>:
}


try_lock_stage_for_processing (int num_entries, volatile gint32 * next_entry)
{
  gboolean D.18075;
  int D.18076;
  _Bool D.18077;
  gint32 old;

  old = *next_entry;
  if (old < num_entries) goto <D.18073>; else goto <D.18074>;
  <D.18073>:
  D.18075 = 0;
  return D.18075;
  <D.18074>:
  D.18076 = InterlockedCompareExchange (next_entry, -1, old);
  D.18077 = D.18076 == old;
  D.18075 = (gboolean) D.18077;
  return D.18075;
}


add_stage_entry (int num_entries, volatile gint32 * next_entry, struct StageEntry * entries, struct MonoObject * obj, void * user_data)
{
  int D.18081;
  long unsigned int D.18086;
  long unsigned int D.18087;
  struct StageEntry * D.18088;
  int D.18089;
  volatile gint32 * D.18091;
  int D.18092;
  int D.18093;
  int D.18096;
  _Bool D.18099;
  _Bool D.18100;
  _Bool D.18101;
  int D.18102;
  _Bool D.18103;
  long int D.18104;
  long int D.18105;
  volatile gint32 * D.18108;
  _Bool D.18111;
  _Bool D.18112;
  _Bool D.18113;
  int D.18114;
  _Bool D.18115;
  long int D.18116;
  long int D.18117;
  _Bool D.18120;
  long int D.18121;
  long int D.18122;
  gint32 index;
  gint32 new_next_entry;
  gint32 old_next_entry;
  gint32 previous_state;
  void retry = <<< error >>>;

  retry:
  <D.17710>:
  index = *next_entry;
  if (index >= num_entries) goto <D.18079>; else goto <D.18080>;
  <D.18079>:
  D.18081 = -1;
  return D.18081;
  <D.18080>:
  if (index < 0) goto <D.18082>; else goto <D.18083>;
  <D.18082>:
  goto <D.17706>;
  <D.17705>:
  monoeg_g_usleep (200);
  <D.17706>:
  index = *next_entry;
  if (index < 0) goto <D.17705>; else goto <D.17707>;
  <D.17707>:
  // predicted unlikely by continue predictor.
  goto <D.17708>;
  <D.18083>:
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18089 = D.18088->state;
  if (D.18089 != 0) goto <D.18084>; else goto <D.18090>;
  <D.18090>:
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18091 = &D.18088->state;
  D.18092 = InterlockedCompareExchange (D.18091, 1, 0);
  if (D.18092 != 0) goto <D.18084>; else goto <D.18085>;
  <D.18084>:
  D.18093 = *next_entry;
  if (D.18093 == index) goto <D.18094>; else goto <D.18095>;
  <D.18094>:
  D.18096 = index + 1;
  InterlockedCompareExchange (next_entry, D.18096, index);
  <D.18095>:
  // predicted unlikely by continue predictor.
  goto <D.17708>;
  <D.18085>:
  mono_memory_write_barrier ();
  D.18096 = index + 1;
  old_next_entry = InterlockedCompareExchange (next_entry, D.18096, index);
  if (old_next_entry < index) goto <D.18097>; else goto <D.18098>;
  <D.18097>:
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18088->state = 0;
  // predicted unlikely by continue predictor.
  goto <D.17708>;
  <D.18098>:
  goto <D.17709>;
  <D.17708>:
  goto <D.17710>;
  <D.17709>:
  D.18099 = index < 0;
  D.18100 = index >= num_entries;
  D.18101 = D.18099 | D.18100;
  D.18102 = (int) D.18101;
  D.18103 = D.18102 != 0;
  D.18104 = (long int) D.18103;
  D.18105 = __builtin_expect (D.18104, 0);
  if (D.18105 != 0) goto <D.18106>; else goto <D.18107>;
  <D.18106>:
  monoeg_g_log (0B, 4, "Invalid index");
  <D.17711>:
  goto <D.17711>;
  <D.18107>:
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18088->obj = obj;
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18088->user_data = user_data;
  mono_memory_write_barrier ();
  new_next_entry = *next_entry;
  mono_memory_read_barrier ();
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18108 = &D.18088->state;
  previous_state = InterlockedCompareExchange (D.18108, 2, 1);
  if (previous_state == 1) goto <D.18109>; else goto <D.18110>;
  <D.18109>:
  D.18111 = new_next_entry < index;
  D.18112 = new_next_entry >= 0;
  D.18113 = D.18111 & D.18112;
  D.18114 = (int) D.18113;
  D.18115 = D.18114 != 0;
  D.18116 = (long int) D.18115;
  D.18117 = __builtin_expect (D.18116, 0);
  if (D.18117 != 0) goto <D.18118>; else goto <D.18119>;
  <D.18118>:
  monoeg_g_log (0B, 4, "Invalid next entry index - as long as we\'re busy, other thread can only increment or invalidate it");
  <D.17712>:
  goto <D.17712>;
  <D.18119>:
  D.18081 = index;
  return D.18081;
  <D.18110>:
  D.18120 = previous_state != 3;
  D.18121 = (long int) D.18120;
  D.18122 = __builtin_expect (D.18121, 0);
  if (D.18122 != 0) goto <D.18123>; else goto <D.18124>;
  <D.18123>:
  monoeg_g_log (0B, 4, "Invalid state transition - other thread can only make busy state invalid");
  <D.17713>:
  goto <D.17713>;
  <D.18124>:
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18088->obj = 0B;
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18088->user_data = 0B;
  mono_memory_write_barrier ();
  D.18086 = (long unsigned int) index;
  D.18087 = D.18086 * 24;
  D.18088 = entries + D.18087;
  D.18088->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)
{
  int D.18128;
  long unsigned int D.18129;
  long unsigned int D.18130;
  struct MonoObject * * D.18131;
  int D.18132;
  int D.18133;
  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.18126>; else goto <D.18127>;
  <D.18126>:
  D.18128 = out_size - result;
  D.18129 = (long unsigned int) result;
  D.18130 = D.18129 * 8;
  D.18131 = out_array + D.18130;
  D.18132 = finalizers_for_domain (domain, D.18131, D.18128, &major_finalizable_hash);
  result = D.18132 + result;
  <D.18127>:
  sgen_gc_unlock ();
  D.18133 = result;
  return D.18133;
}


finalizers_for_domain (struct MonoDomain * domain, struct MonoObject * * out_array, int out_size, struct SgenHashTable * hash_table)
{
  int no_finalize.20;
  _Bool D.18139;
  _Bool D.18140;
  _Bool D.18141;
  int D.18142;
  long unsigned int D.18143;
  long unsigned int D.18144;
  struct MonoVTable * D.18145;
  struct MonoDomain * D.18146;
  struct SgenHashTableEntry * D.18149;
  unsigned int D.18150;
  unsigned int D.18151;
  int D.18154;
  int count.21;
  long unsigned int D.18156;
  long unsigned int D.18157;
  struct MonoObject * * D.18158;
  unsigned int D.18161;
  int num_ready_finalizers.22;
  const char * D.18163;
  struct FILE * gc_debug_file.23;
  struct SgenHashTableEntry * D.18167;
  unsigned int D.18168;
  struct MonoObject * object;
  void * dummy;
  int count;

  no_finalize.20 = no_finalize;
  if (no_finalize.20 != 0) goto <D.18135>; else goto <D.18138>;
  <D.18138>:
  D.18139 = out_size == 0;
  D.18140 = out_array == 0B;
  D.18141 = D.18139 | D.18140;
  if (D.18141 != 0) goto <D.18135>; else goto <D.18136>;
  <D.18135>:
  D.18142 = 0;
  return D.18142;
  <D.18136>:
  count = 0;
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

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

      D.18143 = (long unsigned int) __i;
      D.18144 = D.18143 * 8;
      __iter = __table + D.18144;
      goto <D.17746>;
      <D.17745>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.18145 = object->vtable;
        D.18146 = D.18145->domain;
        if (D.18146 == domain) goto <D.18147>; else goto <D.18148>;
        <D.18147>:
        D.18149 = *__next;
        *__iter = D.18149;
        __next = __iter;
        D.18150 = __hash_table->num_entries;
        D.18151 = D.18150 + 4294967295;
        __hash_table->num_entries = D.18151;
        if (1 != 0) goto <D.18152>; else goto <D.18153>;
        <D.18152>:
        D.18154 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.18154);
        <D.18153>:
        count.21 = count;
        count = count.21 + 1;
        D.18156 = (long unsigned int) count.21;
        D.18157 = D.18156 * 8;
        D.18158 = out_array + D.18157;
        *D.18158 = object;
        if (0 != 0) goto <D.18159>; else goto <D.18160>;
        <D.18159>:
        D.18161 = hash_table->num_entries;
        num_ready_finalizers.22 = num_ready_finalizers;
        D.18163 = sgen_safe_name (object);
        gc_debug_file.23 = gc_debug_file;
        fprintf (gc_debug_file.23, "Collecting object for finalization: %p (%s) (%d/%d)\n", object, D.18163, num_ready_finalizers.22, D.18161);
        gc_debug_file.23 = gc_debug_file;
        fflush (gc_debug_file.23);
        <D.18160>:
        if (count == out_size) goto <D.18165>; else goto <D.18166>;
        <D.18165>:
        D.18142 = count;
        return D.18142;
        <D.18166>:
        // predicted unlikely by continue predictor.
        goto <D.17744>;
        <D.18148>:
      }
      <D.17744>:
      __iter = __next;
      <D.17746>:
      D.18167 = *__iter;
      if (D.18167 != 0B) goto <D.17745>; else goto <D.17747>;
      <D.17747>:
    }
    __i = __i + 1;
    <D.17749>:
    D.18168 = hash_table->size;
    if (D.18168 > __i) goto <D.17748>; else goto <D.17750>;
    <D.17750>:
  }
  D.18142 = count;
  return D.18142;
}


sgen_null_link_in_range (int generation, gboolean before_finalization, struct ScanCopyContext ctx)
{
  long unsigned int D.18170;
  long unsigned int D.18171;
  void * D.18172;
  struct FILE * gc_debug_file.24;
  long unsigned int D.18178;
  long unsigned int D.18179;
  _Bool D.18180;
  long unsigned int D.18183;
  long unsigned int D.18184;
  gboolean (*<T2c96>) (char *) D.18189;
  int D.18190;
  int D.18193;
  struct SgenHashTableEntry * D.18198;
  unsigned int D.18199;
  unsigned int D.18200;
  int D.18203;
  char * copy.25;
  int D.18207;
  _Bool D.18211;
  long int D.18212;
  long int D.18213;
  long unsigned int iftmp.26;
  long unsigned int copy.27;
  long unsigned int D.18221;
  long unsigned int D.18222;
  void * D.18223;
  long unsigned int iftmp.28;
  long unsigned int D.18230;
  long unsigned int D.18231;
  void * D.18232;
  void * D.18235;
  struct SgenHashTableEntry * D.18236;
  unsigned int D.18237;
  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.17795>;
    <D.17794>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18170 = (long unsigned int) __i;
      D.18171 = D.18170 * 8;
      __iter = __table + D.18171;
      goto <D.17792>;
      <D.17791>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18172 = *link;
          if (D.18172 == 0B) goto <D.18173>; else goto <D.18174>;
          <D.18173>:
          if (0 != 0) goto <D.18175>; else goto <D.18176>;
          <D.18175>:
          gc_debug_file.24 = gc_debug_file;
          fprintf (gc_debug_file.24, "Dislink %p was externally nullified\n", link);
          gc_debug_file.24 = gc_debug_file;
          fflush (gc_debug_file.24);
          <D.18176>:
          // predicted unlikely by continue predictor.
          goto <D.17789>;
          <D.18174>:
          D.18172 = *link;
          D.18178 = (long unsigned int) D.18172;
          D.18179 = D.18178 & 1;
          D.18180 = D.18179 == 0;
          track = (gboolean) D.18180;
          if (track != before_finalization) goto <D.18181>; else goto <D.18182>;
          <D.18181>:
          D.18172 = *link;
          D.18178 = (long unsigned int) D.18172;
          D.18183 = ~D.18178;
          D.18184 = D.18183 & 18446744073709551612;
          object = (char *) D.18184;
          if (object == 0B) goto <D.18185>; else goto <D.18186>;
          <D.18185>:
          if (0 != 0) goto <D.18187>; else goto <D.18188>;
          <D.18187>:
          gc_debug_file.24 = gc_debug_file;
          fprintf (gc_debug_file.24, "Dislink %p with a hidden null object\n", link);
          gc_debug_file.24 = gc_debug_file;
          fflush (gc_debug_file.24);
          <D.18188>:
          // predicted unlikely by continue predictor.
          goto <D.17789>;
          <D.18186>:
          D.18189 = major_collector.is_object_live;
          D.18190 = D.18189 (object);
          if (D.18190 == 0) goto <D.18191>; else goto <D.18192>;
          <D.18191>:
          D.18193 = sgen_gc_is_object_ready_for_finalization (object);
          if (D.18193 != 0) goto <D.18194>; else goto <D.18195>;
          <D.18194>:
          *link = 0B;
          if (0 != 0) goto <D.18196>; else goto <D.18197>;
          <D.18196>:
          gc_debug_file.24 = gc_debug_file;
          fprintf (gc_debug_file.24, "Dislink nullified at %p to GCed object %p\n", link, object);
          gc_debug_file.24 = gc_debug_file;
          fflush (gc_debug_file.24);
          <D.18197>:
          D.18198 = *__next;
          *__iter = D.18198;
          __next = __iter;
          D.18199 = __hash_table->num_entries;
          D.18200 = D.18199 + 4294967295;
          __hash_table->num_entries = D.18200;
          if (1 != 0) goto <D.18201>; else goto <D.18202>;
          <D.18201>:
          D.18203 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.18203);
          <D.18202>:
          // predicted unlikely by continue predictor.
          goto <D.17789>;
          <D.18195>:
          {
            char * copy;

            try
              {
                copy = object;
                copy_func (&copy, queue);
                if (hash == &minor_disappearing_link_hash) goto <D.18205>; else goto <D.18204>;
                <D.18205>:
                copy.25 = copy;
                D.18207 = sgen_ptr_in_nursery (copy.25);
                if (D.18207 == 0) goto <D.18208>; else goto <D.18204>;
                <D.18208>:
                D.18198 = *__next;
                *__iter = D.18198;
                __next = __iter;
                D.18199 = __hash_table->num_entries;
                D.18200 = D.18199 + 4294967295;
                __hash_table->num_entries = D.18200;
                if (1 != 0) goto <D.18209>; else goto <D.18210>;
                <D.18209>:
                D.18203 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.18203);
                <D.18210>:
                copy.25 = copy;
                D.18211 = copy.25 == 0B;
                D.18212 = (long int) D.18211;
                D.18213 = __builtin_expect (D.18212, 0);
                if (D.18213 != 0) goto <D.18214>; else goto <D.18215>;
                <D.18214>:
                monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-fin-weak-hash.c", 700, "copy");
                <D.18215>:
                if (track != 0) goto <D.18217>; else goto <D.18218>;
                <D.18217>:
                iftmp.26 = 1;
                goto <D.18219>;
                <D.18218>:
                iftmp.26 = 0;
                <D.18219>:
                copy.25 = copy;
                copy.27 = (long unsigned int) copy.25;
                D.18221 = iftmp.26 | copy.27;
                D.18222 = ~D.18221;
                D.18223 = (void *) D.18222;
                *link = D.18223;
                copy.25 = copy;
                add_or_remove_disappearing_link (copy.25, link, 1);
                if (0 != 0) goto <D.18224>; else goto <D.18225>;
                <D.18224>:
                copy.25 = copy;
                gc_debug_file.24 = gc_debug_file;
                fprintf (gc_debug_file.24, "Upgraded dislink at %p to major because object %p moved to %p\n", link, object, copy.25);
                gc_debug_file.24 = gc_debug_file;
                fflush (gc_debug_file.24);
                <D.18225>:
                // predicted unlikely by continue predictor.
                goto <D.17789>;
                <D.18204>:
                if (track != 0) goto <D.18227>; else goto <D.18228>;
                <D.18227>:
                iftmp.28 = 1;
                goto <D.18229>;
                <D.18228>:
                iftmp.28 = 0;
                <D.18229>:
                copy.25 = copy;
                copy.27 = (long unsigned int) copy.25;
                D.18230 = iftmp.28 | copy.27;
                D.18231 = ~D.18230;
                D.18232 = (void *) D.18231;
                *link = D.18232;
                if (0 != 0) goto <D.18233>; else goto <D.18234>;
                <D.18233>:
                D.18172 = *link;
                D.18178 = (long unsigned int) D.18172;
                D.18183 = ~D.18178;
                D.18184 = D.18183 & 18446744073709551612;
                D.18235 = (void *) D.18184;
                gc_debug_file.24 = gc_debug_file;
                fprintf (gc_debug_file.24, "Updated dislink at %p to %p\n", link, D.18235);
                gc_debug_file.24 = gc_debug_file;
                fflush (gc_debug_file.24);
                <D.18234>:
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.18192>:
          <D.18182>:
        }
      }
      <D.17789>:
      __iter = __next;
      <D.17792>:
      D.18236 = *__iter;
      if (D.18236 != 0B) goto <D.17791>; else goto <D.17793>;
      <D.17793>:
    }
    __i = __i + 1;
    <D.17795>:
    D.18237 = hash->size;
    if (D.18237 > __i) goto <D.17794>; else goto <D.17796>;
    <D.17796>:
  }
}


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

  switch (generation) <default: <D.17764>, case 0: <D.17762>, case 1: <D.17763>>
  <D.17762>:
  D.18240 = &minor_disappearing_link_hash;
  return D.18240;
  <D.17763>:
  D.18240 = &major_disappearing_link_hash;
  return D.18240;
  <D.17764>:
  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.18244;
  const char * D.18249;
  unsigned int D.18250;
  struct FILE * gc_debug_file.29;
  const char * D.18254;
  struct MonoVTable * D.18255;
  struct MonoClass * D.18256;
  const char * D.18257;
  struct SgenHashTable * hash_table;

  hash_table = get_dislink_hash_table (generation);
  if (obj == 0B) goto <D.18242>; else goto <D.18243>;
  <D.18242>:
  D.18244 = sgen_hash_table_remove (hash_table, link, 0B);
  if (D.18244 != 0) goto <D.18245>; else goto <D.18246>;
  <D.18245>:
  if (0 != 0) goto <D.18247>; else goto <D.18248>;
  <D.18247>:
  D.18249 = sgen_generation_name (generation);
  D.18250 = hash_table->num_entries;
  gc_debug_file.29 = gc_debug_file;
  fprintf (gc_debug_file.29, "Removed dislink %p (%d) from %s table\n", link, D.18250, D.18249);
  gc_debug_file.29 = gc_debug_file;
  fflush (gc_debug_file.29);
  <D.18248>:
  <D.18246>:
  return;
  <D.18243>:
  sgen_hash_table_replace (hash_table, link, 0B, 0B);
  if (0 != 0) goto <D.18252>; else goto <D.18253>;
  <D.18252>:
  D.18254 = sgen_generation_name (generation);
  D.18255 = obj->vtable;
  D.18256 = D.18255->klass;
  D.18257 = D.18256->name;
  gc_debug_file.29 = gc_debug_file;
  fprintf (gc_debug_file.29, "Added dislink for object: %p (%s) at %p to %s table\n", obj, D.18257, link, D.18254);
  gc_debug_file.29 = gc_debug_file;
  fflush (gc_debug_file.29);
  <D.18253>:
}


sgen_null_links_for_domain (struct MonoDomain * domain, int generation)
{
  long unsigned int D.18259;
  long unsigned int D.18260;
  void * D.18261;
  long unsigned int D.18262;
  long unsigned int D.18263;
  long unsigned int D.18264;
  struct MonoVTable * D.18269;
  struct FILE * gc_debug_file.30;
  struct SgenHashTableEntry * D.18277;
  unsigned int D.18278;
  unsigned int D.18279;
  int D.18282;
  struct SgenHashTableEntry * D.18283;
  unsigned int D.18284;
  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.17817>;
    <D.17816>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18259 = (long unsigned int) __i;
      D.18260 = D.18259 * 8;
      __iter = __table + D.18260;
      goto <D.17814>;
      <D.17813>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18261 = *link;
          D.18262 = (long unsigned int) D.18261;
          D.18263 = ~D.18262;
          D.18264 = D.18263 & 18446744073709551612;
          object = (char *) D.18264;
          D.18261 = *link;
          if (D.18261 != 0B) goto <D.18265>; else goto <D.18266>;
          <D.18265>:
          if (object != 0B) goto <D.18267>; else goto <D.18268>;
          <D.18267>:
          D.18269 = MEM[(struct MonoObject *)object].vtable;
          if (D.18269 == 0B) goto <D.18270>; else goto <D.18271>;
          <D.18270>:
          {
            gboolean free;

            free = 1;
            D.18261 = *link;
            if (D.18261 != 0B) goto <D.18272>; else goto <D.18273>;
            <D.18272>:
            *link = 0B;
            free = 0;
            if (0 != 0) goto <D.18274>; else goto <D.18275>;
            <D.18274>:
            gc_debug_file.30 = gc_debug_file;
            fprintf (gc_debug_file.30, "Disappearing link %p not freed\n", link);
            gc_debug_file.30 = gc_debug_file;
            fflush (gc_debug_file.30);
            <D.18275>:
            <D.18273>:
            D.18277 = *__next;
            *__iter = D.18277;
            __next = __iter;
            D.18278 = __hash_table->num_entries;
            D.18279 = D.18278 + 4294967295;
            __hash_table->num_entries = D.18279;
            if (free != 0) goto <D.18280>; else goto <D.18281>;
            <D.18280>:
            D.18282 = __hash_table->entry_mem_type;
            sgen_free_internal (__entry, D.18282);
            <D.18281>:
            // predicted unlikely by continue predictor.
            goto <D.17812>;
          }
          <D.18271>:
          <D.18268>:
          <D.18266>:
        }
      }
      <D.17812>:
      __iter = __next;
      <D.17814>:
      D.18283 = *__iter;
      if (D.18283 != 0B) goto <D.17813>; else goto <D.17815>;
      <D.17815>:
    }
    __i = __i + 1;
    <D.17817>:
    D.18284 = hash->size;
    if (D.18284 > __i) goto <D.17816>; else goto <D.17818>;
    <D.17818>:
  }
}


sgen_null_links_with_predicate (int generation, mono_bool (*WeakLinkAlivePredicateFunc) (struct MonoObject *, void *) predicate, void * data)
{
  long unsigned int D.18285;
  long unsigned int D.18286;
  void * D.18287;
  long unsigned int D.18288;
  long unsigned int D.18289;
  long unsigned int D.18290;
  struct FILE * gc_debug_file.31;
  struct SgenHashTableEntry * D.18298;
  unsigned int D.18299;
  unsigned int D.18300;
  int D.18303;
  struct SgenHashTableEntry * D.18304;
  unsigned int D.18305;
  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.17840>;
    <D.17839>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18285 = (long unsigned int) __i;
      D.18286 = D.18285 * 8;
      __iter = __table + D.18286;
      goto <D.17837>;
      <D.17836>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18287 = *link;
          D.18288 = (long unsigned int) D.18287;
          D.18289 = ~D.18288;
          D.18290 = D.18289 & 18446744073709551612;
          object = (char *) D.18290;
          D.18287 = *link;
          if (D.18287 == 0B) goto <D.18291>; else goto <D.18292>;
          <D.18291>:
          // predicted unlikely by continue predictor.
          goto <D.17835>;
          <D.18292>:
          is_alive = predicate (object, data);
          if (is_alive == 0) goto <D.18293>; else goto <D.18294>;
          <D.18293>:
          *link = 0B;
          if (0 != 0) goto <D.18295>; else goto <D.18296>;
          <D.18295>:
          gc_debug_file.31 = gc_debug_file;
          fprintf (gc_debug_file.31, "Dislink nullified by predicate at %p to GCed object %p\n", link, object);
          gc_debug_file.31 = gc_debug_file;
          fflush (gc_debug_file.31);
          <D.18296>:
          D.18298 = *__next;
          *__iter = D.18298;
          __next = __iter;
          D.18299 = __hash_table->num_entries;
          D.18300 = D.18299 + 4294967295;
          __hash_table->num_entries = D.18300;
          if (1 != 0) goto <D.18301>; else goto <D.18302>;
          <D.18301>:
          D.18303 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.18303);
          <D.18302>:
          // predicted unlikely by continue predictor.
          goto <D.17835>;
          <D.18294>:
        }
      }
      <D.17835>:
      __iter = __next;
      <D.17837>:
      D.18304 = *__iter;
      if (D.18304 != 0B) goto <D.17836>; else goto <D.17838>;
      <D.17838>:
    }
    __i = __i + 1;
    <D.17840>:
    D.18305 = hash->size;
    if (D.18305 > __i) goto <D.17839>; else goto <D.17841>;
    <D.17841>:
  }
}


sgen_remove_finalizers_for_domain (struct MonoDomain * domain, int generation)
{
  long unsigned int D.18306;
  long unsigned int D.18307;
  struct MonoVTable * D.18308;
  struct MonoDomain * D.18309;
  const char * D.18314;
  struct FILE * gc_debug_file.32;
  struct SgenHashTableEntry * D.18316;
  unsigned int D.18317;
  unsigned int D.18318;
  int D.18321;
  struct SgenHashTableEntry * D.18322;
  unsigned int D.18323;
  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.17860>;
    <D.17859>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18306 = (long unsigned int) __i;
      D.18307 = D.18306 * 8;
      __iter = __table + D.18307;
      goto <D.17857>;
      <D.17856>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.18308 = object->vtable;
        D.18309 = D.18308->domain;
        if (D.18309 == domain) goto <D.18310>; else goto <D.18311>;
        <D.18310>:
        if (0 != 0) goto <D.18312>; else goto <D.18313>;
        <D.18312>:
        D.18314 = sgen_safe_name (object);
        gc_debug_file.32 = gc_debug_file;
        fprintf (gc_debug_file.32, "Unregistering finalizer for object: %p (%s)\n", object, D.18314);
        gc_debug_file.32 = gc_debug_file;
        fflush (gc_debug_file.32);
        <D.18313>:
        D.18316 = *__next;
        *__iter = D.18316;
        __next = __iter;
        D.18317 = __hash_table->num_entries;
        D.18318 = D.18317 + 4294967295;
        __hash_table->num_entries = D.18318;
        if (1 != 0) goto <D.18319>; else goto <D.18320>;
        <D.18319>:
        D.18321 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.18321);
        <D.18320>:
        // predicted unlikely by continue predictor.
        goto <D.17855>;
        <D.18311>:
      }
      <D.17855>:
      __iter = __next;
      <D.17857>:
      D.18322 = *__iter;
      if (D.18322 != 0B) goto <D.17856>; else goto <D.17858>;
      <D.17858>:
    }
    __i = __i + 1;
    <D.17860>:
    D.18323 = hash_table->size;
    if (D.18323 > __i) goto <D.17859>; else goto <D.17861>;
    <D.17861>:
  }
}


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.18328;
  void * * link;

  link = _link;
  if (index >= 0) goto <D.18324>; else goto <D.18325>;
  <D.18324>:
  <D.18325>:
  add_or_remove_disappearing_link (0B, link, 0);
  add_or_remove_disappearing_link (0B, link, 1);
  if (obj != 0B) goto <D.18326>; else goto <D.18327>;
  <D.18326>:
  D.18328 = sgen_ptr_in_nursery (obj);
  if (D.18328 != 0) goto <D.18329>; else goto <D.18330>;
  <D.18329>:
  add_or_remove_disappearing_link (obj, link, 0);
  goto <D.18331>;
  <D.18330>:
  add_or_remove_disappearing_link (obj, link, 1);
  <D.18331>:
  <D.18327>:
}


sgen_register_disappearing_link (struct MonoObject * obj, void * * link, gboolean track, gboolean in_gc)
{
  long unsigned int iftmp.33;
  long unsigned int obj.34;
  long unsigned int D.18339;
  long unsigned int D.18340;
  void * D.18341;
  int D.18346;

  if (obj != 0B) goto <D.18332>; else goto <D.18333>;
  <D.18332>:
  if (track != 0) goto <D.18335>; else goto <D.18336>;
  <D.18335>:
  iftmp.33 = 1;
  goto <D.18337>;
  <D.18336>:
  iftmp.33 = 0;
  <D.18337>:
  obj.34 = (long unsigned int) obj;
  D.18339 = iftmp.33 | obj.34;
  D.18340 = ~D.18339;
  D.18341 = (void *) D.18340;
  *link = D.18341;
  goto <D.18342>;
  <D.18333>:
  *link = 0B;
  <D.18342>:
  if (in_gc != 0) goto <D.18343>; else goto <D.18344>;
  <D.18343>:
  process_dislink_stage_entry (obj, link, -1);
  goto <D.18345>;
  <D.18344>:
  {
    int index;

    goto <D.17881>;
    <D.17880>:
    D.18346 = try_lock_stage_for_processing (1024, &next_dislink_stage_entry);
    if (D.18346 != 0) goto <D.18347>; else goto <D.18348>;
    <D.18347>:
    pthread_mutex_lock (&gc_mutex);
    process_stage_entries (1024, &next_dislink_stage_entry, &dislink_stage_entries, process_dislink_stage_entry);
    sgen_gc_unlock ();
    <D.18348>:
    <D.17881>:
    index = add_stage_entry (1024, &next_dislink_stage_entry, &dislink_stage_entries, obj, link);
    if (index == -1) goto <D.17880>; else goto <D.17882>;
    <D.17882>:
  }
  <D.18345>:
}


sgen_init_fin_weak_hash ()
{

}


