sgen_mark_bridge_object (struct MonoObject * obj)
{
  int D.18417;
  _Bool D.18418;
  int D.18419;
  struct MonoObject * D.18420;
  struct SgenHashTable * hash_table;

  D.18417 = sgen_ptr_in_nursery (obj);
  D.18418 = D.18417 == 0;
  D.18419 = (int) D.18418;
  hash_table = get_finalize_entry_hash_table (D.18419);
  D.18420 = tagged_object_apply (obj, 1);
  sgen_hash_table_set_key (hash_table, obj, D.18420);
}


sgen_ptr_in_nursery (void * p)
{
  gboolean D.18421;
  int sgen_nursery_bits.0;
  int D.18423;
  int D.18424;
  long unsigned int D.18425;
  long unsigned int p.1;
  long unsigned int D.18427;
  char * sgen_nursery_start.2;
  long unsigned int sgen_nursery_start.3;
  _Bool D.18430;

  sgen_nursery_bits.0 = sgen_nursery_bits;
  D.18423 = 1 << sgen_nursery_bits.0;
  D.18424 = -D.18423;
  D.18425 = (long unsigned int) D.18424;
  p.1 = (long unsigned int) p;
  D.18427 = D.18425 & p.1;
  sgen_nursery_start.2 = sgen_nursery_start;
  sgen_nursery_start.3 = (long unsigned int) sgen_nursery_start.2;
  D.18430 = D.18427 == sgen_nursery_start.3;
  D.18421 = (gboolean) D.18430;
  return D.18421;
}


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

  switch (generation) <default: <D.18125>, case 0: <D.18123>, case 1: <D.18124>>
  <D.18123>:
  D.18432 = &minor_finalizable_hash;
  return D.18432;
  <D.18124>:
  D.18432 = &major_finalizable_hash;
  return D.18432;
  <D.18125>:
  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.18434;
  struct MonoObject * D.18435;
  struct MonoObject * D.18436;
  _Bool D.18437;

  D.18435 = tagged_object_get_object (a);
  D.18436 = tagged_object_get_object (b);
  D.18437 = D.18435 == D.18436;
  D.18434 = (gboolean) D.18437;
  return D.18434;
}


tagged_object_get_object (struct MonoObject * object)
{
  struct MonoObject * D.18439;
  long unsigned int object.4;
  long unsigned int D.18441;

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


tagged_object_hash (struct MonoObject * o)
{
  int D.18443;
  struct MonoObject * D.18444;

  D.18444 = tagged_object_get_object (o);
  D.18443 = mono_object_hash (D.18444);
  return D.18443;
}


tagged_object_apply (void * object, int tag_bits)
{
  struct MonoObject * D.18446;
  long unsigned int D.18447;
  long unsigned int object.5;
  long unsigned int D.18449;

  D.18447 = (long unsigned int) tag_bits;
  object.5 = (long unsigned int) object;
  D.18449 = D.18447 | object.5;
  D.18446 = (struct MonoObject *) D.18449;
  return D.18446;
}


sgen_collect_bridge_objects (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.6;
  long unsigned int D.18454;
  long unsigned int D.18455;
  gboolean (*<T2d21>) (char *) D.18458;
  int D.18459;
  int D.18462;
  int D.18465;
  char * copy.7;
  int D.18471;
  struct SgenHashTableEntry * D.18473;
  unsigned int D.18474;
  unsigned int D.18475;
  int D.18478;
  struct MonoObject * D.18479;
  struct FILE * gc_debug_file.8;
  const char * D.18483;
  const char * D.18486;
  struct MonoObject * D.18487;
  struct SgenHashTableEntry * D.18488;
  unsigned int D.18489;
  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.18452>; else goto <D.18453>;
      <D.18452>:
      return;
      <D.18453>:
      {
        struct SgenHashTable * __hash_table;
        struct SgenHashTableEntry * * __table;
        guint __i;

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

          D.18454 = (long unsigned int) __i;
          D.18455 = D.18454 * 8;
          __iter = __table + D.18455;
          goto <D.18149>;
          <D.18148>:
          {
            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.18456>; else goto <D.18457>;
              <D.18456>:
              // predicted unlikely by continue predictor.
              goto <D.18147>;
              <D.18457>:
              D.18458 = major_collector.is_object_live;
              D.18459 = D.18458 (object);
              if (D.18459 != 0) goto <D.18460>; else goto <D.18461>;
              <D.18460>:
              // predicted unlikely by continue predictor.
              goto <D.18147>;
              <D.18461>:
              D.18462 = sgen_gc_is_object_ready_for_finalization (object);
              if (D.18462 == 0) goto <D.18463>; else goto <D.18464>;
              <D.18463>:
              // predicted unlikely by continue predictor.
              goto <D.18147>;
              <D.18464>:
              D.18465 = sgen_is_bridge_object (object);
              if (D.18465 == 0) goto <D.18466>; else goto <D.18467>;
              <D.18466>:
              // predicted unlikely by continue predictor.
              goto <D.18147>;
              <D.18467>:
              copy = object;
              copy_func (&copy, queue);
              copy.7 = copy;
              sgen_bridge_register_finalized_object (copy.7);
              if (hash_table == &minor_finalizable_hash) goto <D.18470>; else goto <D.18469>;
              <D.18470>:
              copy.7 = copy;
              D.18471 = sgen_ptr_in_nursery (copy.7);
              if (D.18471 == 0) goto <D.18472>; else goto <D.18469>;
              <D.18472>:
              D.18473 = *__next;
              *__iter = D.18473;
              __next = __iter;
              D.18474 = __hash_table->num_entries;
              D.18475 = D.18474 + 4294967295;
              __hash_table->num_entries = D.18475;
              if (1 != 0) goto <D.18476>; else goto <D.18477>;
              <D.18476>:
              D.18478 = __hash_table->entry_mem_type;
              sgen_free_internal (__entry, D.18478);
              <D.18477>:
              copy.7 = copy;
              D.18479 = tagged_object_apply (copy.7, tag);
              sgen_hash_table_replace (&major_finalizable_hash, D.18479, 0B, 0B);
              if (0 != 0) goto <D.18480>; else goto <D.18481>;
              <D.18480>:
              gc_debug_file.8 = gc_debug_file;
              copy.7 = copy;
              copy.7 = copy;
              D.18483 = 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.18483, object);
              gc_debug_file.8 = gc_debug_file;
              fflush (gc_debug_file.8);
              <D.18481>:
              // predicted unlikely by continue predictor.
              goto <D.18147>;
              <D.18469>:
              if (0 != 0) goto <D.18484>; else goto <D.18485>;
              <D.18484>:
              gc_debug_file.8 = gc_debug_file;
              copy.7 = copy;
              copy.7 = copy;
              D.18486 = sgen_safe_name (copy.7);
              fprintf (gc_debug_file.8, "Updating object for finalization: %p (%s) (was at %p)\n", copy.7, D.18486, object);
              gc_debug_file.8 = gc_debug_file;
              fflush (gc_debug_file.8);
              <D.18485>:
              copy.7 = copy;
              D.18487 = tagged_object_apply (copy.7, tag);
              __entry->key = D.18487;
            }
          }
          <D.18147>:
          __iter = __next;
          <D.18149>:
          D.18488 = *__iter;
          if (D.18488 != 0B) goto <D.18148>; else goto <D.18150>;
          <D.18150>:
        }
        __i = __i + 1;
        <D.18152>:
        D.18489 = hash_table->size;
        if (D.18489 > __i) goto <D.18151>; else goto <D.18153>;
        <D.18153>:
      }
    }
  finally
    {
      copy = {CLOBBER};
    }
}


tagged_object_get_tag (struct MonoObject * object)
{
  int D.18493;
  long int object.9;
  int D.18495;

  object.9 = (long int) object;
  D.18495 = (int) object.9;
  D.18493 = D.18495 & 1;
  return D.18493;
}


sgen_finalize_in_range (int generation, struct ScanCopyContext ctx)
{
  int no_finalize.10;
  long unsigned int D.18500;
  long unsigned int D.18501;
  gboolean (*<T2d21>) (char *) D.18502;
  int D.18503;
  struct SgenHashTableEntry * D.18508;
  unsigned int D.18509;
  unsigned int D.18510;
  int D.18513;
  int num_ready_finalizers.11;
  int num_ready_finalizers.12;
  struct MonoObject * copy.13;
  struct FILE * gc_debug_file.14;
  const char * D.18520;
  unsigned int D.18521;
  int D.18524;
  struct MonoObject * D.18528;
  const char * D.18531;
  const char * D.18534;
  struct MonoObject * D.18535;
  struct SgenHashTableEntry * D.18536;
  unsigned int D.18537;
  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.18498>; else goto <D.18499>;
  <D.18498>:
  return;
  <D.18499>:
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

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

      D.18500 = (long unsigned int) __i;
      D.18501 = D.18500 * 8;
      __iter = __table + D.18501;
      goto <D.18174>;
      <D.18173>:
      {
        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.18502 = major_collector.is_object_live;
          D.18503 = D.18502 (object);
          if (D.18503 == 0) goto <D.18504>; else goto <D.18505>;
          <D.18504>:
          {
            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.18506>; else goto <D.18507>;
                <D.18506>:
                D.18508 = *__next;
                *__iter = D.18508;
                __next = __iter;
                D.18509 = __hash_table->num_entries;
                D.18510 = D.18509 + 4294967295;
                __hash_table->num_entries = D.18510;
                if (1 != 0) goto <D.18511>; else goto <D.18512>;
                <D.18511>:
                D.18513 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.18513);
                <D.18512>:
                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.18517>; else goto <D.18518>;
                <D.18517>:
                gc_debug_file.14 = gc_debug_file;
                copy.13 = copy;
                copy.13 = copy;
                D.18520 = sgen_safe_name (copy.13);
                num_ready_finalizers.11 = num_ready_finalizers;
                D.18521 = hash_table->num_entries;
                fprintf (gc_debug_file.14, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", copy.13, D.18520, object, num_ready_finalizers.11, D.18521);
                gc_debug_file.14 = gc_debug_file;
                fflush (gc_debug_file.14);
                <D.18518>:
                // predicted unlikely by continue predictor.
                goto <D.18172>;
                <D.18507>:
                if (hash_table == &minor_finalizable_hash) goto <D.18523>; else goto <D.18522>;
                <D.18523>:
                copy.13 = copy;
                D.18524 = sgen_ptr_in_nursery (copy.13);
                if (D.18524 == 0) goto <D.18525>; else goto <D.18522>;
                <D.18525>:
                D.18508 = *__next;
                *__iter = D.18508;
                __next = __iter;
                D.18509 = __hash_table->num_entries;
                D.18510 = D.18509 + 4294967295;
                __hash_table->num_entries = D.18510;
                if (1 != 0) goto <D.18526>; else goto <D.18527>;
                <D.18526>:
                D.18513 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.18513);
                <D.18527>:
                copy.13 = copy;
                D.18528 = tagged_object_apply (copy.13, tag);
                sgen_hash_table_replace (&major_finalizable_hash, D.18528, 0B, 0B);
                if (0 != 0) goto <D.18529>; else goto <D.18530>;
                <D.18529>:
                gc_debug_file.14 = gc_debug_file;
                copy.13 = copy;
                copy.13 = copy;
                D.18531 = sgen_safe_name (copy.13);
                fprintf (gc_debug_file.14, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy.13, D.18531, object);
                gc_debug_file.14 = gc_debug_file;
                fflush (gc_debug_file.14);
                <D.18530>:
                // predicted unlikely by continue predictor.
                goto <D.18172>;
                <D.18522>:
                if (0 != 0) goto <D.18532>; else goto <D.18533>;
                <D.18532>:
                gc_debug_file.14 = gc_debug_file;
                copy.13 = copy;
                copy.13 = copy;
                D.18534 = sgen_safe_name (copy.13);
                fprintf (gc_debug_file.14, "Updating object for finalization: %p (%s) (was at %p)\n", copy.13, D.18534, object);
                gc_debug_file.14 = gc_debug_file;
                fflush (gc_debug_file.14);
                <D.18533>:
                copy.13 = copy;
                D.18535 = tagged_object_apply (copy.13, tag);
                __entry->key = D.18535;
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.18505>:
        }
      }
      <D.18172>:
      __iter = __next;
      <D.18174>:
      D.18536 = *__iter;
      if (D.18536 != 0B) goto <D.18173>; else goto <D.18175>;
      <D.18175>:
    }
    __i = __i + 1;
    <D.18177>:
    D.18537 = hash_table->size;
    if (D.18537 > __i) goto <D.18176>; else goto <D.18178>;
    <D.18178>:
  }
}


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

  D.18541 = sgen_ptr_in_nursery (obj);
  if (D.18541 != 0) goto <D.18542>; else goto <D.18543>;
  <D.18542>:
  register_for_finalization (obj, user_data, 0);
  goto <D.18544>;
  <D.18543>:
  register_for_finalization (obj, user_data, 1);
  <D.18544>:
}


register_for_finalization (struct MonoObject * obj, void * user_data, int generation)
{
  int no_finalize.15;
  int iftmp.16;
  _Bool D.18553;
  long int D.18554;
  long int D.18555;
  int D.18560;
  struct FILE * gc_debug_file.17;
  struct MonoVTable * D.18566;
  struct MonoClass * D.18567;
  const char * D.18568;
  unsigned int D.18569;
  const char * D.18570;
  int D.18572;
  struct SgenHashTable * hash_table;

  hash_table = get_finalize_entry_hash_table (generation);
  no_finalize.15 = no_finalize;
  if (no_finalize.15 != 0) goto <D.18546>; else goto <D.18547>;
  <D.18546>:
  return;
  <D.18547>:
  if (user_data != 0B) goto <D.18551>; else goto <D.18549>;
  <D.18551>:
  if (user_data != mono_gc_run_finalize) goto <D.18552>; else goto <D.18549>;
  <D.18552>:
  iftmp.16 = 1;
  goto <D.18550>;
  <D.18549>:
  iftmp.16 = 0;
  <D.18550>:
  D.18553 = iftmp.16 != 0;
  D.18554 = (long int) D.18553;
  D.18555 = __builtin_expect (D.18554, 0);
  if (D.18555 != 0) goto <D.18556>; else goto <D.18557>;
  <D.18556>:
  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.18557>:
  if (user_data != 0B) goto <D.18558>; else goto <D.18559>;
  <D.18558>:
  D.18560 = sgen_hash_table_replace (hash_table, obj, 0B, 0B);
  if (D.18560 != 0) goto <D.18561>; else goto <D.18562>;
  <D.18561>:
  if (0 != 0) goto <D.18563>; else goto <D.18564>;
  <D.18563>:
  gc_debug_file.17 = gc_debug_file;
  D.18566 = obj->vtable;
  D.18567 = D.18566->klass;
  D.18568 = D.18567->name;
  D.18569 = hash_table->num_entries;
  D.18570 = sgen_generation_name (generation);
  fprintf (gc_debug_file.17, "Added finalizer for object: %p (%s) (%d) to %s table\n", obj, D.18568, D.18569, D.18570);
  gc_debug_file.17 = gc_debug_file;
  fflush (gc_debug_file.17);
  <D.18564>:
  <D.18562>:
  goto <D.18571>;
  <D.18559>:
  D.18572 = sgen_hash_table_remove (hash_table, obj, 0B);
  if (D.18572 != 0) goto <D.18573>; else goto <D.18574>;
  <D.18573>:
  if (0 != 0) goto <D.18575>; else goto <D.18576>;
  <D.18575>:
  gc_debug_file.17 = gc_debug_file;
  D.18566 = obj->vtable;
  D.18567 = D.18566->klass;
  D.18568 = D.18567->name;
  D.18569 = hash_table->num_entries;
  fprintf (gc_debug_file.17, "Removed finalizer for object: %p (%s) (%d)\n", obj, D.18568, D.18569);
  gc_debug_file.17 = gc_debug_file;
  fflush (gc_debug_file.17);
  <D.18576>:
  <D.18574>:
  <D.18571>:
}


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 (*<T2fcf>) (struct MonoObject *, void *, int) process_func)
{
  int D.18578;
  long unsigned int D.18581;
  long unsigned int D.18582;
  struct StageEntry * D.18583;
  volatile gint32 * D.18584;
  int D.18585;
  struct MonoObject * D.18589;
  void * D.18590;
  int i;
  void retry = <<< error >>>;

  D.18578 = *next_entry;
  if (D.18578 != -1) goto <D.18579>; else goto <D.18580>;
  <D.18579>:
  return;
  <D.18580>:
  i = 0;
  goto <D.18221>;
  <D.18220>:
  {
    gint32 state;

    retry:
    D.18581 = (long unsigned int) i;
    D.18582 = D.18581 * 24;
    D.18583 = entries + D.18582;
    state = D.18583->state;
    switch (state) <default: <D.18218>, case 0: <D.18212>, case 1: <D.18215>, case 2: <D.18216>, case 3: <D.18213>>
    <D.18212>:
    <D.18213>:
    // predicted unlikely by continue predictor.
    goto <D.18214>;
    <D.18215>:
    D.18581 = (long unsigned int) i;
    D.18582 = D.18581 * 24;
    D.18583 = entries + D.18582;
    D.18584 = &D.18583->state;
    D.18585 = InterlockedCompareExchange (D.18584, 3, 1);
    if (D.18585 != 1) goto retry; else goto <D.18586>;
    <D.18586>:
    // predicted unlikely by continue predictor.
    goto <D.18214>;
    <D.18216>:
    goto <D.18217>;
    <D.18218>:
    if (1 != 0) goto <D.18587>; else goto <D.18588>;
    <D.18587>:
    monoeg_g_log (0B, 4, "Invalid stage entry state");
    <D.18219>:
    goto <D.18219>;
    <D.18588>:
    goto <D.18217>;
    <D.18217>:
    D.18581 = (long unsigned int) i;
    D.18582 = D.18581 * 24;
    D.18583 = entries + D.18582;
    D.18589 = D.18583->obj;
    D.18581 = (long unsigned int) i;
    D.18582 = D.18581 * 24;
    D.18583 = entries + D.18582;
    D.18590 = D.18583->user_data;
    process_func (D.18589, D.18590, i);
    D.18581 = (long unsigned int) i;
    D.18582 = D.18581 * 24;
    D.18583 = entries + D.18582;
    D.18583->obj = 0B;
    D.18581 = (long unsigned int) i;
    D.18582 = D.18581 * 24;
    D.18583 = entries + D.18582;
    D.18583->user_data = 0B;
    mono_memory_write_barrier ();
    D.18581 = (long unsigned int) i;
    D.18582 = D.18581 * 24;
    D.18583 = entries + D.18582;
    D.18583->state = 0;
  }
  <D.18214>:
  i = i + 1;
  <D.18221>:
  if (i < num_entries) goto <D.18220>; else goto <D.18222>;
  <D.18222>:
  mono_memory_write_barrier ();
  *next_entry = 0;
}


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

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


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.18599;
  int D.18602;

  goto <D.18257>;
  <D.18256>:
  D.18599 = try_lock_stage_for_processing (1024, &next_fin_stage_entry);
  if (D.18599 != 0) goto <D.18600>; else goto <D.18601>;
  <D.18600>:
  pthread_mutex_lock (&gc_mutex);
  process_stage_entries (1024, &next_fin_stage_entry, &fin_stage_entries, process_fin_stage_entry);
  sgen_gc_unlock ();
  <D.18601>:
  <D.18257>:
  D.18602 = add_stage_entry (1024, &next_fin_stage_entry, &fin_stage_entries, obj, user_data);
  if (D.18602 == -1) goto <D.18256>; else goto <D.18258>;
  <D.18258>:
}


try_lock_stage_for_processing (int num_entries, volatile gint32 * next_entry)
{
  gboolean D.18605;
  int D.18606;
  _Bool D.18607;
  gint32 old;

  old = *next_entry;
  if (old < num_entries) goto <D.18603>; else goto <D.18604>;
  <D.18603>:
  D.18605 = 0;
  return D.18605;
  <D.18604>:
  D.18606 = InterlockedCompareExchange (next_entry, -1, old);
  D.18607 = D.18606 == old;
  D.18605 = (gboolean) D.18607;
  return D.18605;
}


add_stage_entry (int num_entries, volatile gint32 * next_entry, struct StageEntry * entries, struct MonoObject * obj, void * user_data)
{
  int D.18611;
  long unsigned int D.18616;
  long unsigned int D.18617;
  struct StageEntry * D.18618;
  int D.18619;
  volatile gint32 * D.18621;
  int D.18622;
  int D.18623;
  int D.18626;
  int iftmp.20;
  _Bool D.18634;
  long int D.18635;
  long int D.18636;
  volatile gint32 * D.18639;
  int iftmp.21;
  _Bool D.18647;
  long int D.18648;
  long int D.18649;
  _Bool D.18652;
  long int D.18653;
  long int D.18654;
  gint32 index;
  gint32 new_next_entry;
  gint32 old_next_entry;
  gint32 previous_state;
  void retry = <<< error >>>;

  retry:
  <D.18240>:
  index = *next_entry;
  if (index >= num_entries) goto <D.18609>; else goto <D.18610>;
  <D.18609>:
  D.18611 = -1;
  return D.18611;
  <D.18610>:
  if (index < 0) goto <D.18612>; else goto <D.18613>;
  <D.18612>:
  goto <D.18236>;
  <D.18235>:
  monoeg_g_usleep (200);
  <D.18236>:
  index = *next_entry;
  if (index < 0) goto <D.18235>; else goto <D.18237>;
  <D.18237>:
  // predicted unlikely by continue predictor.
  goto <D.18238>;
  <D.18613>:
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18619 = D.18618->state;
  if (D.18619 != 0) goto <D.18614>; else goto <D.18620>;
  <D.18620>:
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18621 = &D.18618->state;
  D.18622 = InterlockedCompareExchange (D.18621, 1, 0);
  if (D.18622 != 0) goto <D.18614>; else goto <D.18615>;
  <D.18614>:
  D.18623 = *next_entry;
  if (D.18623 == index) goto <D.18624>; else goto <D.18625>;
  <D.18624>:
  D.18626 = index + 1;
  InterlockedCompareExchange (next_entry, D.18626, index);
  <D.18625>:
  // predicted unlikely by continue predictor.
  goto <D.18238>;
  <D.18615>:
  mono_memory_write_barrier ();
  D.18626 = index + 1;
  old_next_entry = InterlockedCompareExchange (next_entry, D.18626, index);
  if (old_next_entry < index) goto <D.18627>; else goto <D.18628>;
  <D.18627>:
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18618->state = 0;
  // predicted unlikely by continue predictor.
  goto <D.18238>;
  <D.18628>:
  goto <D.18239>;
  <D.18238>:
  goto <D.18240>;
  <D.18239>:
  if (index < 0) goto <D.18630>; else goto <D.18633>;
  <D.18633>:
  if (index >= num_entries) goto <D.18630>; else goto <D.18631>;
  <D.18630>:
  iftmp.20 = 1;
  goto <D.18632>;
  <D.18631>:
  iftmp.20 = 0;
  <D.18632>:
  D.18634 = iftmp.20 != 0;
  D.18635 = (long int) D.18634;
  D.18636 = __builtin_expect (D.18635, 0);
  if (D.18636 != 0) goto <D.18637>; else goto <D.18638>;
  <D.18637>:
  monoeg_g_log (0B, 4, "Invalid index");
  <D.18241>:
  goto <D.18241>;
  <D.18638>:
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18618->obj = obj;
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18618->user_data = user_data;
  mono_memory_write_barrier ();
  new_next_entry = *next_entry;
  mono_memory_read_barrier ();
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18639 = &D.18618->state;
  previous_state = InterlockedCompareExchange (D.18639, 2, 1);
  if (previous_state == 1) goto <D.18640>; else goto <D.18641>;
  <D.18640>:
  if (new_next_entry < index) goto <D.18645>; else goto <D.18643>;
  <D.18645>:
  if (new_next_entry >= 0) goto <D.18646>; else goto <D.18643>;
  <D.18646>:
  iftmp.21 = 1;
  goto <D.18644>;
  <D.18643>:
  iftmp.21 = 0;
  <D.18644>:
  D.18647 = iftmp.21 != 0;
  D.18648 = (long int) D.18647;
  D.18649 = __builtin_expect (D.18648, 0);
  if (D.18649 != 0) goto <D.18650>; else goto <D.18651>;
  <D.18650>:
  monoeg_g_log (0B, 4, "Invalid next entry index - as long as we\'re busy, other thread can only increment or invalidate it");
  <D.18242>:
  goto <D.18242>;
  <D.18651>:
  D.18611 = index;
  return D.18611;
  <D.18641>:
  D.18652 = previous_state != 3;
  D.18653 = (long int) D.18652;
  D.18654 = __builtin_expect (D.18653, 0);
  if (D.18654 != 0) goto <D.18655>; else goto <D.18656>;
  <D.18655>:
  monoeg_g_log (0B, 4, "Invalid state transition - other thread can only make busy state invalid");
  <D.18243>:
  goto <D.18243>;
  <D.18656>:
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18618->obj = 0B;
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18618->user_data = 0B;
  mono_memory_write_barrier ();
  D.18616 = (long unsigned int) index;
  D.18617 = D.18616 * 24;
  D.18618 = entries + D.18617;
  D.18618->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)
{
  long unsigned int D.18660;
  long unsigned int D.18661;
  struct MonoObject * * D.18662;
  int D.18663;
  int D.18664;
  int D.18665;
  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.18658>; else goto <D.18659>;
  <D.18658>:
  D.18660 = (long unsigned int) result;
  D.18661 = D.18660 * 8;
  D.18662 = out_array + D.18661;
  D.18663 = out_size - result;
  D.18664 = finalizers_for_domain (domain, D.18662, D.18663, &major_finalizable_hash);
  result = D.18664 + result;
  <D.18659>:
  sgen_gc_unlock ();
  D.18665 = result;
  return D.18665;
}


finalizers_for_domain (struct MonoDomain * domain, struct MonoObject * * out_array, int out_size, struct SgenHashTable * hash_table)
{
  int no_finalize.22;
  int D.18672;
  long unsigned int D.18673;
  long unsigned int D.18674;
  struct MonoVTable * D.18675;
  struct MonoDomain * D.18676;
  struct SgenHashTableEntry * D.18679;
  unsigned int D.18680;
  unsigned int D.18681;
  int D.18684;
  int count.23;
  long unsigned int D.18686;
  long unsigned int D.18687;
  struct MonoObject * * D.18688;
  struct FILE * gc_debug_file.24;
  const char * D.18692;
  int num_ready_finalizers.25;
  unsigned int D.18694;
  struct SgenHashTableEntry * D.18697;
  unsigned int D.18698;
  struct MonoObject * object;
  void * dummy;
  int count;

  no_finalize.22 = no_finalize;
  if (no_finalize.22 != 0) goto <D.18667>; else goto <D.18670>;
  <D.18670>:
  if (out_size == 0) goto <D.18667>; else goto <D.18671>;
  <D.18671>:
  if (out_array == 0B) goto <D.18667>; else goto <D.18668>;
  <D.18667>:
  D.18672 = 0;
  return D.18672;
  <D.18668>:
  count = 0;
  {
    struct SgenHashTable * __hash_table;
    struct SgenHashTableEntry * * __table;
    guint __i;

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

      D.18673 = (long unsigned int) __i;
      D.18674 = D.18673 * 8;
      __iter = __table + D.18674;
      goto <D.18276>;
      <D.18275>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.18675 = object->vtable;
        D.18676 = D.18675->domain;
        if (D.18676 == domain) goto <D.18677>; else goto <D.18678>;
        <D.18677>:
        D.18679 = *__next;
        *__iter = D.18679;
        __next = __iter;
        D.18680 = __hash_table->num_entries;
        D.18681 = D.18680 + 4294967295;
        __hash_table->num_entries = D.18681;
        if (1 != 0) goto <D.18682>; else goto <D.18683>;
        <D.18682>:
        D.18684 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.18684);
        <D.18683>:
        count.23 = count;
        count = count.23 + 1;
        D.18686 = (long unsigned int) count.23;
        D.18687 = D.18686 * 8;
        D.18688 = out_array + D.18687;
        *D.18688 = object;
        if (0 != 0) goto <D.18689>; else goto <D.18690>;
        <D.18689>:
        gc_debug_file.24 = gc_debug_file;
        D.18692 = sgen_safe_name (object);
        num_ready_finalizers.25 = num_ready_finalizers;
        D.18694 = hash_table->num_entries;
        fprintf (gc_debug_file.24, "Collecting object for finalization: %p (%s) (%d/%d)\n", object, D.18692, num_ready_finalizers.25, D.18694);
        gc_debug_file.24 = gc_debug_file;
        fflush (gc_debug_file.24);
        <D.18690>:
        if (count == out_size) goto <D.18695>; else goto <D.18696>;
        <D.18695>:
        D.18672 = count;
        return D.18672;
        <D.18696>:
        // predicted unlikely by continue predictor.
        goto <D.18274>;
        <D.18678>:
      }
      <D.18274>:
      __iter = __next;
      <D.18276>:
      D.18697 = *__iter;
      if (D.18697 != 0B) goto <D.18275>; else goto <D.18277>;
      <D.18277>:
    }
    __i = __i + 1;
    <D.18279>:
    D.18698 = hash_table->size;
    if (D.18698 > __i) goto <D.18278>; else goto <D.18280>;
    <D.18280>:
  }
  D.18672 = count;
  return D.18672;
}


sgen_null_link_in_range (int generation, gboolean before_finalization, struct ScanCopyContext ctx)
{
  long unsigned int D.18700;
  long unsigned int D.18701;
  void * D.18702;
  struct FILE * gc_debug_file.26;
  long unsigned int D.18708;
  long unsigned int D.18709;
  _Bool D.18710;
  long unsigned int D.18713;
  long unsigned int D.18714;
  gboolean (*<T2d21>) (char *) D.18719;
  int D.18720;
  int D.18723;
  struct SgenHashTableEntry * D.18728;
  unsigned int D.18729;
  unsigned int D.18730;
  int D.18733;
  char * copy.27;
  int D.18737;
  _Bool D.18741;
  long int D.18742;
  long int D.18743;
  long unsigned int iftmp.28;
  long unsigned int copy.29;
  long unsigned int D.18751;
  long unsigned int D.18752;
  void * D.18753;
  long unsigned int iftmp.30;
  long unsigned int D.18760;
  long unsigned int D.18761;
  void * D.18762;
  void * D.18765;
  struct SgenHashTableEntry * D.18766;
  unsigned int D.18767;
  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.18325>;
    <D.18324>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18700 = (long unsigned int) __i;
      D.18701 = D.18700 * 8;
      __iter = __table + D.18701;
      goto <D.18322>;
      <D.18321>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18702 = *link;
          if (D.18702 == 0B) goto <D.18703>; else goto <D.18704>;
          <D.18703>:
          if (0 != 0) goto <D.18705>; else goto <D.18706>;
          <D.18705>:
          gc_debug_file.26 = gc_debug_file;
          fprintf (gc_debug_file.26, "Dislink %p was externally nullified\n", link);
          gc_debug_file.26 = gc_debug_file;
          fflush (gc_debug_file.26);
          <D.18706>:
          // predicted unlikely by continue predictor.
          goto <D.18319>;
          <D.18704>:
          D.18702 = *link;
          D.18708 = (long unsigned int) D.18702;
          D.18709 = D.18708 & 1;
          D.18710 = D.18709 == 0;
          track = (gboolean) D.18710;
          if (track != before_finalization) goto <D.18711>; else goto <D.18712>;
          <D.18711>:
          D.18702 = *link;
          D.18708 = (long unsigned int) D.18702;
          D.18713 = ~D.18708;
          D.18714 = D.18713 & 18446744073709551612;
          object = (char *) D.18714;
          if (object == 0B) goto <D.18715>; else goto <D.18716>;
          <D.18715>:
          if (0 != 0) goto <D.18717>; else goto <D.18718>;
          <D.18717>:
          gc_debug_file.26 = gc_debug_file;
          fprintf (gc_debug_file.26, "Dislink %p with a hidden null object\n", link);
          gc_debug_file.26 = gc_debug_file;
          fflush (gc_debug_file.26);
          <D.18718>:
          // predicted unlikely by continue predictor.
          goto <D.18319>;
          <D.18716>:
          D.18719 = major_collector.is_object_live;
          D.18720 = D.18719 (object);
          if (D.18720 == 0) goto <D.18721>; else goto <D.18722>;
          <D.18721>:
          D.18723 = sgen_gc_is_object_ready_for_finalization (object);
          if (D.18723 != 0) goto <D.18724>; else goto <D.18725>;
          <D.18724>:
          *link = 0B;
          if (0 != 0) goto <D.18726>; else goto <D.18727>;
          <D.18726>:
          gc_debug_file.26 = gc_debug_file;
          fprintf (gc_debug_file.26, "Dislink nullified at %p to GCed object %p\n", link, object);
          gc_debug_file.26 = gc_debug_file;
          fflush (gc_debug_file.26);
          <D.18727>:
          D.18728 = *__next;
          *__iter = D.18728;
          __next = __iter;
          D.18729 = __hash_table->num_entries;
          D.18730 = D.18729 + 4294967295;
          __hash_table->num_entries = D.18730;
          if (1 != 0) goto <D.18731>; else goto <D.18732>;
          <D.18731>:
          D.18733 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.18733);
          <D.18732>:
          // predicted unlikely by continue predictor.
          goto <D.18319>;
          <D.18725>:
          {
            char * copy;

            try
              {
                copy = object;
                copy_func (&copy, queue);
                if (hash == &minor_disappearing_link_hash) goto <D.18735>; else goto <D.18734>;
                <D.18735>:
                copy.27 = copy;
                D.18737 = sgen_ptr_in_nursery (copy.27);
                if (D.18737 == 0) goto <D.18738>; else goto <D.18734>;
                <D.18738>:
                D.18728 = *__next;
                *__iter = D.18728;
                __next = __iter;
                D.18729 = __hash_table->num_entries;
                D.18730 = D.18729 + 4294967295;
                __hash_table->num_entries = D.18730;
                if (1 != 0) goto <D.18739>; else goto <D.18740>;
                <D.18739>:
                D.18733 = __hash_table->entry_mem_type;
                sgen_free_internal (__entry, D.18733);
                <D.18740>:
                copy.27 = copy;
                D.18741 = copy.27 == 0B;
                D.18742 = (long int) D.18741;
                D.18743 = __builtin_expect (D.18742, 0);
                if (D.18743 != 0) goto <D.18744>; else goto <D.18745>;
                <D.18744>:
                monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-fin-weak-hash.c", 700, "copy");
                <D.18745>:
                if (track != 0) goto <D.18747>; else goto <D.18748>;
                <D.18747>:
                iftmp.28 = 1;
                goto <D.18749>;
                <D.18748>:
                iftmp.28 = 0;
                <D.18749>:
                copy.27 = copy;
                copy.29 = (long unsigned int) copy.27;
                D.18751 = iftmp.28 | copy.29;
                D.18752 = ~D.18751;
                D.18753 = (void *) D.18752;
                *link = D.18753;
                copy.27 = copy;
                add_or_remove_disappearing_link (copy.27, link, 1);
                if (0 != 0) goto <D.18754>; else goto <D.18755>;
                <D.18754>:
                gc_debug_file.26 = gc_debug_file;
                copy.27 = copy;
                fprintf (gc_debug_file.26, "Upgraded dislink at %p to major because object %p moved to %p\n", link, object, copy.27);
                gc_debug_file.26 = gc_debug_file;
                fflush (gc_debug_file.26);
                <D.18755>:
                // predicted unlikely by continue predictor.
                goto <D.18319>;
                <D.18734>:
                if (track != 0) goto <D.18757>; else goto <D.18758>;
                <D.18757>:
                iftmp.30 = 1;
                goto <D.18759>;
                <D.18758>:
                iftmp.30 = 0;
                <D.18759>:
                copy.27 = copy;
                copy.29 = (long unsigned int) copy.27;
                D.18760 = iftmp.30 | copy.29;
                D.18761 = ~D.18760;
                D.18762 = (void *) D.18761;
                *link = D.18762;
                if (0 != 0) goto <D.18763>; else goto <D.18764>;
                <D.18763>:
                gc_debug_file.26 = gc_debug_file;
                D.18702 = *link;
                D.18708 = (long unsigned int) D.18702;
                D.18713 = ~D.18708;
                D.18714 = D.18713 & 18446744073709551612;
                D.18765 = (void *) D.18714;
                fprintf (gc_debug_file.26, "Updated dislink at %p to %p\n", link, D.18765);
                gc_debug_file.26 = gc_debug_file;
                fflush (gc_debug_file.26);
                <D.18764>:
              }
            finally
              {
                copy = {CLOBBER};
              }
          }
          <D.18722>:
          <D.18712>:
        }
      }
      <D.18319>:
      __iter = __next;
      <D.18322>:
      D.18766 = *__iter;
      if (D.18766 != 0B) goto <D.18321>; else goto <D.18323>;
      <D.18323>:
    }
    __i = __i + 1;
    <D.18325>:
    D.18767 = hash->size;
    if (D.18767 > __i) goto <D.18324>; else goto <D.18326>;
    <D.18326>:
  }
}


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

  switch (generation) <default: <D.18294>, case 0: <D.18292>, case 1: <D.18293>>
  <D.18292>:
  D.18770 = &minor_disappearing_link_hash;
  return D.18770;
  <D.18293>:
  D.18770 = &major_disappearing_link_hash;
  return D.18770;
  <D.18294>:
  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.18774;
  struct FILE * gc_debug_file.31;
  unsigned int D.18780;
  const char * D.18781;
  struct MonoVTable * D.18784;
  struct MonoClass * D.18785;
  const char * D.18786;
  const char * D.18787;
  struct SgenHashTable * hash_table;

  hash_table = get_dislink_hash_table (generation);
  if (obj == 0B) goto <D.18772>; else goto <D.18773>;
  <D.18772>:
  D.18774 = sgen_hash_table_remove (hash_table, link, 0B);
  if (D.18774 != 0) goto <D.18775>; else goto <D.18776>;
  <D.18775>:
  if (0 != 0) goto <D.18777>; else goto <D.18778>;
  <D.18777>:
  gc_debug_file.31 = gc_debug_file;
  D.18780 = hash_table->num_entries;
  D.18781 = sgen_generation_name (generation);
  fprintf (gc_debug_file.31, "Removed dislink %p (%d) from %s table\n", link, D.18780, D.18781);
  gc_debug_file.31 = gc_debug_file;
  fflush (gc_debug_file.31);
  <D.18778>:
  <D.18776>:
  return;
  <D.18773>:
  sgen_hash_table_replace (hash_table, link, 0B, 0B);
  if (0 != 0) goto <D.18782>; else goto <D.18783>;
  <D.18782>:
  gc_debug_file.31 = gc_debug_file;
  D.18784 = obj->vtable;
  D.18785 = D.18784->klass;
  D.18786 = D.18785->name;
  D.18787 = sgen_generation_name (generation);
  fprintf (gc_debug_file.31, "Added dislink for object: %p (%s) at %p to %s table\n", obj, D.18786, link, D.18787);
  gc_debug_file.31 = gc_debug_file;
  fflush (gc_debug_file.31);
  <D.18783>:
}


sgen_null_links_for_domain (struct MonoDomain * domain, int generation)
{
  long unsigned int D.18789;
  long unsigned int D.18790;
  void * D.18791;
  long unsigned int D.18792;
  long unsigned int D.18793;
  long unsigned int D.18794;
  struct MonoVTable * D.18799;
  struct FILE * gc_debug_file.32;
  struct SgenHashTableEntry * D.18807;
  unsigned int D.18808;
  unsigned int D.18809;
  int D.18812;
  struct SgenHashTableEntry * D.18813;
  unsigned int D.18814;
  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.18347>;
    <D.18346>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18789 = (long unsigned int) __i;
      D.18790 = D.18789 * 8;
      __iter = __table + D.18790;
      goto <D.18344>;
      <D.18343>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18791 = *link;
          D.18792 = (long unsigned int) D.18791;
          D.18793 = ~D.18792;
          D.18794 = D.18793 & 18446744073709551612;
          object = (char *) D.18794;
          D.18791 = *link;
          if (D.18791 != 0B) goto <D.18795>; else goto <D.18796>;
          <D.18795>:
          if (object != 0B) goto <D.18797>; else goto <D.18798>;
          <D.18797>:
          D.18799 = MEM[(struct MonoObject *)object].vtable;
          if (D.18799 == 0B) goto <D.18800>; else goto <D.18801>;
          <D.18800>:
          {
            gboolean free;

            free = 1;
            D.18791 = *link;
            if (D.18791 != 0B) goto <D.18802>; else goto <D.18803>;
            <D.18802>:
            *link = 0B;
            free = 0;
            if (0 != 0) goto <D.18804>; else goto <D.18805>;
            <D.18804>:
            gc_debug_file.32 = gc_debug_file;
            fprintf (gc_debug_file.32, "Disappearing link %p not freed\n", link);
            gc_debug_file.32 = gc_debug_file;
            fflush (gc_debug_file.32);
            <D.18805>:
            <D.18803>:
            D.18807 = *__next;
            *__iter = D.18807;
            __next = __iter;
            D.18808 = __hash_table->num_entries;
            D.18809 = D.18808 + 4294967295;
            __hash_table->num_entries = D.18809;
            if (free != 0) goto <D.18810>; else goto <D.18811>;
            <D.18810>:
            D.18812 = __hash_table->entry_mem_type;
            sgen_free_internal (__entry, D.18812);
            <D.18811>:
            // predicted unlikely by continue predictor.
            goto <D.18342>;
          }
          <D.18801>:
          <D.18798>:
          <D.18796>:
        }
      }
      <D.18342>:
      __iter = __next;
      <D.18344>:
      D.18813 = *__iter;
      if (D.18813 != 0B) goto <D.18343>; else goto <D.18345>;
      <D.18345>:
    }
    __i = __i + 1;
    <D.18347>:
    D.18814 = hash->size;
    if (D.18814 > __i) goto <D.18346>; else goto <D.18348>;
    <D.18348>:
  }
}


sgen_null_links_with_predicate (int generation, mono_bool (*WeakLinkAlivePredicateFunc) (struct MonoObject *, void *) predicate, void * data)
{
  long unsigned int D.18815;
  long unsigned int D.18816;
  void * D.18817;
  long unsigned int D.18818;
  long unsigned int D.18819;
  long unsigned int D.18820;
  struct FILE * gc_debug_file.33;
  struct SgenHashTableEntry * D.18828;
  unsigned int D.18829;
  unsigned int D.18830;
  int D.18833;
  struct SgenHashTableEntry * D.18834;
  unsigned int D.18835;
  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.18370>;
    <D.18369>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18815 = (long unsigned int) __i;
      D.18816 = D.18815 * 8;
      __iter = __table + D.18816;
      goto <D.18367>;
      <D.18366>:
      {
        struct SgenHashTableEntry * __entry;

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

          D.18817 = *link;
          D.18818 = (long unsigned int) D.18817;
          D.18819 = ~D.18818;
          D.18820 = D.18819 & 18446744073709551612;
          object = (char *) D.18820;
          D.18817 = *link;
          if (D.18817 == 0B) goto <D.18821>; else goto <D.18822>;
          <D.18821>:
          // predicted unlikely by continue predictor.
          goto <D.18365>;
          <D.18822>:
          is_alive = predicate (object, data);
          if (is_alive == 0) goto <D.18823>; else goto <D.18824>;
          <D.18823>:
          *link = 0B;
          if (0 != 0) goto <D.18825>; else goto <D.18826>;
          <D.18825>:
          gc_debug_file.33 = gc_debug_file;
          fprintf (gc_debug_file.33, "Dislink nullified by predicate at %p to GCed object %p\n", link, object);
          gc_debug_file.33 = gc_debug_file;
          fflush (gc_debug_file.33);
          <D.18826>:
          D.18828 = *__next;
          *__iter = D.18828;
          __next = __iter;
          D.18829 = __hash_table->num_entries;
          D.18830 = D.18829 + 4294967295;
          __hash_table->num_entries = D.18830;
          if (1 != 0) goto <D.18831>; else goto <D.18832>;
          <D.18831>:
          D.18833 = __hash_table->entry_mem_type;
          sgen_free_internal (__entry, D.18833);
          <D.18832>:
          // predicted unlikely by continue predictor.
          goto <D.18365>;
          <D.18824>:
        }
      }
      <D.18365>:
      __iter = __next;
      <D.18367>:
      D.18834 = *__iter;
      if (D.18834 != 0B) goto <D.18366>; else goto <D.18368>;
      <D.18368>:
    }
    __i = __i + 1;
    <D.18370>:
    D.18835 = hash->size;
    if (D.18835 > __i) goto <D.18369>; else goto <D.18371>;
    <D.18371>:
  }
}


sgen_remove_finalizers_for_domain (struct MonoDomain * domain, int generation)
{
  long unsigned int D.18836;
  long unsigned int D.18837;
  struct MonoVTable * D.18838;
  struct MonoDomain * D.18839;
  struct FILE * gc_debug_file.34;
  const char * D.18845;
  struct SgenHashTableEntry * D.18846;
  unsigned int D.18847;
  unsigned int D.18848;
  int D.18851;
  struct SgenHashTableEntry * D.18852;
  unsigned int D.18853;
  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.18390>;
    <D.18389>:
    {
      struct SgenHashTableEntry * * __iter;
      struct SgenHashTableEntry * * __next;

      D.18836 = (long unsigned int) __i;
      D.18837 = D.18836 * 8;
      __iter = __table + D.18837;
      goto <D.18387>;
      <D.18386>:
      {
        struct SgenHashTableEntry * __entry;

        __entry = *__iter;
        __next = &__entry->next;
        object = __entry->key;
        dummy = &__entry->data;
        object = tagged_object_get_object (object);
        D.18838 = object->vtable;
        D.18839 = D.18838->domain;
        if (D.18839 == domain) goto <D.18840>; else goto <D.18841>;
        <D.18840>:
        if (0 != 0) goto <D.18842>; else goto <D.18843>;
        <D.18842>:
        gc_debug_file.34 = gc_debug_file;
        D.18845 = sgen_safe_name (object);
        fprintf (gc_debug_file.34, "Unregistering finalizer for object: %p (%s)\n", object, D.18845);
        gc_debug_file.34 = gc_debug_file;
        fflush (gc_debug_file.34);
        <D.18843>:
        D.18846 = *__next;
        *__iter = D.18846;
        __next = __iter;
        D.18847 = __hash_table->num_entries;
        D.18848 = D.18847 + 4294967295;
        __hash_table->num_entries = D.18848;
        if (1 != 0) goto <D.18849>; else goto <D.18850>;
        <D.18849>:
        D.18851 = __hash_table->entry_mem_type;
        sgen_free_internal (__entry, D.18851);
        <D.18850>:
        // predicted unlikely by continue predictor.
        goto <D.18385>;
        <D.18841>:
      }
      <D.18385>:
      __iter = __next;
      <D.18387>:
      D.18852 = *__iter;
      if (D.18852 != 0B) goto <D.18386>; else goto <D.18388>;
      <D.18388>:
    }
    __i = __i + 1;
    <D.18390>:
    D.18853 = hash_table->size;
    if (D.18853 > __i) goto <D.18389>; else goto <D.18391>;
    <D.18391>:
  }
}


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

  link = _link;
  if (index >= 0) goto <D.18854>; else goto <D.18855>;
  <D.18854>:
  <D.18855>:
  add_or_remove_disappearing_link (0B, link, 0);
  add_or_remove_disappearing_link (0B, link, 1);
  if (obj != 0B) goto <D.18856>; else goto <D.18857>;
  <D.18856>:
  D.18858 = sgen_ptr_in_nursery (obj);
  if (D.18858 != 0) goto <D.18859>; else goto <D.18860>;
  <D.18859>:
  add_or_remove_disappearing_link (obj, link, 0);
  goto <D.18861>;
  <D.18860>:
  add_or_remove_disappearing_link (obj, link, 1);
  <D.18861>:
  <D.18857>:
}


sgen_register_disappearing_link (struct MonoObject * obj, void * * link, gboolean track, gboolean in_gc)
{
  long unsigned int iftmp.35;
  long unsigned int obj.36;
  long unsigned int D.18869;
  long unsigned int D.18870;
  void * D.18871;
  int D.18876;

  if (obj != 0B) goto <D.18862>; else goto <D.18863>;
  <D.18862>:
  if (track != 0) goto <D.18865>; else goto <D.18866>;
  <D.18865>:
  iftmp.35 = 1;
  goto <D.18867>;
  <D.18866>:
  iftmp.35 = 0;
  <D.18867>:
  obj.36 = (long unsigned int) obj;
  D.18869 = iftmp.35 | obj.36;
  D.18870 = ~D.18869;
  D.18871 = (void *) D.18870;
  *link = D.18871;
  goto <D.18872>;
  <D.18863>:
  *link = 0B;
  <D.18872>:
  if (in_gc != 0) goto <D.18873>; else goto <D.18874>;
  <D.18873>:
  process_dislink_stage_entry (obj, link, -1);
  goto <D.18875>;
  <D.18874>:
  {
    int index;

    goto <D.18411>;
    <D.18410>:
    D.18876 = try_lock_stage_for_processing (1024, &next_dislink_stage_entry);
    if (D.18876 != 0) goto <D.18877>; else goto <D.18878>;
    <D.18877>:
    pthread_mutex_lock (&gc_mutex);
    process_stage_entries (1024, &next_dislink_stage_entry, &dislink_stage_entries, process_dislink_stage_entry);
    sgen_gc_unlock ();
    <D.18878>:
    <D.18411>:
    index = add_stage_entry (1024, &next_dislink_stage_entry, &dislink_stage_entries, obj, link);
    if (index == -1) goto <D.18410>; else goto <D.18412>;
    <D.18412>:
  }
  <D.18875>:
}


sgen_init_fin_weak_hash ()
{

}


