__attribute__((visibility ("hidden")))
sgen_fragment_allocator_alloc ()
{
  struct SgenFragment * D.19659;
  struct SgenFragment * D.19660;
  struct SgenFragment * frag;

  frag = fragment_freelist;
  if (frag != 0B) goto <D.19657>; else goto <D.19658>;
  <D.19657>:
  D.19659 = frag->next_in_order;
  fragment_freelist = D.19659;
  frag->next_in_order = 0B;
  D.19659 = frag->next_in_order;
  frag->next = D.19659;
  D.19660 = frag;
  return D.19660;
  <D.19658>:
  frag = sgen_alloc_internal (1);
  frag->next_in_order = 0B;
  D.19659 = frag->next_in_order;
  frag->next = D.19659;
  D.19660 = frag;
  return D.19660;
}


__attribute__((visibility ("hidden")))
sgen_fragment_allocator_add (struct SgenFragmentAllocator * allocator, char * start, char * end)
{
  struct SgenFragment * D.19662;
  void * D.19663;
  struct SgenFragment * D.19664;
  struct SgenFragment * D.19665;
  char * D.19666;
  char * D.19667;
  _Bool D.19668;
  long int D.19669;
  long int D.19670;
  struct SgenFragment * fragment;

  fragment = sgen_fragment_allocator_alloc ();
  fragment->fragment_start = start;
  fragment->fragment_next = start;
  fragment->fragment_end = end;
  D.19662 = allocator->region_head;
  D.19663 = unmask (D.19662);
  fragment->next = D.19663;
  D.19664 = fragment->next;
  fragment->next_in_order = D.19664;
  allocator->alloc_head = fragment;
  D.19665 = allocator->alloc_head;
  allocator->region_head = D.19665;
  D.19666 = fragment->fragment_end;
  D.19667 = fragment->fragment_start;
  D.19668 = D.19666 <= D.19667;
  D.19669 = (long int) D.19668;
  D.19670 = __builtin_expect (D.19669, 0);
  if (D.19670 != 0) goto <D.19671>; else goto <D.19672>;
  <D.19671>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 293, "fragment->fragment_end > fragment->fragment_start");
  <D.19672>:
}


unmask (void * p)
{
  void * D.19673;
  long unsigned int p.0;
  long unsigned int D.19675;

  p.0 = (long unsigned int) p;
  D.19675 = p.0 & 18446744073709551612;
  D.19673 = (void *) D.19675;
  return D.19673;
}


__attribute__((visibility ("hidden")))
sgen_fragment_allocator_release (struct SgenFragmentAllocator * allocator)
{
  struct SgenFragment * D.19679;
  struct SgenFragment * fragment_freelist.1;
  struct SgenFragment * D.19681;
  struct SgenFragment * last;

  last = allocator->region_head;
  if (last == 0B) goto <D.19677>; else goto <D.19678>;
  <D.19677>:
  return;
  <D.19678>:
  goto <D.19475>;
  <D.19474>:
  last = last->next_in_order;
  <D.19475>:
  D.19679 = last->next_in_order;
  if (D.19679 != 0B) goto <D.19474>; else goto <D.19476>;
  <D.19476>:
  fragment_freelist.1 = fragment_freelist;
  last->next_in_order = fragment_freelist.1;
  D.19681 = allocator->region_head;
  fragment_freelist = D.19681;
  allocator->region_head = 0B;
  D.19681 = allocator->region_head;
  allocator->alloc_head = D.19681;
}


__attribute__((visibility ("hidden")))
sgen_fragment_allocator_par_alloc (struct SgenFragmentAllocator * allocator, size_t size)
{
  struct SgenFragment * D.19683;
  char * D.19684;
  long int D.19685;
  char * D.19686;
  long int D.19687;
  long int D.19688;
  long unsigned int D.19689;
  void * D.19693;
  struct SgenFragment * D.19694;
  void * D.19695;
  struct SgenFragment * frag;
  void restart = <<< error >>>;

  restart:
  D.19683 = allocator->alloc_head;
  frag = unmask (D.19683);
  goto <D.19517>;
  <D.19516>:
  D.19684 = frag->fragment_end;
  D.19685 = (long int) D.19684;
  D.19686 = frag->fragment_next;
  D.19687 = (long int) D.19686;
  D.19688 = D.19685 - D.19687;
  D.19689 = (long unsigned int) D.19688;
  if (D.19689 >= size) goto <D.19690>; else goto <D.19691>;
  <D.19690>:
  {
    void * p;

    p = par_alloc_from_fragment (allocator, frag, size);
    if (p == 0B) goto restart; else goto <D.19692>;
    <D.19692>:
    D.19693 = p;
    return D.19693;
  }
  <D.19691>:
  D.19694 = frag->next;
  frag = unmask (D.19694);
  <D.19517>:
  D.19695 = unmask (frag);
  if (D.19695 != 0B) goto <D.19516>; else goto <D.19518>;
  <D.19518>:
  D.19693 = 0B;
  return D.19693;
}


par_alloc_from_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag, size_t size)
{
  char * D.19697;
  void * D.19700;
  char * * D.19701;
  void * D.19702;
  long int D.19705;
  long int end.2;
  long int D.19707;
  <unnamed type> D.19710;
  int D.19713;
  long unsigned int D.19716;
  struct SgenFragment * * D.19719;
  void * D.19720;
  void * D.19721;
  void * D.19724;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19697 = frag->fragment_end;
  if (D.19697 < end) goto <D.19698>; else goto <D.19699>;
  <D.19698>:
  D.19700 = 0B;
  return D.19700;
  <D.19699>:
  mono_memory_barrier ();
  D.19701 = &frag->fragment_next;
  D.19702 = InterlockedCompareExchangePointer (D.19701, end, p);
  if (D.19702 != p) goto <D.19703>; else goto <D.19704>;
  <D.19703>:
  D.19700 = 0B;
  return D.19700;
  <D.19704>:
  D.19697 = frag->fragment_end;
  D.19705 = (long int) D.19697;
  end.2 = (long int) end;
  D.19707 = D.19705 - end.2;
  if (D.19707 <= 511) goto <D.19708>; else goto <D.19709>;
  <D.19708>:
  {
    struct SgenFragment * next;
    struct SgenFragment * * prev_ptr;

    D.19710 = sgen_get_nursery_clear_policy ();
    if (D.19710 == 1) goto <D.19711>; else goto <D.19712>;
    <D.19711>:
    D.19713 = claim_remaining_size (frag, end);
    if (D.19713 != 0) goto <D.19714>; else goto <D.19715>;
    <D.19714>:
    D.19697 = frag->fragment_end;
    sgen_clear_range (end, D.19697);
    <D.19715>:
    <D.19712>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    goto <D.19499>;
    <D.19501>:
    next = frag->next;
    D.19716 = get_mark (next);
    if (D.19716 == 0) goto <D.19717>; else goto <D.19718>;
    <D.19717>:
    mono_memory_write_barrier ();
    D.19719 = &frag->next;
    D.19720 = mask (next, 1);
    D.19721 = InterlockedCompareExchangePointer (D.19719, D.19720, next);
    if (D.19721 != next) goto <D.19722>; else goto <D.19723>;
    <D.19722>:
    // predicted unlikely by continue predictor.
    goto <D.19499>;
    <D.19723>:
    <D.19718>:
    mono_memory_write_barrier ();
    D.19724 = InterlockedCompareExchangePointer (prev_ptr, next, frag);
    if (D.19724 != frag) goto <D.19725>; else goto <D.19726>;
    <D.19725>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    // predicted unlikely by continue predictor.
    goto <D.19499>;
    <D.19726>:
    goto <D.19500>;
    <D.19499>:
    if (prev_ptr != 0B) goto <D.19501>; else goto <D.19500>;
    <D.19500>:
  }
  <D.19709>:
  D.19700 = p;
  return D.19700;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


claim_remaining_size (struct SgenFragment * frag, char * alloc_end)
{
  char * D.19728;
  gboolean D.19731;
  char * * D.19732;
  void * D.19733;
  _Bool D.19734;

  D.19728 = frag->fragment_end;
  if (D.19728 <= alloc_end) goto <D.19729>; else goto <D.19730>;
  <D.19729>:
  D.19731 = 0;
  return D.19731;
  <D.19730>:
  D.19732 = &frag->fragment_next;
  D.19728 = frag->fragment_end;
  D.19733 = InterlockedCompareExchangePointer (D.19732, D.19728, alloc_end);
  D.19734 = D.19733 == alloc_end;
  D.19731 = (gboolean) D.19734;
  return D.19731;
}


get_mark (void * n)
{
  uintptr_t D.19736;
  long unsigned int n.3;

  n.3 = (long unsigned int) n;
  D.19736 = n.3 & 1;
  return D.19736;
}


mask (void * n, uintptr_t bit)
{
  void * D.19739;
  long unsigned int n.4;
  long unsigned int D.19741;

  n.4 = (long unsigned int) n;
  D.19741 = n.4 | bit;
  D.19739 = (void *) D.19741;
  return D.19739;
}


mono_memory_write_barrier ()
{
  mono_memory_barrier ();
}


InterlockedCompareExchangePointer (void * volatile * dest, void * exch, void * comp)
{
  void * D.19743;
  long unsigned int comp.5;
  long unsigned int exch.6;
  long unsigned int D.19746;

  comp.5 = (long unsigned int) comp;
  exch.6 = (long unsigned int) exch;
  D.19746 = __sync_val_compare_and_swap_8 (dest, comp.5, exch.6);
  D.19743 = (void *) D.19746;
  return D.19743;
}


find_previous_pointer_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag)
{
  struct SgenFragment * D.19748;
  struct SgenFragment * * D.19751;
  long unsigned int D.19753;
  void * D.19759;
  struct SgenFragment * * prev;
  struct SgenFragment * cur;
  struct SgenFragment * next;
  void try_again = <<< error >>>;

  try_again:
  prev = &allocator->alloc_head;
  D.19748 = *prev;
  cur = unmask (D.19748);
  <D.19485>:
  if (cur == 0B) goto <D.19749>; else goto <D.19750>;
  <D.19749>:
  D.19751 = 0B;
  return D.19751;
  <D.19750>:
  next = cur->next;
  mono_memory_read_barrier ();
  D.19748 = *prev;
  if (D.19748 != cur) goto try_again; else goto <D.19752>;
  <D.19752>:
  D.19753 = get_mark (next);
  if (D.19753 == 0) goto <D.19754>; else goto <D.19755>;
  <D.19754>:
  if (cur == frag) goto <D.19756>; else goto <D.19757>;
  <D.19756>:
  D.19751 = prev;
  return D.19751;
  <D.19757>:
  prev = &cur->next;
  goto <D.19758>;
  <D.19755>:
  next = unmask (next);
  D.19759 = InterlockedCompareExchangePointer (prev, next, cur);
  if (D.19759 != cur) goto try_again; else goto <D.19760>;
  <D.19760>:
  mono_memory_write_barrier ();
  <D.19758>:
  cur = mono_lls_pointer_unmask (next);
  goto <D.19485>;
  D.19751 = 0B;
  return D.19751;
}


mono_memory_read_barrier ()
{
  mono_memory_barrier ();
}


mono_lls_pointer_unmask (void * p)
{
  void * D.19762;
  long unsigned int p.7;
  long unsigned int D.19764;

  p.7 = (long unsigned int) p;
  D.19764 = p.7 & 18446744073709551612;
  D.19762 = (void *) D.19764;
  return D.19762;
}


__attribute__((visibility ("hidden")))
sgen_fragment_allocator_serial_alloc (struct SgenFragmentAllocator * allocator, size_t size)
{
  void * D.19768;
  struct SgenFragment * frag;
  struct SgenFragment * * previous;

  previous = &allocator->alloc_head;
  frag = *previous;
  goto <D.19527>;
  <D.19526>:
  {
    char * p;

    p = serial_alloc_from_fragment (previous, frag, size);
    if (p != 0B) goto <D.19766>; else goto <D.19767>;
    <D.19766>:
    D.19768 = p;
    return D.19768;
    <D.19767>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.19527>:
  if (frag != 0B) goto <D.19526>; else goto <D.19528>;
  <D.19528>:
  D.19768 = 0B;
  return D.19768;
}


serial_alloc_from_fragment (struct SgenFragment * * previous, struct SgenFragment * frag, size_t size)
{
  char * D.19770;
  void * D.19773;
  long int D.19774;
  long int end.8;
  long int D.19776;
  struct SgenFragment * D.19779;
  long unsigned int D.19780;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19770 = frag->fragment_end;
  if (D.19770 < end) goto <D.19771>; else goto <D.19772>;
  <D.19771>:
  D.19773 = 0B;
  return D.19773;
  <D.19772>:
  frag->fragment_next = end;
  D.19770 = frag->fragment_end;
  D.19774 = (long int) D.19770;
  end.8 = (long int) end;
  D.19776 = D.19774 - end.8;
  if (D.19776 <= 511) goto <D.19777>; else goto <D.19778>;
  <D.19777>:
  D.19779 = frag->next;
  *previous = D.19779;
  D.19770 = frag->fragment_end;
  D.19774 = (long int) D.19770;
  end.8 = (long int) end;
  D.19776 = D.19774 - end.8;
  D.19780 = (long unsigned int) D.19776;
  memset (end, 0, D.19780);
  D.19779 = frag->next;
  *previous = D.19779;
  <D.19778>:
  D.19773 = p;
  return D.19773;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memset (void * __dest, int __ch, size_t __len)
{
  void * D.19782;
  long unsigned int D.19783;

  D.19783 = __builtin_object_size (__dest, 0);
  D.19782 = __builtin___memset_chk (__dest, __ch, __len, D.19783);
  return D.19782;
}


__attribute__((visibility ("hidden")))
sgen_fragment_allocator_serial_range_alloc (struct SgenFragmentAllocator * allocator, size_t desired_size, size_t minimum_size, size_t * out_alloc_size)
{
  char * D.19785;
  long int D.19786;
  char * D.19787;
  long int D.19788;
  long int D.19789;
  void * D.19792;
  char * D.19797;
  long int D.19798;
  char * D.19799;
  long int D.19800;
  long int D.19801;
  struct SgenFragment * frag;
  struct SgenFragment * * previous;
  struct SgenFragment * min_frag;
  struct SgenFragment * * prev_min_frag;
  size_t current_minimum;

  min_frag = 0B;
  prev_min_frag = 0B;
  current_minimum = minimum_size;
  previous = &allocator->alloc_head;
  frag = *previous;
  goto <D.19543>;
  <D.19542>:
  {
    size_t frag_size;

    D.19785 = frag->fragment_end;
    D.19786 = (long int) D.19785;
    D.19787 = frag->fragment_next;
    D.19788 = (long int) D.19787;
    D.19789 = D.19786 - D.19788;
    frag_size = (size_t) D.19789;
    if (desired_size <= frag_size) goto <D.19790>; else goto <D.19791>;
    <D.19790>:
    {
      void * p;

      *out_alloc_size = desired_size;
      p = serial_alloc_from_fragment (previous, frag, desired_size);
      D.19792 = p;
      return D.19792;
    }
    <D.19791>:
    if (current_minimum <= frag_size) goto <D.19793>; else goto <D.19794>;
    <D.19793>:
    min_frag = frag;
    prev_min_frag = previous;
    current_minimum = frag_size;
    <D.19794>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.19543>:
  if (frag != 0B) goto <D.19542>; else goto <D.19544>;
  <D.19544>:
  if (min_frag != 0B) goto <D.19795>; else goto <D.19796>;
  <D.19795>:
  {
    void * p;
    size_t frag_size;

    D.19797 = min_frag->fragment_end;
    D.19798 = (long int) D.19797;
    D.19799 = min_frag->fragment_next;
    D.19800 = (long int) D.19799;
    D.19801 = D.19798 - D.19800;
    frag_size = (size_t) D.19801;
    *out_alloc_size = frag_size;
    p = serial_alloc_from_fragment (prev_min_frag, min_frag, frag_size);
    D.19792 = p;
    return D.19792;
  }
  <D.19796>:
  D.19792 = 0B;
  return D.19792;
}


__attribute__((visibility ("hidden")))
sgen_fragment_allocator_par_range_alloc (struct SgenFragmentAllocator * allocator, size_t desired_size, size_t minimum_size, size_t * out_alloc_size)
{
  struct SgenFragment * D.19803;
  char * D.19804;
  long int D.19805;
  char * D.19806;
  long int D.19807;
  long int D.19808;
  long unsigned int D.19809;
  void * D.19813;
  struct SgenFragment * D.19816;
  char * D.19819;
  long int D.19820;
  char * D.19821;
  long int D.19822;
  long int D.19823;
  long unsigned int D.19824;
  struct SgenFragment * frag;
  struct SgenFragment * min_frag;
  size_t current_minimum;
  void restart = <<< error >>>;

  restart:
  min_frag = 0B;
  current_minimum = minimum_size;
  D.19803 = allocator->alloc_head;
  frag = unmask (D.19803);
  goto <D.19560>;
  <D.19559>:
  {
    int frag_size;

    D.19804 = frag->fragment_end;
    D.19805 = (long int) D.19804;
    D.19806 = frag->fragment_next;
    D.19807 = (long int) D.19806;
    D.19808 = D.19805 - D.19807;
    frag_size = (int) D.19808;
    D.19809 = (long unsigned int) frag_size;
    if (D.19809 >= desired_size) goto <D.19810>; else goto <D.19811>;
    <D.19810>:
    {
      void * p;

      *out_alloc_size = desired_size;
      p = par_alloc_from_fragment (allocator, frag, desired_size);
      if (p == 0B) goto restart; else goto <D.19812>;
      <D.19812>:
      D.19813 = p;
      return D.19813;
    }
    <D.19811>:
    D.19809 = (long unsigned int) frag_size;
    if (D.19809 >= current_minimum) goto <D.19814>; else goto <D.19815>;
    <D.19814>:
    min_frag = frag;
    current_minimum = (size_t) frag_size;
    <D.19815>:
  }
  D.19816 = frag->next;
  frag = unmask (D.19816);
  <D.19560>:
  if (frag != 0B) goto <D.19559>; else goto <D.19561>;
  <D.19561>:
  mono_memory_barrier ();
  if (min_frag != 0B) goto <D.19817>; else goto <D.19818>;
  <D.19817>:
  {
    void * p;
    int frag_size;

    D.19819 = min_frag->fragment_end;
    D.19820 = (long int) D.19819;
    D.19821 = min_frag->fragment_next;
    D.19822 = (long int) D.19821;
    D.19823 = D.19820 - D.19822;
    frag_size = (int) D.19823;
    D.19824 = (long unsigned int) frag_size;
    if (D.19824 < minimum_size) goto restart; else goto <D.19825>;
    <D.19825>:
    D.19824 = (long unsigned int) frag_size;
    *out_alloc_size = D.19824;
    mono_memory_barrier ();
    D.19824 = (long unsigned int) frag_size;
    p = par_alloc_from_fragment (allocator, min_frag, D.19824);
    if (p == 0B) goto restart; else goto <D.19826>;
    <D.19826>:
    D.19813 = p;
    return D.19813;
  }
  <D.19818>:
  D.19813 = 0B;
  return D.19813;
}


__attribute__((visibility ("hidden")))
sgen_clear_allocator_fragments (struct SgenFragmentAllocator * allocator)
{
  struct SgenFragment * D.19828;
  struct FILE * gc_debug_file.9;
  char * D.19832;
  char * D.19833;
  struct SgenFragment * D.19834;
  struct SgenFragment * frag;

  D.19828 = allocator->alloc_head;
  frag = unmask (D.19828);
  goto <D.19569>;
  <D.19568>:
  if (0 != 0) goto <D.19829>; else goto <D.19830>;
  <D.19829>:
  gc_debug_file.9 = gc_debug_file;
  D.19832 = frag->fragment_next;
  D.19833 = frag->fragment_end;
  fprintf (gc_debug_file.9, "Clear nursery frag %p-%p\n", D.19832, D.19833);
  gc_debug_file.9 = gc_debug_file;
  fflush (gc_debug_file.9);
  <D.19830>:
  D.19832 = frag->fragment_next;
  D.19833 = frag->fragment_end;
  sgen_clear_range (D.19832, D.19833);
  D.19834 = frag->next;
  frag = unmask (D.19834);
  <D.19569>:
  if (frag != 0B) goto <D.19568>; else goto <D.19570>;
  <D.19570>:
}


__attribute__((visibility ("hidden")))
sgen_clear_nursery_fragments ()
{
  <unnamed type> D.19835;
  void (*<T869>) (void) D.19838;

  D.19835 = sgen_get_nursery_clear_policy ();
  if (D.19835 == 1) goto <D.19836>; else goto <D.19837>;
  <D.19836>:
  sgen_clear_allocator_fragments (&mutator_allocator);
  D.19838 = sgen_minor_collector.clear_fragments;
  D.19838 ();
  <D.19837>:
}


__attribute__((visibility ("hidden")))
sgen_clear_range (char * start, char * end)
{
  long int end.10;
  long int start.11;
  long int D.19841;
  struct MonoVTable * D.19848;
  unsigned int D.19849;
  unsigned int D.19850;
  unsigned int D.19851;
  sizetype D.19852;
  char * D.19853;
  _Bool D.19854;
  long int D.19855;
  long int D.19856;
  struct MonoArray * o;
  size_t size;

  end.10 = (long int) end;
  start.11 = (long int) start;
  D.19841 = end.10 - start.11;
  size = (size_t) D.19841;
  if (start != 0B) goto <D.19845>; else goto <D.19842>;
  <D.19845>:
  if (end == 0B) goto <D.19843>; else goto <D.19842>;
  <D.19842>:
  if (start > end) goto <D.19843>; else goto <D.19844>;
  <D.19843>:
  monoeg_g_log (0B, 4, "Invalid range [%p %p]", start, end);
  <D.19580>:
  goto <D.19580>;
  <D.19844>:
  if (size <= 31) goto <D.19846>; else goto <D.19847>;
  <D.19846>:
  memset (start, 0, size);
  return;
  <D.19847>:
  o = start;
  D.19848 = sgen_get_array_fill_vtable ();
  o->obj.vtable = D.19848;
  o->obj.synchronisation = -1B;
  o->bounds = 0B;
  D.19849 = (unsigned int) size;
  D.19850 = D.19849 + 4294967264;
  o->max_length = D.19850;
  sgen_set_nursery_scan_start (start);
  D.19851 = sgen_safe_object_get_size (o);
  D.19852 = (sizetype) D.19851;
  D.19853 = start + D.19852;
  D.19854 = D.19853 != end;
  D.19855 = (long int) D.19854;
  D.19856 = __builtin_expect (D.19855, 0);
  if (D.19856 != 0) goto <D.19857>; else goto <D.19858>;
  <D.19857>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 690, "start + sgen_safe_object_get_size ((MonoObject*)o) == end");
  <D.19858>:
}


sgen_set_nursery_scan_start (char * p)
{
  long int p.12;
  struct GCMemSection * nursery_section.13;
  char * D.19862;
  long int D.19863;
  long int D.19864;
  long int D.19865;
  char * * D.19866;
  long unsigned int D.19867;
  long unsigned int D.19868;
  char * * D.19869;
  int idx;
  char * old;

  p.12 = (long int) p;
  nursery_section.13 = nursery_section;
  D.19862 = nursery_section.13->data;
  D.19863 = (long int) D.19862;
  D.19864 = p.12 - D.19863;
  D.19865 = D.19864 / 8192;
  idx = (int) D.19865;
  nursery_section.13 = nursery_section;
  D.19866 = nursery_section.13->scan_starts;
  D.19867 = (long unsigned int) idx;
  D.19868 = D.19867 * 8;
  D.19869 = D.19866 + D.19868;
  old = *D.19869;
  if (old == 0B) goto <D.19870>; else goto <D.19872>;
  <D.19872>:
  if (old > p) goto <D.19870>; else goto <D.19871>;
  <D.19870>:
  nursery_section.13 = nursery_section;
  D.19866 = nursery_section.13->scan_starts;
  D.19867 = (long unsigned int) idx;
  D.19868 = D.19867 * 8;
  D.19869 = D.19866 + D.19868;
  *D.19869 = p;
  <D.19871>:
}


sgen_safe_object_get_size (struct MonoObject * obj)
{
  char * iftmp.14;
  long unsigned int D.19874;
  long unsigned int D.19875;
  long unsigned int D.19878;
  guint D.19882;
  struct MonoVTable * D.19883;
  char * forwarded;

  D.19874 = MEM[(mword *)obj];
  D.19875 = D.19874 & 1;
  if (D.19875 != 0) goto <D.19876>; else goto <D.19877>;
  <D.19876>:
  D.19874 = MEM[(mword *)obj];
  D.19878 = D.19874 & 18446744073709551612;
  iftmp.14 = (char *) D.19878;
  goto <D.19879>;
  <D.19877>:
  iftmp.14 = 0B;
  <D.19879>:
  forwarded = iftmp.14;
  if (forwarded != 0B) goto <D.19880>; else goto <D.19881>;
  <D.19880>:
  obj = forwarded;
  <D.19881>:
  D.19874 = MEM[(mword *)obj];
  D.19878 = D.19874 & 18446744073709551612;
  D.19883 = (struct MonoVTable *) D.19878;
  D.19882 = sgen_par_object_get_size (D.19883, obj);
  return D.19882;
}


sgen_par_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  void * D.19885;
  long unsigned int D.19886;
  guint D.19891;
  int D.19892;
  int D.19893;
  unsigned int D.19894;
  long unsigned int D.19897;
  int D.19898;
  unsigned int D.19899;
  unsigned int element_size.15;
  unsigned int D.19901;
  long unsigned int D.19902;
  long unsigned int D.19903;
  struct MonoClass * D.19906;
  unsigned char D.19907;
  long unsigned int D.19908;
  long unsigned int D.19909;
  mword descr;
  mword type;

  D.19885 = vtable->gc_descr;
  descr = (mword) D.19885;
  type = descr & 7;
  D.19886 = type + 18446744073709551615;
  if (D.19886 <= 1) goto <D.19887>; else goto <D.19888>;
  <D.19887>:
  {
    mword size;

    size = descr & 65528;
    if (size == 0) goto <D.19889>; else goto <D.19890>;
    <D.19889>:
    D.19892 = MEM[(struct MonoString *)o].length;
    D.19893 = D.19892 * 2;
    D.19894 = (unsigned int) D.19893;
    D.19891 = D.19894 + 26;
    return D.19891;
    <D.19890>:
    D.19891 = (guint) size;
    return D.19891;
  }
  <D.19888>:
  if (type == 4) goto <D.19895>; else goto <D.19896>;
  <D.19895>:
  {
    int element_size;
    struct MonoArray * array;
    size_t size;

    D.19897 = descr >> 3;
    D.19898 = (int) D.19897;
    element_size = D.19898 & 1023;
    array = o;
    D.19899 = array->max_length;
    element_size.15 = (unsigned int) element_size;
    D.19901 = D.19899 * element_size.15;
    D.19902 = (long unsigned int) D.19901;
    size = D.19902 + 32;
    D.19903 = descr & 8192;
    if (D.19903 != 0) goto <D.19904>; else goto <D.19905>;
    <D.19904>:
    size = size + 3;
    size = size & 18446744073709551612;
    D.19906 = vtable->klass;
    D.19907 = D.19906->rank;
    D.19908 = (long unsigned int) D.19907;
    D.19909 = D.19908 * 8;
    size = D.19909 + size;
    <D.19905>:
    D.19891 = (guint) size;
    return D.19891;
  }
  <D.19896>:
  D.19891 = slow_object_get_size (vtable, o);
  return D.19891;
}


slow_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  struct MonoClass * D.19911;
  guint D.19914;
  int D.19915;
  int D.19916;
  unsigned int D.19917;
  unsigned char D.19918;
  int D.19921;
  unsigned int D.19922;
  unsigned int D.19923;
  unsigned int D.19924;
  long unsigned int D.19925;
  struct MonoArrayBounds * D.19926;
  _Bool D.19927;
  long int D.19928;
  long int D.19929;
  long unsigned int D.19932;
  long unsigned int D.19933;
  int D.19934;
  struct MonoClass * klass;

  klass = vtable->klass;
  D.19911 = mono_defaults.string_class;
  if (D.19911 == klass) goto <D.19912>; else goto <D.19913>;
  <D.19912>:
  D.19915 = MEM[(struct MonoString *)o].length;
  D.19916 = D.19915 * 2;
  D.19917 = (unsigned int) D.19916;
  D.19914 = D.19917 + 26;
  return D.19914;
  <D.19913>:
  D.19918 = klass->rank;
  if (D.19918 != 0) goto <D.19919>; else goto <D.19920>;
  <D.19919>:
  {
    struct MonoArray * array;
    size_t size;

    array = o;
    D.19921 = klass->sizes.element_size;
    D.19922 = (unsigned int) D.19921;
    D.19923 = array->max_length;
    D.19924 = D.19922 * D.19923;
    D.19925 = (long unsigned int) D.19924;
    size = D.19925 + 32;
    D.19926 = array->bounds;
    D.19927 = D.19926 != 0B;
    D.19928 = (long int) D.19927;
    D.19929 = __builtin_expect (D.19928, 0);
    if (D.19929 != 0) goto <D.19930>; else goto <D.19931>;
    <D.19930>:
    size = size + 3;
    size = size & 18446744073709551612;
    D.19918 = klass->rank;
    D.19932 = (long unsigned int) D.19918;
    D.19933 = D.19932 * 8;
    size = D.19933 + size;
    <D.19931>:
    D.19914 = (guint) size;
    return D.19914;
  }
  <D.19920>:
  D.19934 = klass->instance_size;
  D.19914 = (guint) D.19934;
  return D.19914;
}


__attribute__((visibility ("hidden")))
sgen_nursery_allocator_prepare_for_pinning ()
{
  void (*<T869>) (void) D.19936;

  sgen_clear_allocator_fragments (&mutator_allocator);
  D.19936 = sgen_minor_collector.clear_fragments;
  D.19936 ();
}


__attribute__((visibility ("hidden")))
sgen_build_nursery_fragments (struct GCMemSection * nursery_section, void * * start, int num_entries, struct SgenGrayQueue * unpin_queue)
{
  struct SgenFragment * (*<T2dfa>) (void) D.19937;
  char * * D.19938;
  unsigned int D.19939;
  long unsigned int D.19940;
  long unsigned int D.19941;
  long unsigned int D.19944;
  long unsigned int D.19945;
  void * * D.19946;
  int iftmp.16;
  struct GrayQueueSection * D.19957;
  int D.19959;
  _Bool D.19960;
  long int D.19961;
  long int D.19962;
  int D.19966;
  int D.19967;
  long unsigned int D.19969;
  long unsigned int D.19970;
  unsigned int D.19971;
  unsigned int D.19972;
  long unsigned int D.19973;
  char * D.19975;
  long int D.19976;
  long int addr1.17;
  long int D.19978;
  long int frag_end.18;
  long int frag_start.19;
  long int D.19981;
  _Bool D.19986;
  long int D.19987;
  long int D.19988;
  void (*<T869>) (void) D.19998;
  void (*<T2dff>) (struct SgenFragmentAllocator *) D.19999;
  struct SgenFragment * D.20000;
  void * D.20001;
  int gc_debug_level.20;
  _Bool D.20005;
  long int D.20006;
  long int D.20007;
  struct FILE * gc_debug_file.21;
  void * D.20013;
  const char * D.20014;
  unsigned int D.20015;
  mword D.20016;
  char * frag_start;
  char * frag_end;
  size_t frag_size;
  int i;
  struct SgenFragment * frags_ranges;

  i = 0;
  sgen_fragment_allocator_release (&mutator_allocator);
  frag_start = sgen_nursery_start;
  fragment_total = 0;
  D.19937 = sgen_minor_collector.build_fragments_get_exclude_head;
  frags_ranges = D.19937 ();
  D.19938 = nursery_section->scan_starts;
  D.19939 = nursery_section->num_scan_start;
  D.19940 = (long unsigned int) D.19939;
  D.19941 = D.19940 * 8;
  memset (D.19938, 0, D.19941);
  goto <D.19615>;
  <D.19616>:
  {
    char * addr0;
    char * addr1;
    size_t size;
    struct SgenFragment * last_frag;

    last_frag = 0B;
    addr1 = sgen_nursery_end;
    addr0 = addr1;
    if (i < num_entries) goto <D.19942>; else goto <D.19943>;
    <D.19942>:
    D.19944 = (long unsigned int) i;
    D.19945 = D.19944 * 8;
    D.19946 = start + D.19945;
    addr0 = *D.19946;
    <D.19943>:
    if (frags_ranges != 0B) goto <D.19947>; else goto <D.19948>;
    <D.19947>:
    addr1 = frags_ranges->fragment_start;
    <D.19948>:
    if (addr0 < addr1) goto <D.19949>; else goto <D.19950>;
    <D.19949>:
    if (unpin_queue != 0B) goto <D.19951>; else goto <D.19952>;
    <D.19951>:
    D.19957 = unpin_queue->first;
    if (D.19957 == 0B) goto <D.19954>; else goto <D.19958>;
    <D.19958>:
    D.19957 = unpin_queue->first;
    D.19959 = D.19957->end;
    if (D.19959 == 125) goto <D.19954>; else goto <D.19955>;
    <D.19954>:
    iftmp.16 = 1;
    goto <D.19956>;
    <D.19955>:
    iftmp.16 = 0;
    <D.19956>:
    D.19960 = iftmp.16 != 0;
    D.19961 = (long int) D.19960;
    D.19962 = __builtin_expect (D.19961, 0);
    if (D.19962 != 0) goto <D.19963>; else goto <D.19964>;
    <D.19963>:
    sgen_gray_object_enqueue (unpin_queue, addr0);
    goto <D.19965>;
    <D.19964>:
    D.19957 = unpin_queue->first;
    D.19957 = unpin_queue->first;
    D.19959 = D.19957->end;
    D.19966 = D.19959;
    D.19967 = D.19966 + 1;
    D.19957->end = D.19967;
    D.19957->objects[D.19966] = addr0;
    <D.19965>:
    __builtin_prefetch (addr0);
    goto <D.19968>;
    <D.19952>:
    D.19969 = MEM[(mword *)addr0];
    D.19970 = D.19969 & 18446744073709551613;
    MEM[(mword *)addr0] = D.19970;
    <D.19968>:
    sgen_set_nursery_scan_start (addr0);
    frag_end = addr0;
    D.19971 = sgen_safe_object_get_size (addr0);
    D.19972 = D.19971 + 7;
    D.19973 = (long unsigned int) D.19972;
    size = D.19973 & 4294967288;
    i = i + 1;
    goto <D.19974>;
    <D.19950>:
    frag_end = addr1;
    D.19975 = frags_ranges->fragment_next;
    D.19976 = (long int) D.19975;
    addr1.17 = (long int) addr1;
    D.19978 = D.19976 - addr1.17;
    size = (size_t) D.19978;
    last_frag = frags_ranges;
    frags_ranges = frags_ranges->next_in_order;
    <D.19974>:
    frag_end.18 = (long int) frag_end;
    frag_start.19 = (long int) frag_start;
    D.19981 = frag_end.18 - frag_start.19;
    frag_size = (size_t) D.19981;
    if (size == 0) goto <D.19982>; else goto <D.19983>;
    <D.19982>:
    // predicted unlikely by continue predictor.
    goto <D.19615>;
    <D.19983>:
    if (0 != 0) goto <D.19984>; else goto <D.19985>;
    <D.19984>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 802, "frag_size >= 0");
    <D.19985>:
    D.19986 = size == 0;
    D.19987 = (long int) D.19986;
    D.19988 = __builtin_expect (D.19987, 0);
    if (D.19988 != 0) goto <D.19989>; else goto <D.19990>;
    <D.19989>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 803, "size > 0");
    <D.19990>:
    if (frag_size != 0) goto <D.19991>; else goto <D.19992>;
    <D.19991>:
    if (size != 0) goto <D.19993>; else goto <D.19994>;
    <D.19993>:
    add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
    <D.19994>:
    <D.19992>:
    frag_size = size;
    frag_start = frag_end + frag_size;
  }
  <D.19615>:
  if (i < num_entries) goto <D.19616>; else goto <D.19995>;
  <D.19995>:
  if (frags_ranges != 0B) goto <D.19616>; else goto <D.19617>;
  <D.19617>:
  nursery_last_pinned_end = frag_start;
  frag_end = sgen_nursery_end;
  frag_end.18 = (long int) frag_end;
  frag_start.19 = (long int) frag_start;
  D.19981 = frag_end.18 - frag_start.19;
  frag_size = (size_t) D.19981;
  if (frag_size != 0) goto <D.19996>; else goto <D.19997>;
  <D.19996>:
  add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
  <D.19997>:
  D.19998 = sgen_minor_collector.build_fragments_release_exclude_head;
  D.19998 ();
  fragment_list_reverse (&mutator_allocator);
  D.19999 = sgen_minor_collector.build_fragments_finish;
  D.19999 (&mutator_allocator);
  D.20000 = mutator_allocator.alloc_head;
  D.20001 = unmask (D.20000);
  if (D.20001 == 0B) goto <D.20002>; else goto <D.20003>;
  <D.20002>:
  gc_debug_level.20 = gc_debug_level;
  D.20005 = gc_debug_level.20 > 0;
  D.20006 = (long int) D.20005;
  D.20007 = __builtin_expect (D.20006, 0);
  if (D.20007 != 0) goto <D.20008>; else goto <D.20009>;
  <D.20008>:
  gc_debug_file.21 = gc_debug_file;
  fprintf (gc_debug_file.21, "Nursery fully pinned (%d)\n", num_entries);
  gc_debug_file.21 = gc_debug_file;
  fflush (gc_debug_file.21);
  <D.20009>:
  i = 0;
  goto <D.19619>;
  <D.19618>:
  if (0 != 0) goto <D.20011>; else goto <D.20012>;
  <D.20011>:
  gc_debug_file.21 = gc_debug_file;
  D.19944 = (long unsigned int) i;
  D.19945 = D.19944 * 8;
  D.19946 = start + D.19945;
  D.20013 = *D.19946;
  D.19944 = (long unsigned int) i;
  D.19945 = D.19944 * 8;
  D.19946 = start + D.19945;
  D.20013 = *D.19946;
  D.20014 = sgen_safe_name (D.20013);
  D.19944 = (long unsigned int) i;
  D.19945 = D.19944 * 8;
  D.19946 = start + D.19945;
  D.20013 = *D.19946;
  D.20015 = sgen_safe_object_get_size (D.20013);
  fprintf (gc_debug_file.21, "Bastard pinning obj %p (%s), size: %d\n", D.20013, D.20014, D.20015);
  gc_debug_file.21 = gc_debug_file;
  fflush (gc_debug_file.21);
  <D.20012>:
  i = i + 1;
  <D.19619>:
  if (i < num_entries) goto <D.19618>; else goto <D.19620>;
  <D.19620>:
  <D.20003>:
  D.20016 = fragment_total;
  return D.20016;
}


add_nursery_frag (struct SgenFragmentAllocator * allocator, size_t frag_size, char * frag_start, char * frag_end)
{
  struct FILE * gc_debug_file.22;
  <unnamed type> D.20023;
  long unsigned int fragment_total.23;
  long unsigned int D.20027;

  if (0 != 0) goto <D.20018>; else goto <D.20019>;
  <D.20018>:
  gc_debug_file.22 = gc_debug_file;
  fprintf (gc_debug_file.22, "Found empty fragment: %p-%p, size: %zd\n", frag_start, frag_end, frag_size);
  gc_debug_file.22 = gc_debug_file;
  fflush (gc_debug_file.22);
  <D.20019>:
  if (frag_size > 511) goto <D.20021>; else goto <D.20022>;
  <D.20021>:
  D.20023 = sgen_get_nursery_clear_policy ();
  if (D.20023 == 0) goto <D.20024>; else goto <D.20025>;
  <D.20024>:
  memset (frag_start, 0, frag_size);
  <D.20025>:
  sgen_fragment_allocator_add (allocator, frag_start, frag_end);
  fragment_total.23 = fragment_total;
  D.20027 = fragment_total.23 + frag_size;
  fragment_total = D.20027;
  goto <D.20028>;
  <D.20022>:
  sgen_clear_range (frag_start, frag_end);
  <D.20028>:
}


fragment_list_reverse (struct SgenFragmentAllocator * allocator)
{
  struct SgenFragment * D.20029;
  struct SgenFragment * prev;
  struct SgenFragment * list;

  prev = 0B;
  list = allocator->region_head;
  goto <D.19598>;
  <D.19597>:
  {
    struct SgenFragment * next;

    next = list->next;
    list->next = prev;
    list->next_in_order = prev;
    prev = list;
    list = next;
  }
  <D.19598>:
  if (list != 0B) goto <D.19597>; else goto <D.19599>;
  <D.19599>:
  allocator->alloc_head = prev;
  D.20029 = allocator->alloc_head;
  allocator->region_head = D.20029;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
fprintf (struct FILE * restrict __stream, const char * restrict __fmt)
{
  int D.20030;

  D.20030 = __fprintf_chk (__stream, 1, __fmt, __builtin_va_arg_pack ());
  return D.20030;
}


__attribute__((visibility ("hidden")))
sgen_nursery_alloc_get_upper_alloc_bound ()
{
  char * D.20032;

  D.20032 = sgen_nursery_end;
  return D.20032;
}


__attribute__((visibility ("hidden")))
sgen_nursery_retire_region (void * address, ptrdiff_t size)
{

}


__attribute__((visibility ("hidden")))
sgen_can_alloc_size (size_t size)
{
  long unsigned int D.20034;
  struct SgenFragment * D.20035;
  char * D.20036;
  long int D.20037;
  char * D.20038;
  long int D.20039;
  long int D.20040;
  long unsigned int D.20041;
  gboolean D.20044;
  struct SgenFragment * D.20045;
  struct SgenFragment * frag;

  D.20034 = size + 7;
  size = D.20034 & 18446744073709551608;
  D.20035 = mutator_allocator.alloc_head;
  frag = unmask (D.20035);
  goto <D.19633>;
  <D.19632>:
  D.20036 = frag->fragment_end;
  D.20037 = (long int) D.20036;
  D.20038 = frag->fragment_next;
  D.20039 = (long int) D.20038;
  D.20040 = D.20037 - D.20039;
  D.20041 = (long unsigned int) D.20040;
  if (D.20041 >= size) goto <D.20042>; else goto <D.20043>;
  <D.20042>:
  D.20044 = 1;
  return D.20044;
  <D.20043>:
  D.20045 = frag->next;
  frag = unmask (D.20045);
  <D.19633>:
  if (frag != 0B) goto <D.19632>; else goto <D.19634>;
  <D.19634>:
  D.20044 = 0;
  return D.20044;
}


__attribute__((visibility ("hidden")))
sgen_nursery_alloc (size_t size)
{
  struct FILE * gc_debug_file.24;
  long unsigned int D.20050;
  void * D.20051;

  if (0 != 0) goto <D.20047>; else goto <D.20048>;
  <D.20047>:
  gc_debug_file.24 = gc_debug_file;
  fprintf (gc_debug_file.24, "Searching nursery for size: %zd\n", size);
  gc_debug_file.24 = gc_debug_file;
  fflush (gc_debug_file.24);
  <D.20048>:
  D.20050 = size + 7;
  size = D.20050 & 18446744073709551608;
  D.20051 = sgen_fragment_allocator_par_alloc (&mutator_allocator, size);
  return D.20051;
}


__attribute__((visibility ("hidden")))
sgen_nursery_alloc_range (size_t desired_size, size_t minimum_size, size_t * out_alloc_size)
{
  struct FILE * gc_debug_file.25;
  void * D.20056;

  if (0 != 0) goto <D.20053>; else goto <D.20054>;
  <D.20053>:
  gc_debug_file.25 = gc_debug_file;
  fprintf (gc_debug_file.25, "Searching for byte range desired size: %zd minimum size %zd\n", desired_size, minimum_size);
  gc_debug_file.25 = gc_debug_file;
  fflush (gc_debug_file.25);
  <D.20054>:
  D.20056 = sgen_fragment_allocator_par_range_alloc (&mutator_allocator, desired_size, minimum_size, out_alloc_size);
  return D.20056;
}


__attribute__((visibility ("hidden")))
sgen_init_nursery_allocator ()
{
  sgen_register_fixed_internal_mem_type (1, 40);
}


__attribute__((visibility ("hidden")))
sgen_nursery_alloc_prepare_for_minor ()
{
  void (*<T2df6>) (char *, int) D.20058;
  char * sgen_space_bitmap.26;
  int sgen_space_bitmap_size.27;

  D.20058 = sgen_minor_collector.prepare_to_space;
  sgen_space_bitmap.26 = sgen_space_bitmap;
  sgen_space_bitmap_size.27 = sgen_space_bitmap_size;
  D.20058 (sgen_space_bitmap.26, sgen_space_bitmap_size.27);
}


__attribute__((visibility ("hidden")))
sgen_nursery_alloc_prepare_for_major ()
{
  void (*<T2df6>) (char *, int) D.20061;
  char * sgen_space_bitmap.28;
  int sgen_space_bitmap_size.29;

  D.20061 = sgen_minor_collector.prepare_to_space;
  sgen_space_bitmap.28 = sgen_space_bitmap;
  sgen_space_bitmap_size.29 = sgen_space_bitmap_size;
  D.20061 (sgen_space_bitmap.28, sgen_space_bitmap_size.29);
}


__attribute__((visibility ("hidden")))
sgen_nursery_allocator_set_nursery_bounds (char * start, char * end)
{
  long int end.30;
  long int start.31;
  long int D.20066;
  long int D.20067;
  int D.20068;
  int sgen_space_bitmap_size.32;
  long unsigned int D.20070;
  void * D.20071;
  void (*<T2e03>) (struct SgenFragmentAllocator *, char *, char *) D.20072;

  sgen_nursery_start = start;
  sgen_nursery_end = end;
  end.30 = (long int) end;
  start.31 = (long int) start;
  D.20066 = end.30 - start.31;
  D.20067 = D.20066 / 4096;
  D.20068 = (int) D.20067;
  sgen_space_bitmap_size = D.20068;
  sgen_space_bitmap_size.32 = sgen_space_bitmap_size;
  D.20070 = (long unsigned int) sgen_space_bitmap_size.32;
  D.20071 = monoeg_malloc0 (D.20070);
  sgen_space_bitmap = D.20071;
  D.20072 = sgen_minor_collector.init_nursery;
  D.20072 (&mutator_allocator, start, end);
}


