__attribute__((visibility ("hidden")))
sgen_mark_bridge_object (struct MonoObject * obj)
{
  int D.18031;
  _Bool D.18032;
  int D.18033;
  struct MonoObject * D.18034;
  struct SgenHashTable * hash_table;

  D.18031 = sgen_ptr_in_nursery (obj);
  D.18032 = D.18031 == 0;
  D.18033 = (int) D.18032;
  hash_table = get_finalize_entry_hash_table (D.18033);
  D.18034 = tagged_object_apply (obj, 1);
  sgen_hash_table_set_key (hash_table, obj, D.18034);
}


__attribute__((always_inline))
sgen_ptr_in_nursery (void * p)
{
  gboolean D.18035;
  int sgen_nursery_bits.0;
  int D.18037;
  int D.18038;
  long unsigned int D.18039;
  long unsigned int p.1;
  long unsigned int D.18041;
  char * sgen_nursery_start.2;
  long unsigned int sgen_nursery_start.3;
  _Bool D.18044;

  sgen_nursery_bits.0 = sgen_nursery_bits;
  D.18037 = 1 << sgen_nursery_bits.0;
  D.18038 = -D.18037;
  D.18039 = (long unsigned int) D.18038;
  p.1 = (long unsigned int) p;
  D.18041 = D.18039 & p.1;
  sgen_nursery_start.2 = sgen_nursery_start;
  sgen_nursery_start.3 = (long unsigned int) sgen_nursery_start.2;
  D.18044 = D.18041 == sgen_nursery_start.3;
  D.18035 = (gboolean) D.18044;
  return D.18035;
}


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

  switch (generation) <default: <D.17739>, case 0: <D.17737>, case 1: <D.17738>>
  <D.17737>:
  D.18046 = &minor_finalizable_hash;
  return D.18046;
  <D.17738>:
  D.18046 = &major_finalizable_hash;
  return D.18046;
  <D.17739>:
  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.18048;
  struct MonoObject * D.18049;
  struct MonoObject * D.18050;
  _Bool D.18051;

  D.18049 = tagged_object_get_object (a);
  D.18050 = tagged_object_get_object (b);
  D.18051 = D.18049 == D.18050;
  D.18048 = (gboolean) D.18051;
  return D.18048;
}


tagged_object_get_object (struct MonoObject * object)
{
  struct MonoObject * D.18053;
  long unsigned int object.4;
  long unsigned int D.18055;

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


tagged_object_hash (struct MonoObject * o)
{
  int D.18057;
  struct MonoObject * D.18058;

  D.18058 = tagged_object_get_object (o);
  D.18057 = mono_object_hash (D.18058);
  return D.18057;
}


tagged_object_apply (void * object, int tag_bits)
{
  struct MonoObject * D.18060;
  long unsigned int D.18061;
  long unsigned int object.5;
  long unsigned int D.18063;

  D.18061 = (long unsigned int) tag_bits;
  object.5 = (long unsigned int) object;
  D.18063 = D.18061 | object.5;
  D.18060 = (struct MonoObject *) D.18063;
  return D.18060;
}


__attribute__((visibility ("hidden")))
sgen_collect_bridge_objects (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.6;
  long unsigned int D.18068;
  long unsigned int D.18069;
  gboolean (*<T2dda>) (char *) D.18072;
  int D.18073;
  int D.18076;
  int D.18079;
  char * copy.7;
  int D.18085;
  struct SgenHashTableEntry * D.18087;
  unsigned int D.18088;
  unsigned int D.18089;
  int D.18092;
  struct MonoObject * D.18093;
  struct FILE * gc_debug_file.8;
  const char * D.18097;
  const char * D.18100;
  struct MonoObject * D.18101;
  struct SgenHashTableEntry * D.18102;
  unsigned int D.18103;
  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.18066>; else goto <D.18067>;
      <D.18066>:
      return;
      <D.18067>:
      {
        struct SgenHashTable * __hash_table;
        struct SgenHashTableEntry * * __table;
        guint __i;

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

          D.18068 = (long unsigned int) __i;
          D.18069 = D.18068 * 8;
          __iter = __table + D.18069;
          goto <D.17763>;
          <D.17762>:
          {
            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.18070>; else goto <D.18071>;
              <D.18070>:
              // predicted unlikely by continue predictor.
              goto <D.17761>;
              <D.18071>:
              D.18072 = major_collector.is_object_live;
              D.18073 = D.18072 (object);
              if (D.18073 != 0) goto <D.18074>; else goto <D.18075>;
              <D.18074>:
              // predicted unlikely by continue predictor.
              goto <D.17761>;
              <D.18075>:
              D.18076 = sgen_gc_is_object_ready_for_finalization (object);
              if (D.18076 == 0) goto <D.18077>; else goto <D.18078>;
              <D.18077>:
              // predicted unlikely by continue predictor.
              goto <D.17761>;
              <D.18078>:
              D.18079 = sgen_is_bridge_object (object);
              if (D.18079 == 0) goto <D.18080>; else goto <D.18081>;
              <D.18080>:
              // predicted unlikely by continue predictor.
              goto <D.17761>;
              <D.18081>:
              copy = object;
              copy_func (&copy, queue);
              copy.7 = copy;
              sgen_bridge_register_finalized_object (copy.7);
              if (hash_table == &minor_finalizable_hash) goto <D.18084>; else goto <D.18083>;
              <D.18084>:
              copy.7 = copy;
              D.18085 = sgen_ptr_in_nursery (copy.7);
              if (D.18085 == 0) goto <D.18086>; else goto <D.18083>;
              <D.18086>:
              D.18087 = *__next;
              *__iter = D.18087;
              __next = __iter;
              D.18088 = __hash_table->num_entries;
              D.18089 = D.18088 + 4294967295;
              __hash_table->num_entries = D.18089;
              if (1 != 0) goto <D.18090>; else goto <D.18091>;
              <D.18090>:
              D.18092 = __hash_table->entry_mem_type;
              sgen_free_internal (__entry, D.18092);
              <D.18091>:
              copy.7 = copy;
              D.18093 = tagged_object_apply (copy.7, tag);
              sgen_hash_table_replace (&major_finalizable_hash, D.18093, 0B, 0B);
              if (0 != 0) goto <D.18094>; else goto <D.18095>;
              <D.18094>:
              gc_debug_file.8 = gc_debug_file;
              copy.7 = copy;
              copy.7 = copy;
              D.18097 = sgen_safe_name (copy.7);
              fprintf (gc_debug_file.8, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy.7, D.18097, object);
              gc_debug_file.8 = gc_debug_file;
              fflush (gc_debug_file.8);
              <D.18095>:
              // predicted unlikely by continue predictor.
              goto <D.17761>;
              <D.18083>:
              if (0 != 0) goto <D.18098>; else goto <D.18099>;
              <D.18098>:
              gc_debug_file.8 = gc_debug_file;
              copy.7 = copy;
              copy.7 = copy;
              D.18100 = sgen_safe_name (copy.7);
              fprintf (gc_debug_file.8, "Updating object for finalization: %p (%s) (was at %p)\n", copy.7, D.18100, object);
              gc_debug_file.8 = gc_debug_file;
              fflush (gc_debug_file.8);
              <D.18099>:
              copy.7 = copy;
              D.18101 = tagged_object_apply (copy.7, tag);
              __entry->key = D.18101;
            }
          }
          <D.17761>:
          __iter = __next;
          <D.17763>:
          D.18102 = *__iter;
          if (D.18102 != 0B) goto <D.17762>; else goto <D.17764>;
          <D.17764>:
        }
        __i = __i + 1;
        <D.17766>:
        D.18103 = hash_table->size;
        if (D.18103 > __i) goto <D.17765>; else goto <D.17767>;
        <D.17767>:
      }
    }
  finally
    {
      copy = {CLOBBER};
    }
}


tagged_object_get_tag (struct MonoObject * object)
{
  int D.18107;
  long int object.9;
  int D.18109;

  object.9 = (long int) object;
  D.18109 = (int) object.9;
  D.18107 = D.18109 & 1;
  return D.18107;
}


__attribute__((visibility ("hidden")))
sgen_finalize_in_range (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.10;
  long unsigned int D.18114;
  long unsigned int D.18115;
  gboolean (*<T2dda>) (char *) D.18116;
  int D.18117;
  struct SgenHashTableEntry * D.18122;
  unsigned int D.18123;
  unsigned int D.18124;
  int D.18127;
  int num_ready_finalizers.11;
  int D.18129;
  struct MonoObject * copy.12;
  struct FILE * gc_debug_file.13;
  const char * D.18134;
  unsigned int D.18135;
  int D.18138;
  struct MonoObject * D.18142;
  const char * D.18145;
  const char * D.18148;
  struct MonoObject * D.18149;
  struct SgenHashTableEntry * D.18150;
  unsigned int D.18151;
  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.18112>; else goto <D.18113>;
  <D.18112>:
  return;
  <D.18113>:
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

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

      D.18114 = (long unsigned int) __i;
      D.18115 = D.18114 * 8;
      __iter = __table + D.18115;
      goto <D.17788>;
      <D.17787>:
      {
        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.18116 = major_collector.is_object_live;
          D.18117 = D.18116 (object);
          if (D.18117 == 0) goto <D.18118>; else goto <D.18119>;
          <D.18118>:
          {
            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.18120>; else goto <D.18121>;
                <D.18120>:
                D.18122 = *__next;
                *__iter = D.18122;
                __next = __iter;
                D.18123 = __hash_table->num_entries;
                D.18124 = D.18123 + 4294967295;
                __hash_table->num_entries = D.18124;
                if (1 != 0) goto <D.18125>; else goto <D.18126>;
                <D.18125>:
                D.18127 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.18127);
                <D.18126>:
                num_ready_finalizers.11 = num_ready_finalizers;
                D.18129 = num_ready_finalizers.11 + 1;
                num_ready_finalizers = D.18129;
                copy.12 = copy;
                sgen_queue_finalization_entry (copy.12);
                if (0 != 0) goto <D.18131>; else goto <D.18132>;
                <D.18131>:
                gc_debug_file.13 = gc_debug_file;
                copy.12 = copy;
                copy.12 = copy;
                D.18134 = sgen_safe_name (copy.12);
                num_ready_finalizers.11 = num_ready_finalizers;
                D.18135 = hash_table->num_entries;
                fprintf (gc_debug_file.13, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", copy.12, D.18134, object, num_ready_finalizers.11, D.18135);
                gc_debug_file.13 = gc_debug_file;
                fflush (gc_debug_file.13);
                <D.18132>:
                // predicted unlikely by continue predictor.
                goto <D.17786>;
                <D.18121>:
                if (hash_table == &minor_finalizable_hash) goto <D.18137>; else goto <D.18136>;
                <D.18137>:
                copy.12 = copy;
                D.18138 = sgen_ptr_in_nursery (copy.12);
                if (D.18138 == 0) goto <D.18139>; else goto <D.18136>;
                <D.18139>:
                D.18122 = *__next;
                *__iter = D.18122;
                __next = __iter;
                D.18123 = __hash_table->num_entries;
                D.18124 = D.18123 + 4294967295;
                __hash_table->num_entries = D.18124;
                if (1 != 0) goto <D.18140>; else goto <D.18141>;
                <D.18140>:
                D.18127 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.18127);
                <D.18141>:
                copy.12 = copy;
                D.18142 = tagged_object_apply (copy.12, tag);
                sgen_hash_table_replace (&major_finalizable_hash, D.18142, 0B, 0B);
                if (0 != 0) goto <D.18143>; else goto <D.18144>;
                <D.18143>:
                gc_debug_file.13 = gc_debug_file;
                copy.12 = copy;
                copy.12 = copy;
                D.18145 = sgen_safe_name (copy.12);
                fprintf (gc_debug_file.13, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy.12, D.18145, object);
                gc_debug_file.13 = gc_debug_file;
                fflush (gc_debug_file.13);
                <D.18144>:
                // predicted unlikely by continue predictor.
                goto <D.17786>;
                <D.18136>:
                if (0 != 0) goto <D.18146>; else goto <D.18147>;
                <D.18146>:
                gc_debug_file.13 = gc_debug_file;
                copy.12 = copy;
                copy.12 = copy;
                D.18148 = sgen_safe_name (copy.12);
                fprintf (gc_debug_file.13, "Updating object for finalization: %p (%s) (was at %p)\n", copy.12, D.18148, object);
                gc_debug_file.13 = gc_debug_file;
                fflush (gc_debug_file.13);
                <D.18147>:
                copy.12 = copy;
                D.18149 = tagged_object_apply (copy.12, tag);
                __entry->key = D.18149;
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.18119>:
        }
      }
      <D.17786>:
      __iter = __next;
      <D.17788>:
      D.18150 = *__iter;
      if (D.18150 != 0B) goto <D.17787>; else goto <D.17789>;
      <D.17789>:
    }
    __i = __i + 1;
    <D.17791>:
    D.18151 = hash_table->size;
    if (D.18151 > __i) goto <D.17790>; else goto <D.17792>;
    <D.17792>:
  }
}


__attribute__((visibility ("hidden")))
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.18155;

  D.18155 = sgen_ptr_in_nursery (obj);
  if (D.18155 != 0) goto <D.18156>; else goto <D.18157>;
  <D.18156>:
  register_for_finalization (obj, user_data, 0);
  goto <D.18158>;
  <D.18157>:
  register_for_finalization (obj, user_data, 1);
  <D.18158>:
}


register_for_finalization (struct MonoObject * obj, void * user_data, int generation)
{
  int no_finalize.14;
  int iftmp.15;
  _Bool D.18167;
  long int D.18168;
  long int D.18169;
  int D.18174;
  struct FILE * gc_debug_file.16;
  struct MonoVTable * D.18180;
  struct MonoClass * D.18181;
  const char * D.18182;
  unsigned int D.18183;
  const char * D.18184;
  int D.18186;
  struct SgenHashTable * hash_table;

  hash_table = get_finalize_entry_hash_table (generation);
  no_finalize.14 = no_finalize;
  if (no_finalize.14 != 0) goto <D.18160>; else goto <D.18161>;
  <D.18160>:
  return;
  <D.18161>:
  if (user_data != 0B) goto <D.18165>; else goto <D.18163>;
  <D.18165>:
  if (user_data != mono_gc_run_finalize) goto <D.18166>; else goto <D.18163>;
  <D.18166>:
  iftmp.15 = 1;
  goto <D.18164>;
  <D.18163>:
  iftmp.15 = 0;
  <D.18164>:
  D.18167 = iftmp.15 != 0;
  D.18168 = (long int) D.18167;
  D.18169 = __builtin_expect (D.18168, 0);
  if (D.18169 != 0) goto <D.18170>; else goto <D.18171>;
  <D.18170>:
  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.18171>:
  if (user_data != 0B) goto <D.18172>; else goto <D.18173>;
  <D.18172>:
  D.18174 = sgen_hash_table_replace (hash_table, obj, 0B, 0B);
  if (D.18174 != 0) goto <D.18175>; else goto <D.18176>;
  <D.18175>:
  if (0 != 0) goto <D.18177>; else goto <D.18178>;
  <D.18177>:
  gc_debug_file.16 = gc_debug_file;
  D.18180 = obj->vtable;
  D.18181 = D.18180->klass;
  D.18182 = D.18181->name;
  D.18183 = hash_table->num_entries;
  D.18184 = sgen_generation_name (generation);
  fprintf (gc_debug_file.16, "Added finalizer for object: %p (%s) (%d) to %s table\n", obj, D.18182, D.18183, D.18184);
  gc_debug_file.16 = gc_debug_file;
  fflush (gc_debug_file.16);
  <D.18178>:
  <D.18176>:
  goto <D.18185>;
  <D.18173>:
  D.18186 = sgen_hash_table_remove (hash_table, obj, 0B);
  if (D.18186 != 0) goto <D.18187>; else goto <D.18188>;
  <D.18187>:
  if (0 != 0) goto <D.18189>; else goto <D.18190>;
  <D.18189>:
  gc_debug_file.16 = gc_debug_file;
  D.18180 = obj->vtable;
  D.18181 = D.18180->klass;
  D.18182 = D.18181->name;
  D.18183 = hash_table->num_entries;
  fprintf (gc_debug_file.16, "Removed finalizer for object: %p (%s) (%d)\n", obj, D.18182, D.18183);
  gc_debug_file.16 = gc_debug_file;
  fflush (gc_debug_file.16);
  <D.18190>:
  <D.18188>:
  <D.18185>:
}


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 (*<T3086>) (struct MonoObject *, void *, int) process_func)
{
  int D.18192;
  long unsigned int D.18195;
  long unsigned int D.18196;
  struct StageEntry * D.18197;
  volatile gint32 * D.18198;
  int D.18199;
  struct MonoObject * D.18203;
  void * D.18204;
  int i;
  void retry = <<< error >>>;

  D.18192 = *next_entry;
  if (D.18192 != -1) goto <D.18193>; else goto <D.18194>;
  <D.18193>:
  return;
  <D.18194>:
  i = 0;
  goto <D.17835>;
  <D.17834>:
  {
    gint32 state;

    retry:
    D.18195 = (long unsigned int) i;
    D.18196 = D.18195 * 24;
    D.18197 = entries + D.18196;
    state = D.18197->state;
    switch (state) <default: <D.17832>, case 0: <D.17826>, case 1: <D.17829>, case 2: <D.17830>, case 3: <D.17827>>
    <D.17826>:
    <D.17827>:
    // predicted unlikely by continue predictor.
    goto <D.17828>;
    <D.17829>:
    D.18195 = (long unsigned int) i;
    D.18196 = D.18195 * 24;
    D.18197 = entries + D.18196;
    D.18198 = &D.18197->state;
    D.18199 = InterlockedCompareExchange (D.18198, 3, 1);
    if (D.18199 != 1) goto retry; else goto <D.18200>;
    <D.18200>:
    // predicted unlikely by continue predictor.
    goto <D.17828>;
    <D.17830>:
    goto <D.17831>;
    <D.17832>:
    if (1 != 0) goto <D.18201>; else goto <D.18202>;
    <D.18201>:
    monoeg_g_log (0B, 4, "Invalid stage entry state");
    <D.17833>:
    goto <D.17833>;
    <D.18202>:
    goto <D.17831>;
    <D.17831>:
    D.18195 = (long unsigned int) i;
    D.18196 = D.18195 * 24;
    D.18197 = entries + D.18196;
    D.18203 = D.18197->obj;
    D.18195 = (long unsigned int) i;
    D.18196 = D.18195 * 24;
    D.18197 = entries + D.18196;
    D.18204 = D.18197->user_data;
    process_func (D.18203, D.18204, i);
    D.18195 = (long unsigned int) i;
    D.18196 = D.18195 * 24;
    D.18197 = entries + D.18196;
    D.18197->obj = 0B;
    D.18195 = (long unsigned int) i;
    D.18196 = D.18195 * 24;
    D.18197 = entries + D.18196;
    D.18197->user_data = 0B;
    mono_memory_write_barrier ();
    D.18195 = (long unsigned int) i;
    D.18196 = D.18195 * 24;
    D.18197 = entries + D.18196;
    D.18197->state = 0;
  }
  <D.17828>:
  i = i + 1;
  <D.17835>:
  if (i < num_entries) goto <D.17834>; else goto <D.17836>;
  <D.17836>:
  mono_memory_write_barrier ();
  *next_entry = 0;
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.18208;
  unsigned int comp.17;
  unsigned int exch.18;
  unsigned int D.18211;

  comp.17 = (unsigned int) comp;
  exch.18 = (unsigned int) exch;
  D.18211 = __sync_val_compare_and_swap_4 (dest, comp.17, exch.18);
  D.18208 = (gint32) D.18211;
  return D.18208;
}


mono_memory_write_barrier ()
{
  mono_memory_barrier ();
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


__attribute__((visibility ("hidden")))
mono_gc_register_for_finalization (struct MonoObject * obj, void * user_data)
{
  int D.18213;
  int D.18216;

  goto <D.17871>;
  <D.17870>:
  D.18213 = try_lock_stage_for_processing (1024, &next_fin_stage_entry);
  if (D.18213 != 0) goto <D.18214>; else goto <D.18215>;
  <D.18214>:
  pthread_mutex_lock (&gc_mutex);
  process_stage_entries (1024, &next_fin_stage_entry, &fin_stage_entries, process_fin_stage_entry);
  sgen_gc_unlock ();
  <D.18215>:
  <D.17871>:
  D.18216 = add_stage_entry (1024, &next_fin_stage_entry, &fin_stage_entries, obj, user_data);
  if (D.18216 == -1) goto <D.17870>; else goto <D.17872>;
  <D.17872>:
}


try_lock_stage_for_processing (int num_entries, volatile gint32 * next_entry)
{
  gboolean D.18219;
  int D.18220;
  _Bool D.18221;
  gint32 old;

  old = *next_entry;
  if (old < num_entries) goto <D.18217>; else goto <D.18218>;
  <D.18217>:
  D.18219 = 0;
  return D.18219;
  <D.18218>:
  D.18220 = InterlockedCompareExchange (next_entry, -1, old);
  D.18221 = D.18220 == old;
  D.18219 = (gboolean) D.18221;
  return D.18219;
}


add_stage_entry (int num_entries, volatile gint32 * next_entry, struct StageEntry * entries, struct MonoObject * obj, void * user_data)
{
  int D.18225;
  long unsigned int D.18230;
  long unsigned int D.18231;
  struct StageEntry * D.18232;
  int D.18233;
  volatile gint32 * D.18235;
  int D.18236;
  int D.18237;
  int D.18240;
  int iftmp.19;
  _Bool D.18248;
  long int D.18249;
  long int D.18250;
  volatile gint32 * D.18253;
  int iftmp.20;
  _Bool D.18261;
  long int D.18262;
  long int D.18263;
  _Bool D.18266;
  long int D.18267;
  long int D.18268;
  gint32 index;
  gint32 new_next_entry;
  gint32 old_next_entry;
  gint32 previous_state;
  void retry = <<< error >>>;

  retry:
  <D.17854>:
  index = *next_entry;
  if (index >= num_entries) goto <D.18223>; else goto <D.18224>;
  <D.18223>:
  D.18225 = -1;
  return D.18225;
  <D.18224>:
  if (index < 0) goto <D.18226>; else goto <D.18227>;
  <D.18226>:
  goto <D.17850>;
  <D.17849>:
  monoeg_g_usleep (200);
  <D.17850>:
  index = *next_entry;
  if (index < 0) goto <D.17849>; else goto <D.17851>;
  <D.17851>:
  // predicted unlikely by continue predictor.
  goto <D.17852>;
  <D.18227>:
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18233 = D.18232->state;
  if (D.18233 != 0) goto <D.18228>; else goto <D.18234>;
  <D.18234>:
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18235 = &D.18232->state;
  D.18236 = InterlockedCompareExchange (D.18235, 1, 0);
  if (D.18236 != 0) goto <D.18228>; else goto <D.18229>;
  <D.18228>:
  D.18237 = *next_entry;
  if (D.18237 == index) goto <D.18238>; else goto <D.18239>;
  <D.18238>:
  D.18240 = index + 1;
  InterlockedCompareExchange (next_entry, D.18240, index);
  <D.18239>:
  // predicted unlikely by continue predictor.
  goto <D.17852>;
  <D.18229>:
  mono_memory_write_barrier ();
  D.18240 = index + 1;
  old_next_entry = InterlockedCompareExchange (next_entry, D.18240, index);
  if (old_next_entry < index) goto <D.18241>; else goto <D.18242>;
  <D.18241>:
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18232->state = 0;
  // predicted unlikely by continue predictor.
  goto <D.17852>;
  <D.18242>:
  goto <D.17853>;
  <D.17852>:
  goto <D.17854>;
  <D.17853>:
  if (index < 0) goto <D.18244>; else goto <D.18247>;
  <D.18247>:
  if (index >= num_entries) goto <D.18244>; else goto <D.18245>;
  <D.18244>:
  iftmp.19 = 1;
  goto <D.18246>;
  <D.18245>:
  iftmp.19 = 0;
  <D.18246>:
  D.18248 = iftmp.19 != 0;
  D.18249 = (long int) D.18248;
  D.18250 = __builtin_expect (D.18249, 0);
  if (D.18250 != 0) goto <D.18251>; else goto <D.18252>;
  <D.18251>:
  monoeg_g_log (0B, 4, "Invalid index");
  <D.17855>:
  goto <D.17855>;
  <D.18252>:
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18232->obj = obj;
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18232->user_data = user_data;
  mono_memory_write_barrier ();
  new_next_entry = *next_entry;
  mono_memory_read_barrier ();
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18253 = &D.18232->state;
  previous_state = InterlockedCompareExchange (D.18253, 2, 1);
  if (previous_state == 1) goto <D.18254>; else goto <D.18255>;
  <D.18254>:
  if (new_next_entry < index) goto <D.18259>; else goto <D.18257>;
  <D.18259>:
  if (new_next_entry >= 0) goto <D.18260>; else goto <D.18257>;
  <D.18260>:
  iftmp.20 = 1;
  goto <D.18258>;
  <D.18257>:
  iftmp.20 = 0;
  <D.18258>:
  D.18261 = iftmp.20 != 0;
  D.18262 = (long int) D.18261;
  D.18263 = __builtin_expect (D.18262, 0);
  if (D.18263 != 0) goto <D.18264>; else goto <D.18265>;
  <D.18264>:
  monoeg_g_log (0B, 4, "Invalid next entry index - as long as we\'re busy, other thread can only increment or invalidate it");
  <D.17856>:
  goto <D.17856>;
  <D.18265>:
  D.18225 = index;
  return D.18225;
  <D.18255>:
  D.18266 = previous_state != 3;
  D.18267 = (long int) D.18266;
  D.18268 = __builtin_expect (D.18267, 0);
  if (D.18268 != 0) goto <D.18269>; else goto <D.18270>;
  <D.18269>:
  monoeg_g_log (0B, 4, "Invalid state transition - other thread can only make busy state invalid");
  <D.17857>:
  goto <D.17857>;
  <D.18270>:
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18232->obj = 0B;
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18232->user_data = 0B;
  mono_memory_write_barrier ();
  D.18230 = (long unsigned int) index;
  D.18231 = D.18230 * 24;
  D.18232 = entries + D.18231;
  D.18232->state = 0;
  goto retry;
}


mono_memory_read_barrier ()
{
  mono_memory_barrier ();
}


__attribute__((visibility ("hidden")))
mono_gc_finalizers_for_domain (struct MonoDomain * domain, struct MonoObject * * out_array, int out_size)
{
  long unsigned int D.18274;
  long unsigned int D.18275;
  struct MonoObject * * D.18276;
  int D.18277;
  int D.18278;
  int D.18279;
  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.18272>; else goto <D.18273>;
  <D.18272>:
  D.18274 = (long unsigned int) result;
  D.18275 = D.18274 * 8;
  D.18276 = out_array + D.18275;
  D.18277 = out_size - result;
  D.18278 = finalizers_for_domain (domain, D.18276, D.18277, &major_finalizable_hash);
  result = D.18278 + result;
  <D.18273>:
  sgen_gc_unlock ();
  D.18279 = result;
  return D.18279;
}


finalizers_for_domain (struct MonoDomain * domain, struct MonoObject * * out_array, int out_size, struct SgenHashTable * hash_table)
{
  int no_finalize.21;
  int D.18286;
  long unsigned int D.18287;
  long unsigned int D.18288;
  struct MonoVTable * D.18289;
  struct MonoDomain * D.18290;
  struct SgenHashTableEntry * D.18293;
  unsigned int D.18294;
  unsigned int D.18295;
  int D.18298;
  int count.22;
  long unsigned int D.18300;
  long unsigned int D.18301;
  struct MonoObject * * D.18302;
  struct FILE * gc_debug_file.23;
  const char * D.18306;
  int num_ready_finalizers.24;
  unsigned int D.18308;
  struct SgenHashTableEntry * D.18311;
  unsigned int D.18312;
  struct MonoObject * object;
  void * dummy;
  int count;

  no_finalize.21 = no_finalize;
  if (no_finalize.21 != 0) goto <D.18281>; else goto <D.18284>;
  <D.18284>:
  if (out_size == 0) goto <D.18281>; else goto <D.18285>;
  <D.18285>:
  if (out_array == 0B) goto <D.18281>; else goto <D.18282>;
  <D.18281>:
  D.18286 = 0;
  return D.18286;
  <D.18282>:
  count = 0;
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

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

      D.18287 = (long unsigned int) __i;
      D.18288 = D.18287 * 8;
      __iter = __table + D.18288;
      goto <D.17890>;
      <D.17889>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.18289 = object->vtable;
        D.18290 = D.18289->domain;
        if (D.18290 == domain) goto <D.18291>; else goto <D.18292>;
        <D.18291>:
        D.18293 = *__next;
        *__iter = D.18293;
        __next = __iter;
        D.18294 = __hash_table->num_entries;
        D.18295 = D.18294 + 4294967295;
        __hash_table->num_entries = D.18295;
        if (1 != 0) goto <D.18296>; else goto <D.18297>;
        <D.18296>:
        D.18298 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.18298);
        <D.18297>:
        count.22 = count;
        count = count.22 + 1;
        D.18300 = (long unsigned int) count.22;
        D.18301 = D.18300 * 8;
        D.18302 = out_array + D.18301;
        *D.18302 = object;
        if (0 != 0) goto <D.18303>; else goto <D.18304>;
        <D.18303>:
        gc_debug_file.23 = gc_debug_file;
        D.18306 = sgen_safe_name (object);
        num_ready_finalizers.24 = num_ready_finalizers;
        D.18308 = hash_table->num_entries;
        fprintf (gc_debug_file.23, "Collecting object for finalization: %p (%s) (%d/%d)\n", object, D.18306, num_ready_finalizers.24, D.18308);
        gc_debug_file.23 = gc_debug_file;
        fflush (gc_debug_file.23);
        <D.18304>:
        if (count == out_size) goto <D.18309>; else goto <D.18310>;
        <D.18309>:
        D.18286 = count;
        return D.18286;
        <D.18310>:
        // predicted unlikely by continue predictor.
        goto <D.17888>;
        <D.18292>:
      }
      <D.17888>:
      __iter = __next;
      <D.17890>:
      D.18311 = *__iter;
      if (D.18311 != 0B) goto <D.17889>; else goto <D.17891>;
      <D.17891>:
    }
    __i = __i + 1;
    <D.17893>:
    D.18312 = hash_table->size;
    if (D.18312 > __i) goto <D.17892>; else goto <D.17894>;
    <D.17894>:
  }
  D.18286 = count;
  return D.18286;
}


__attribute__((visibility ("hidden")))
sgen_null_link_in_range (int generation, gboolean before_finalization, struct ScanCopyContext ctx)
{
  long unsigned int D.18314;
  long unsigned int D.18315;
  void * D.18316;
  struct FILE * gc_debug_file.25;
  long unsigned int D.18322;
  long unsigned int D.18323;
  _Bool D.18324;
  long unsigned int D.18327;
  long unsigned int D.18328;
  gboolean (*<T2dda>) (char *) D.18333;
  int D.18334;
  int D.18337;
  struct SgenHashTableEntry * D.18342;
  unsigned int D.18343;
  unsigned int D.18344;
  int D.18347;
  char * copy.26;
  int D.18351;
  _Bool D.18355;
  long int D.18356;
  long int D.18357;
  long unsigned int iftmp.27;
  long unsigned int copy.28;
  long unsigned int D.18365;
  long unsigned int D.18366;
  void * D.18367;
  long unsigned int iftmp.29;
  long unsigned int D.18374;
  long unsigned int D.18375;
  void * D.18376;
  void * D.18379;
  struct SgenHashTableEntry * D.18380;
  unsigned int D.18381;
  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.17939>;
    <D.17938>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18314 = (long unsigned int) __i;
      D.18315 = D.18314 * 8;
      __iter = __table + D.18315;
      goto <D.17936>;
      <D.17935>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18316 = *link;
          if (D.18316 == 0B) goto <D.18317>; else goto <D.18318>;
          <D.18317>:
          if (0 != 0) goto <D.18319>; else goto <D.18320>;
          <D.18319>:
          gc_debug_file.25 = gc_debug_file;
          fprintf (gc_debug_file.25, "Dislink %p was externally nullified\n", link);
          gc_debug_file.25 = gc_debug_file;
          fflush (gc_debug_file.25);
          <D.18320>:
          // predicted unlikely by continue predictor.
          goto <D.17933>;
          <D.18318>:
          D.18316 = *link;
          D.18322 = (long unsigned int) D.18316;
          D.18323 = D.18322 & 1;
          D.18324 = D.18323 == 0;
          track = (gboolean) D.18324;
          if (track != before_finalization) goto <D.18325>; else goto <D.18326>;
          <D.18325>:
          D.18316 = *link;
          D.18322 = (long unsigned int) D.18316;
          D.18327 = ~D.18322;
          D.18328 = D.18327 & 18446744073709551612;
          object = (char *) D.18328;
          if (object == 0B) goto <D.18329>; else goto <D.18330>;
          <D.18329>:
          if (0 != 0) goto <D.18331>; else goto <D.18332>;
          <D.18331>:
          gc_debug_file.25 = gc_debug_file;
          fprintf (gc_debug_file.25, "Dislink %p with a hidden null object\n", link);
          gc_debug_file.25 = gc_debug_file;
          fflush (gc_debug_file.25);
          <D.18332>:
          // predicted unlikely by continue predictor.
          goto <D.17933>;
          <D.18330>:
          D.18333 = major_collector.is_object_live;
          D.18334 = D.18333 (object);
          if (D.18334 == 0) goto <D.18335>; else goto <D.18336>;
          <D.18335>:
          D.18337 = sgen_gc_is_object_ready_for_finalization (object);
          if (D.18337 != 0) goto <D.18338>; else goto <D.18339>;
          <D.18338>:
          *link = 0B;
          if (0 != 0) goto <D.18340>; else goto <D.18341>;
          <D.18340>:
          gc_debug_file.25 = gc_debug_file;
          fprintf (gc_debug_file.25, "Dislink nullified at %p to GCed object %p\n", link, object);
          gc_debug_file.25 = gc_debug_file;
          fflush (gc_debug_file.25);
          <D.18341>:
          D.18342 = *__next;
          *__iter = D.18342;
          __next = __iter;
          D.18343 = __hash_table->num_entries;
          D.18344 = D.18343 + 4294967295;
          __hash_table->num_entries = D.18344;
          if (1 != 0) goto <D.18345>; else goto <D.18346>;
          <D.18345>:
          D.18347 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.18347);
          <D.18346>:
          // predicted unlikely by continue predictor.
          goto <D.17933>;
          <D.18339>:
          {
            char * copy;

            try
              {
                copy = object;
                copy_func (&copy, queue);
                if (hash == &minor_disappearing_link_hash) goto <D.18349>; else goto <D.18348>;
                <D.18349>:
                copy.26 = copy;
                D.18351 = sgen_ptr_in_nursery (copy.26);
                if (D.18351 == 0) goto <D.18352>; else goto <D.18348>;
                <D.18352>:
                D.18342 = *__next;
                *__iter = D.18342;
                __next = __iter;
                D.18343 = __hash_table->num_entries;
                D.18344 = D.18343 + 4294967295;
                __hash_table->num_entries = D.18344;
                if (1 != 0) goto <D.18353>; else goto <D.18354>;
                <D.18353>:
                D.18347 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.18347);
                <D.18354>:
                copy.26 = copy;
                D.18355 = copy.26 == 0B;
                D.18356 = (long int) D.18355;
                D.18357 = __builtin_expect (D.18356, 0);
                if (D.18357 != 0) goto <D.18358>; else goto <D.18359>;
                <D.18358>:
                monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-fin-weak-hash.c", 700, "copy");
                <D.18359>:
                if (track != 0) goto <D.18361>; else goto <D.18362>;
                <D.18361>:
                iftmp.27 = 1;
                goto <D.18363>;
                <D.18362>:
                iftmp.27 = 0;
                <D.18363>:
                copy.26 = copy;
                copy.28 = (long unsigned int) copy.26;
                D.18365 = iftmp.27 | copy.28;
                D.18366 = ~D.18365;
                D.18367 = (void *) D.18366;
                *link = D.18367;
                copy.26 = copy;
                add_or_remove_disappearing_link (copy.26, link, 1);
                if (0 != 0) goto <D.18368>; else goto <D.18369>;
                <D.18368>:
                gc_debug_file.25 = gc_debug_file;
                copy.26 = copy;
                fprintf (gc_debug_file.25, "Upgraded dislink at %p to major because object %p moved to %p\n", link, object, copy.26);
                gc_debug_file.25 = gc_debug_file;
                fflush (gc_debug_file.25);
                <D.18369>:
                // predicted unlikely by continue predictor.
                goto <D.17933>;
                <D.18348>:
                if (track != 0) goto <D.18371>; else goto <D.18372>;
                <D.18371>:
                iftmp.29 = 1;
                goto <D.18373>;
                <D.18372>:
                iftmp.29 = 0;
                <D.18373>:
                copy.26 = copy;
                copy.28 = (long unsigned int) copy.26;
                D.18374 = iftmp.29 | copy.28;
                D.18375 = ~D.18374;
                D.18376 = (void *) D.18375;
                *link = D.18376;
                if (0 != 0) goto <D.18377>; else goto <D.18378>;
                <D.18377>:
                gc_debug_file.25 = gc_debug_file;
                D.18316 = *link;
                D.18322 = (long unsigned int) D.18316;
                D.18327 = ~D.18322;
                D.18328 = D.18327 & 18446744073709551612;
                D.18379 = (void *) D.18328;
                fprintf (gc_debug_file.25, "Updated dislink at %p to %p\n", link, D.18379);
                gc_debug_file.25 = gc_debug_file;
                fflush (gc_debug_file.25);
                <D.18378>:
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.18336>:
          <D.18326>:
        }
      }
      <D.17933>:
      __iter = __next;
      <D.17936>:
      D.18380 = *__iter;
      if (D.18380 != 0B) goto <D.17935>; else goto <D.17937>;
      <D.17937>:
    }
    __i = __i + 1;
    <D.17939>:
    D.18381 = hash->size;
    if (D.18381 > __i) goto <D.17938>; else goto <D.17940>;
    <D.17940>:
  }
}


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

  switch (generation) <default: <D.17908>, case 0: <D.17906>, case 1: <D.17907>>
  <D.17906>:
  D.18384 = &minor_disappearing_link_hash;
  return D.18384;
  <D.17907>:
  D.18384 = &major_disappearing_link_hash;
  return D.18384;
  <D.17908>:
  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.18388;
  struct FILE * gc_debug_file.30;
  unsigned int D.18394;
  const char * D.18395;
  struct MonoVTable * D.18398;
  struct MonoClass * D.18399;
  const char * D.18400;
  const char * D.18401;
  struct SgenHashTable * hash_table;

  hash_table = get_dislink_hash_table (generation);
  if (obj == 0B) goto <D.18386>; else goto <D.18387>;
  <D.18386>:
  D.18388 = sgen_hash_table_remove (hash_table, link, 0B);
  if (D.18388 != 0) goto <D.18389>; else goto <D.18390>;
  <D.18389>:
  if (0 != 0) goto <D.18391>; else goto <D.18392>;
  <D.18391>:
  gc_debug_file.30 = gc_debug_file;
  D.18394 = hash_table->num_entries;
  D.18395 = sgen_generation_name (generation);
  fprintf (gc_debug_file.30, "Removed dislink %p (%d) from %s table\n", link, D.18394, D.18395);
  gc_debug_file.30 = gc_debug_file;
  fflush (gc_debug_file.30);
  <D.18392>:
  <D.18390>:
  return;
  <D.18387>:
  sgen_hash_table_replace (hash_table, link, 0B, 0B);
  if (0 != 0) goto <D.18396>; else goto <D.18397>;
  <D.18396>:
  gc_debug_file.30 = gc_debug_file;
  D.18398 = obj->vtable;
  D.18399 = D.18398->klass;
  D.18400 = D.18399->name;
  D.18401 = sgen_generation_name (generation);
  fprintf (gc_debug_file.30, "Added dislink for object: %p (%s) at %p to %s table\n", obj, D.18400, link, D.18401);
  gc_debug_file.30 = gc_debug_file;
  fflush (gc_debug_file.30);
  <D.18397>:
}


__attribute__((visibility ("hidden")))
sgen_null_links_for_domain (struct MonoDomain * domain, int generation)
{
  long unsigned int D.18403;
  long unsigned int D.18404;
  void * D.18405;
  long unsigned int D.18406;
  long unsigned int D.18407;
  long unsigned int D.18408;
  struct MonoVTable * D.18413;
  struct FILE * gc_debug_file.31;
  struct SgenHashTableEntry * D.18421;
  unsigned int D.18422;
  unsigned int D.18423;
  int D.18426;
  struct SgenHashTableEntry * D.18427;
  unsigned int D.18428;
  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.17961>;
    <D.17960>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18403 = (long unsigned int) __i;
      D.18404 = D.18403 * 8;
      __iter = __table + D.18404;
      goto <D.17958>;
      <D.17957>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18405 = *link;
          D.18406 = (long unsigned int) D.18405;
          D.18407 = ~D.18406;
          D.18408 = D.18407 & 18446744073709551612;
          object = (char *) D.18408;
          D.18405 = *link;
          if (D.18405 != 0B) goto <D.18409>; else goto <D.18410>;
          <D.18409>:
          if (object != 0B) goto <D.18411>; else goto <D.18412>;
          <D.18411>:
          D.18413 = MEM[(struct MonoObject *)object].vtable;
          if (D.18413 == 0B) goto <D.18414>; else goto <D.18415>;
          <D.18414>:
          {
            gboolean free;

            free = 1;
            D.18405 = *link;
            if (D.18405 != 0B) goto <D.18416>; else goto <D.18417>;
            <D.18416>:
            *link = 0B;
            free = 0;
            if (0 != 0) goto <D.18418>; else goto <D.18419>;
            <D.18418>:
            gc_debug_file.31 = gc_debug_file;
            fprintf (gc_debug_file.31, "Disappearing link %p not freed\n", link);
            gc_debug_file.31 = gc_debug_file;
            fflush (gc_debug_file.31);
            <D.18419>:
            <D.18417>:
            D.18421 = *__next;
            *__iter = D.18421;
            __next = __iter;
            D.18422 = __hash_table->num_entries;
            D.18423 = D.18422 + 4294967295;
            __hash_table->num_entries = D.18423;
            if (free != 0) goto <D.18424>; else goto <D.18425>;
            <D.18424>:
            D.18426 = __hash_table->entry_mem_type;
            sgen_free_internal (__entry, D.18426);
            <D.18425>:
            // predicted unlikely by continue predictor.
            goto <D.17956>;
          }
          <D.18415>:
          <D.18412>:
          <D.18410>:
        }
      }
      <D.17956>:
      __iter = __next;
      <D.17958>:
      D.18427 = *__iter;
      if (D.18427 != 0B) goto <D.17957>; else goto <D.17959>;
      <D.17959>:
    }
    __i = __i + 1;
    <D.17961>:
    D.18428 = hash->size;
    if (D.18428 > __i) goto <D.17960>; else goto <D.17962>;
    <D.17962>:
  }
}


__attribute__((visibility ("hidden")))
sgen_null_links_with_predicate (int generation, mono_bool (*WeakLinkAlivePredicateFunc) (struct MonoObject *, void *) predicate, void * data)
{
  long unsigned int D.18429;
  long unsigned int D.18430;
  void * D.18431;
  long unsigned int D.18432;
  long unsigned int D.18433;
  long unsigned int D.18434;
  struct FILE * gc_debug_file.32;
  struct SgenHashTableEntry * D.18442;
  unsigned int D.18443;
  unsigned int D.18444;
  int D.18447;
  struct SgenHashTableEntry * D.18448;
  unsigned int D.18449;
  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.17984>;
    <D.17983>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18429 = (long unsigned int) __i;
      D.18430 = D.18429 * 8;
      __iter = __table + D.18430;
      goto <D.17981>;
      <D.17980>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18431 = *link;
          D.18432 = (long unsigned int) D.18431;
          D.18433 = ~D.18432;
          D.18434 = D.18433 & 18446744073709551612;
          object = (char *) D.18434;
          D.18431 = *link;
          if (D.18431 == 0B) goto <D.18435>; else goto <D.18436>;
          <D.18435>:
          // predicted unlikely by continue predictor.
          goto <D.17979>;
          <D.18436>:
          is_alive = predicate (object, data);
          if (is_alive == 0) goto <D.18437>; else goto <D.18438>;
          <D.18437>:
          *link = 0B;
          if (0 != 0) goto <D.18439>; else goto <D.18440>;
          <D.18439>:
          gc_debug_file.32 = gc_debug_file;
          fprintf (gc_debug_file.32, "Dislink nullified by predicate at %p to GCed object %p\n", link, object);
          gc_debug_file.32 = gc_debug_file;
          fflush (gc_debug_file.32);
          <D.18440>:
          D.18442 = *__next;
          *__iter = D.18442;
          __next = __iter;
          D.18443 = __hash_table->num_entries;
          D.18444 = D.18443 + 4294967295;
          __hash_table->num_entries = D.18444;
          if (1 != 0) goto <D.18445>; else goto <D.18446>;
          <D.18445>:
          D.18447 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.18447);
          <D.18446>:
          // predicted unlikely by continue predictor.
          goto <D.17979>;
          <D.18438>:
        }
      }
      <D.17979>:
      __iter = __next;
      <D.17981>:
      D.18448 = *__iter;
      if (D.18448 != 0B) goto <D.17980>; else goto <D.17982>;
      <D.17982>:
    }
    __i = __i + 1;
    <D.17984>:
    D.18449 = hash->size;
    if (D.18449 > __i) goto <D.17983>; else goto <D.17985>;
    <D.17985>:
  }
}


__attribute__((visibility ("hidden")))
sgen_remove_finalizers_for_domain (struct MonoDomain * domain, int generation)
{
  long unsigned int D.18450;
  long unsigned int D.18451;
  struct MonoVTable * D.18452;
  struct MonoDomain * D.18453;
  struct FILE * gc_debug_file.33;
  const char * D.18459;
  struct SgenHashTableEntry * D.18460;
  unsigned int D.18461;
  unsigned int D.18462;
  int D.18465;
  struct SgenHashTableEntry * D.18466;
  unsigned int D.18467;
  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.18004>;
    <D.18003>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18450 = (long unsigned int) __i;
      D.18451 = D.18450 * 8;
      __iter = __table + D.18451;
      goto <D.18001>;
      <D.18000>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.18452 = object->vtable;
        D.18453 = D.18452->domain;
        if (D.18453 == domain) goto <D.18454>; else goto <D.18455>;
        <D.18454>:
        if (0 != 0) goto <D.18456>; else goto <D.18457>;
        <D.18456>:
        gc_debug_file.33 = gc_debug_file;
        D.18459 = sgen_safe_name (object);
        fprintf (gc_debug_file.33, "Unregistering finalizer for object: %p (%s)\n", object, D.18459);
        gc_debug_file.33 = gc_debug_file;
        fflush (gc_debug_file.33);
        <D.18457>:
        D.18460 = *__next;
        *__iter = D.18460;
        __next = __iter;
        D.18461 = __hash_table->num_entries;
        D.18462 = D.18461 + 4294967295;
        __hash_table->num_entries = D.18462;
        if (1 != 0) goto <D.18463>; else goto <D.18464>;
        <D.18463>:
        D.18465 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.18465);
        <D.18464>:
        // predicted unlikely by continue predictor.
        goto <D.17999>;
        <D.18455>:
      }
      <D.17999>:
      __iter = __next;
      <D.18001>:
      D.18466 = *__iter;
      if (D.18466 != 0B) goto <D.18000>; else goto <D.18002>;
      <D.18002>:
    }
    __i = __i + 1;
    <D.18004>:
    D.18467 = hash_table->size;
    if (D.18467 > __i) goto <D.18003>; else goto <D.18005>;
    <D.18005>:
  }
}


__attribute__((visibility ("hidden")))
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.18472;
  void * * link;

  link = _link;
  if (index >= 0) goto <D.18468>; else goto <D.18469>;
  <D.18468>:
  <D.18469>:
  add_or_remove_disappearing_link (0B, link, 0);
  add_or_remove_disappearing_link (0B, link, 1);
  if (obj != 0B) goto <D.18470>; else goto <D.18471>;
  <D.18470>:
  D.18472 = sgen_ptr_in_nursery (obj);
  if (D.18472 != 0) goto <D.18473>; else goto <D.18474>;
  <D.18473>:
  add_or_remove_disappearing_link (obj, link, 0);
  goto <D.18475>;
  <D.18474>:
  add_or_remove_disappearing_link (obj, link, 1);
  <D.18475>:
  <D.18471>:
}


__attribute__((visibility ("hidden")))
sgen_register_disappearing_link (struct MonoObject * obj, void * * link, gboolean track, gboolean in_gc)
{
  long unsigned int iftmp.34;
  long unsigned int obj.35;
  long unsigned int D.18483;
  long unsigned int D.18484;
  void * D.18485;
  int D.18490;

  if (obj != 0B) goto <D.18476>; else goto <D.18477>;
  <D.18476>:
  if (track != 0) goto <D.18479>; else goto <D.18480>;
  <D.18479>:
  iftmp.34 = 1;
  goto <D.18481>;
  <D.18480>:
  iftmp.34 = 0;
  <D.18481>:
  obj.35 = (long unsigned int) obj;
  D.18483 = iftmp.34 | obj.35;
  D.18484 = ~D.18483;
  D.18485 = (void *) D.18484;
  *link = D.18485;
  goto <D.18486>;
  <D.18477>:
  *link = 0B;
  <D.18486>:
  if (in_gc != 0) goto <D.18487>; else goto <D.18488>;
  <D.18487>:
  process_dislink_stage_entry (obj, link, -1);
  goto <D.18489>;
  <D.18488>:
  {
    int index;

    goto <D.18025>;
    <D.18024>:
    D.18490 = try_lock_stage_for_processing (1024, &next_dislink_stage_entry);
    if (D.18490 != 0) goto <D.18491>; else goto <D.18492>;
    <D.18491>:
    pthread_mutex_lock (&gc_mutex);
    process_stage_entries (1024, &next_dislink_stage_entry, &dislink_stage_entries, process_dislink_stage_entry);
    sgen_gc_unlock ();
    <D.18492>:
    <D.18025>:
    index = add_stage_entry (1024, &next_dislink_stage_entry, &dislink_stage_entries, obj, link);
    if (index == -1) goto <D.18024>; else goto <D.18026>;
    <D.18026>:
  }
  <D.18489>:
}


__attribute__((visibility ("hidden")))
sgen_init_fin_weak_hash ()
{

}


