sgen_fragment_allocator_alloc ()
{
  struct SgenFragment * fragment_freelist.0;
  struct SgenFragment * D.19516;
  struct SgenFragment * frag;

  frag = fragment_freelist;
  if (frag != 0B) goto <D.19513>; else goto <D.19514>;
  <D.19513>:
  fragment_freelist.0 = frag->next_in_order;
  fragment_freelist = fragment_freelist.0;
  frag->next_in_order = 0B;
  fragment_freelist.0 = frag->next_in_order;
  frag->next = fragment_freelist.0;
  D.19516 = frag;
  return D.19516;
  <D.19514>:
  frag = sgen_alloc_internal (1);
  frag->next_in_order = 0B;
  fragment_freelist.0 = frag->next_in_order;
  frag->next = fragment_freelist.0;
  D.19516 = frag;
  return D.19516;
}


sgen_fragment_allocator_add (struct SgenFragmentAllocator * allocator, char * start, char * end)
{
  struct SgenFragment * D.19518;
  void * D.19519;
  struct SgenFragment * D.19520;
  struct SgenFragment * D.19521;
  char * D.19522;
  char * D.19523;
  _Bool D.19524;
  long int D.19525;
  long int D.19526;
  struct SgenFragment * fragment;

  fragment = sgen_fragment_allocator_alloc ();
  fragment->fragment_start = start;
  fragment->fragment_next = start;
  fragment->fragment_end = end;
  D.19518 = allocator->region_head;
  D.19519 = unmask (D.19518);
  fragment->next = D.19519;
  D.19520 = fragment->next;
  fragment->next_in_order = D.19520;
  allocator->alloc_head = fragment;
  D.19521 = allocator->alloc_head;
  allocator->region_head = D.19521;
  D.19522 = fragment->fragment_end;
  D.19523 = fragment->fragment_start;
  D.19524 = D.19522 <= D.19523;
  D.19525 = (long int) D.19524;
  D.19526 = __builtin_expect (D.19525, 0);
  if (D.19526 != 0) goto <D.19527>; else goto <D.19528>;
  <D.19527>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 293, "fragment->fragment_end > fragment->fragment_start");
  <D.19528>:
}


unmask (void * p)
{
  void * D.19529;
  long unsigned int p.1;
  long unsigned int D.19531;

  p.1 = (long unsigned int) p;
  D.19531 = p.1 & 18446744073709551612;
  D.19529 = (void *) D.19531;
  return D.19529;
}


sgen_fragment_allocator_release (struct SgenFragmentAllocator * allocator)
{
  struct SgenFragment * D.19535;
  struct SgenFragment * fragment_freelist.2;
  struct SgenFragment * fragment_freelist.3;
  struct SgenFragment * last;

  last = allocator->region_head;
  if (last == 0B) goto <D.19533>; else goto <D.19534>;
  <D.19533>:
  return;
  <D.19534>:
  goto <D.19331>;
  <D.19330>:
  last = last->next_in_order;
  <D.19331>:
  D.19535 = last->next_in_order;
  if (D.19535 != 0B) goto <D.19330>; else goto <D.19332>;
  <D.19332>:
  fragment_freelist.2 = fragment_freelist;
  last->next_in_order = fragment_freelist.2;
  fragment_freelist.3 = allocator->region_head;
  fragment_freelist = fragment_freelist.3;
  allocator->region_head = 0B;
  fragment_freelist.3 = allocator->region_head;
  allocator->alloc_head = fragment_freelist.3;
}


sgen_fragment_allocator_par_alloc (struct SgenFragmentAllocator * allocator, size_t size)
{
  struct SgenFragment * D.19539;
  char * D.19540;
  long int D.19541;
  char * D.19542;
  long int D.19543;
  long int D.19544;
  long unsigned int D.19545;
  void * D.19549;
  struct SgenFragment * D.19550;
  void * D.19551;
  struct SgenFragment * frag;
  void restart = <<< error >>>;

  restart:
  D.19539 = allocator->alloc_head;
  frag = unmask (D.19539);
  goto <D.19373>;
  <D.19372>:
  D.19540 = frag->fragment_end;
  D.19541 = (long int) D.19540;
  D.19542 = frag->fragment_next;
  D.19543 = (long int) D.19542;
  D.19544 = D.19541 - D.19543;
  D.19545 = (long unsigned int) D.19544;
  if (D.19545 >= size) goto <D.19546>; else goto <D.19547>;
  <D.19546>:
  {
    void * p;

    p = par_alloc_from_fragment (allocator, frag, size);
    if (p == 0B) goto restart; else goto <D.19548>;
    <D.19548>:
    D.19549 = p;
    return D.19549;
  }
  <D.19547>:
  D.19550 = frag->next;
  frag = unmask (D.19550);
  <D.19373>:
  D.19551 = unmask (frag);
  if (D.19551 != 0B) goto <D.19372>; else goto <D.19374>;
  <D.19374>:
  D.19549 = 0B;
  return D.19549;
}


par_alloc_from_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag, size_t size)
{
  char * D.19553;
  void * D.19556;
  char * * D.19557;
  void * D.19558;
  long int D.19561;
  long int end.4;
  long int D.19563;
  <unnamed type> D.19566;
  int D.19569;
  long unsigned int D.19572;
  void * D.19575;
  struct SgenFragment * * D.19576;
  void * D.19577;
  void * D.19580;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19553 = frag->fragment_end;
  if (D.19553 < end) goto <D.19554>; else goto <D.19555>;
  <D.19554>:
  D.19556 = 0B;
  return D.19556;
  <D.19555>:
  mono_memory_barrier ();
  D.19557 = &frag->fragment_next;
  D.19558 = InterlockedCompareExchangePointer (D.19557, end, p);
  if (D.19558 != p) goto <D.19559>; else goto <D.19560>;
  <D.19559>:
  D.19556 = 0B;
  return D.19556;
  <D.19560>:
  D.19553 = frag->fragment_end;
  D.19561 = (long int) D.19553;
  end.4 = (long int) end;
  D.19563 = D.19561 - end.4;
  if (D.19563 <= 511) goto <D.19564>; else goto <D.19565>;
  <D.19564>:
  {
    struct SgenFragment * next;
    struct SgenFragment * * prev_ptr;

    D.19566 = sgen_get_nursery_clear_policy ();
    if (D.19566 == 1) goto <D.19567>; else goto <D.19568>;
    <D.19567>:
    D.19569 = claim_remaining_size (frag, end);
    if (D.19569 != 0) goto <D.19570>; else goto <D.19571>;
    <D.19570>:
    D.19553 = frag->fragment_end;
    sgen_clear_range (end, D.19553);
    <D.19571>:
    <D.19568>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    goto <D.19355>;
    <D.19357>:
    next = frag->next;
    D.19572 = get_mark (next);
    if (D.19572 == 0) goto <D.19573>; else goto <D.19574>;
    <D.19573>:
    mono_memory_write_barrier ();
    D.19575 = mask (next, 1);
    D.19576 = &frag->next;
    D.19577 = InterlockedCompareExchangePointer (D.19576, D.19575, next);
    if (D.19577 != next) goto <D.19578>; else goto <D.19579>;
    <D.19578>:
    // predicted unlikely by continue predictor.
    goto <D.19355>;
    <D.19579>:
    <D.19574>:
    mono_memory_write_barrier ();
    D.19580 = InterlockedCompareExchangePointer (prev_ptr, next, frag);
    if (D.19580 != frag) goto <D.19581>; else goto <D.19582>;
    <D.19581>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    // predicted unlikely by continue predictor.
    goto <D.19355>;
    <D.19582>:
    goto <D.19356>;
    <D.19355>:
    if (prev_ptr != 0B) goto <D.19357>; else goto <D.19356>;
    <D.19356>:
  }
  <D.19565>:
  D.19556 = p;
  return D.19556;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


claim_remaining_size (struct SgenFragment * frag, char * alloc_end)
{
  char * D.19584;
  gboolean D.19587;
  char * * D.19588;
  void * D.19589;
  _Bool D.19590;

  D.19584 = frag->fragment_end;
  if (D.19584 <= alloc_end) goto <D.19585>; else goto <D.19586>;
  <D.19585>:
  D.19587 = 0;
  return D.19587;
  <D.19586>:
  D.19584 = frag->fragment_end;
  D.19588 = &frag->fragment_next;
  D.19589 = InterlockedCompareExchangePointer (D.19588, D.19584, alloc_end);
  D.19590 = D.19589 == alloc_end;
  D.19587 = (gboolean) D.19590;
  return D.19587;
}


get_mark (void * n)
{
  uintptr_t D.19592;
  long unsigned int n.5;

  n.5 = (long unsigned int) n;
  D.19592 = n.5 & 1;
  return D.19592;
}


mask (void * n, uintptr_t bit)
{
  void * D.19595;
  long unsigned int n.6;
  long unsigned int D.19597;

  n.6 = (long unsigned int) n;
  D.19597 = n.6 | bit;
  D.19595 = (void *) D.19597;
  return D.19595;
}


mono_memory_write_barrier ()
{
  mono_memory_barrier ();
}


InterlockedCompareExchangePointer (void * volatile * dest, void * exch, void * comp)
{
  void * D.19599;
  long unsigned int exch.7;
  long unsigned int comp.8;
  long unsigned int D.19602;

  exch.7 = (long unsigned int) exch;
  comp.8 = (long unsigned int) comp;
  D.19602 = __sync_val_compare_and_swap_8 (dest, comp.8, exch.7);
  D.19599 = (void *) D.19602;
  return D.19599;
}


find_previous_pointer_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag)
{
  struct SgenFragment * D.19604;
  struct SgenFragment * * D.19607;
  long unsigned int D.19609;
  void * D.19615;
  struct SgenFragment * * prev;
  struct SgenFragment * cur;
  struct SgenFragment * next;
  void try_again = <<< error >>>;

  try_again:
  prev = &allocator->alloc_head;
  D.19604 = *prev;
  cur = unmask (D.19604);
  <D.19341>:
  if (cur == 0B) goto <D.19605>; else goto <D.19606>;
  <D.19605>:
  D.19607 = 0B;
  return D.19607;
  <D.19606>:
  next = cur->next;
  mono_memory_read_barrier ();
  D.19604 = *prev;
  if (D.19604 != cur) goto try_again; else goto <D.19608>;
  <D.19608>:
  D.19609 = get_mark (next);
  if (D.19609 == 0) goto <D.19610>; else goto <D.19611>;
  <D.19610>:
  if (cur == frag) goto <D.19612>; else goto <D.19613>;
  <D.19612>:
  D.19607 = prev;
  return D.19607;
  <D.19613>:
  prev = &cur->next;
  goto <D.19614>;
  <D.19611>:
  next = unmask (next);
  D.19615 = InterlockedCompareExchangePointer (prev, next, cur);
  if (D.19615 != cur) goto try_again; else goto <D.19616>;
  <D.19616>:
  mono_memory_write_barrier ();
  <D.19614>:
  cur = mono_lls_pointer_unmask (next);
  goto <D.19341>;
  D.19607 = 0B;
  return D.19607;
}


mono_memory_read_barrier ()
{
  mono_memory_barrier ();
}


mono_lls_pointer_unmask (void * p)
{
  void * D.19618;
  long unsigned int p.9;
  long unsigned int D.19620;

  p.9 = (long unsigned int) p;
  D.19620 = p.9 & 18446744073709551612;
  D.19618 = (void *) D.19620;
  return D.19618;
}


sgen_fragment_allocator_serial_alloc (struct SgenFragmentAllocator * allocator, size_t size)
{
  void * D.19624;
  struct SgenFragment * frag;
  struct SgenFragment * * previous;

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

    p = serial_alloc_from_fragment (previous, frag, size);
    if (p != 0B) goto <D.19622>; else goto <D.19623>;
    <D.19622>:
    D.19624 = p;
    return D.19624;
    <D.19623>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.19383>:
  if (frag != 0B) goto <D.19382>; else goto <D.19384>;
  <D.19384>:
  D.19624 = 0B;
  return D.19624;
}


serial_alloc_from_fragment (struct SgenFragment * * previous, struct SgenFragment * frag, size_t size)
{
  char * D.19626;
  void * D.19629;
  long int D.19630;
  long int end.10;
  long int D.19632;
  struct SgenFragment * D.19635;
  long unsigned int D.19636;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19626 = frag->fragment_end;
  if (D.19626 < end) goto <D.19627>; else goto <D.19628>;
  <D.19627>:
  D.19629 = 0B;
  return D.19629;
  <D.19628>:
  frag->fragment_next = end;
  D.19626 = frag->fragment_end;
  D.19630 = (long int) D.19626;
  end.10 = (long int) end;
  D.19632 = D.19630 - end.10;
  if (D.19632 <= 511) goto <D.19633>; else goto <D.19634>;
  <D.19633>:
  D.19635 = frag->next;
  *previous = D.19635;
  D.19626 = frag->fragment_end;
  D.19630 = (long int) D.19626;
  end.10 = (long int) end;
  D.19632 = D.19630 - end.10;
  D.19636 = (long unsigned int) D.19632;
  memset (end, 0, D.19636);
  D.19635 = frag->next;
  *previous = D.19635;
  <D.19634>:
  D.19629 = p;
  return D.19629;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.19640;
  int D.19645;
  void * D.19647;
  long unsigned int D.19648;

  D.19640 = __builtin_constant_p (__len);
  if (D.19640 != 0) goto <D.19641>; else goto <D.19642>;
  <D.19641>:
  if (__len == 0) goto <D.19643>; else goto <D.19644>;
  <D.19643>:
  D.19645 = __builtin_constant_p (__ch);
  if (D.19645 == 0) goto <D.19638>; else goto <D.19646>;
  <D.19646>:
  if (__ch != 0) goto <D.19638>; else goto <D.19639>;
  <D.19638>:
  __warn_memset_zero_len ();
  D.19647 = __dest;
  return D.19647;
  <D.19639>:
  <D.19644>:
  <D.19642>:
  D.19648 = __builtin_object_size (__dest, 0);
  D.19647 = __builtin___memset_chk (__dest, __ch, __len, D.19648);
  return D.19647;
}


sgen_fragment_allocator_serial_range_alloc (struct SgenFragmentAllocator * allocator, size_t desired_size, size_t minimum_size, size_t * out_alloc_size)
{
  char * D.19650;
  long int D.19651;
  char * D.19652;
  long int D.19653;
  long int D.19654;
  void * D.19657;
  char * D.19662;
  long int D.19663;
  char * D.19664;
  long int D.19665;
  long int D.19666;
  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.19399>;
  <D.19398>:
  {
    size_t frag_size;

    D.19650 = frag->fragment_end;
    D.19651 = (long int) D.19650;
    D.19652 = frag->fragment_next;
    D.19653 = (long int) D.19652;
    D.19654 = D.19651 - D.19653;
    frag_size = (size_t) D.19654;
    if (desired_size <= frag_size) goto <D.19655>; else goto <D.19656>;
    <D.19655>:
    {
      void * p;

      *out_alloc_size = desired_size;
      p = serial_alloc_from_fragment (previous, frag, desired_size);
      D.19657 = p;
      return D.19657;
    }
    <D.19656>:
    if (current_minimum <= frag_size) goto <D.19658>; else goto <D.19659>;
    <D.19658>:
    min_frag = frag;
    prev_min_frag = previous;
    current_minimum = frag_size;
    <D.19659>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.19399>:
  if (frag != 0B) goto <D.19398>; else goto <D.19400>;
  <D.19400>:
  if (min_frag != 0B) goto <D.19660>; else goto <D.19661>;
  <D.19660>:
  {
    void * p;
    size_t frag_size;

    D.19662 = min_frag->fragment_end;
    D.19663 = (long int) D.19662;
    D.19664 = min_frag->fragment_next;
    D.19665 = (long int) D.19664;
    D.19666 = D.19663 - D.19665;
    frag_size = (size_t) D.19666;
    *out_alloc_size = frag_size;
    p = serial_alloc_from_fragment (prev_min_frag, min_frag, frag_size);
    D.19657 = p;
    return D.19657;
  }
  <D.19661>:
  D.19657 = 0B;
  return D.19657;
}


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.19668;
  char * D.19669;
  long int D.19670;
  char * D.19671;
  long int D.19672;
  long int D.19673;
  long unsigned int D.19674;
  void * D.19678;
  struct SgenFragment * D.19681;
  char * D.19684;
  long int D.19685;
  char * D.19686;
  long int D.19687;
  long int D.19688;
  long unsigned int D.19689;
  struct SgenFragment * frag;
  struct SgenFragment * min_frag;
  size_t current_minimum;
  void restart = <<< error >>>;

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

    D.19669 = frag->fragment_end;
    D.19670 = (long int) D.19669;
    D.19671 = frag->fragment_next;
    D.19672 = (long int) D.19671;
    D.19673 = D.19670 - D.19672;
    frag_size = (int) D.19673;
    D.19674 = (long unsigned int) frag_size;
    if (D.19674 >= desired_size) goto <D.19675>; else goto <D.19676>;
    <D.19675>:
    {
      void * p;

      *out_alloc_size = desired_size;
      p = par_alloc_from_fragment (allocator, frag, desired_size);
      if (p == 0B) goto restart; else goto <D.19677>;
      <D.19677>:
      D.19678 = p;
      return D.19678;
    }
    <D.19676>:
    D.19674 = (long unsigned int) frag_size;
    if (D.19674 >= current_minimum) goto <D.19679>; else goto <D.19680>;
    <D.19679>:
    min_frag = frag;
    current_minimum = (size_t) frag_size;
    <D.19680>:
  }
  D.19681 = frag->next;
  frag = unmask (D.19681);
  <D.19416>:
  if (frag != 0B) goto <D.19415>; else goto <D.19417>;
  <D.19417>:
  mono_memory_barrier ();
  if (min_frag != 0B) goto <D.19682>; else goto <D.19683>;
  <D.19682>:
  {
    void * p;
    int frag_size;

    D.19684 = min_frag->fragment_end;
    D.19685 = (long int) D.19684;
    D.19686 = min_frag->fragment_next;
    D.19687 = (long int) D.19686;
    D.19688 = D.19685 - D.19687;
    frag_size = (int) D.19688;
    D.19689 = (long unsigned int) frag_size;
    if (D.19689 < minimum_size) goto restart; else goto <D.19690>;
    <D.19690>:
    D.19689 = (long unsigned int) frag_size;
    *out_alloc_size = D.19689;
    mono_memory_barrier ();
    D.19689 = (long unsigned int) frag_size;
    p = par_alloc_from_fragment (allocator, min_frag, D.19689);
    if (p == 0B) goto restart; else goto <D.19691>;
    <D.19691>:
    D.19678 = p;
    return D.19678;
  }
  <D.19683>:
  D.19678 = 0B;
  return D.19678;
}


sgen_clear_allocator_fragments (struct SgenFragmentAllocator * allocator)
{
  struct SgenFragment * D.19693;
  char * D.19696;
  char * D.19697;
  struct FILE * gc_debug_file.11;
  struct SgenFragment * D.19699;
  struct SgenFragment * frag;

  D.19693 = allocator->alloc_head;
  frag = unmask (D.19693);
  goto <D.19425>;
  <D.19424>:
  if (0 != 0) goto <D.19694>; else goto <D.19695>;
  <D.19694>:
  D.19696 = frag->fragment_end;
  D.19697 = frag->fragment_next;
  gc_debug_file.11 = gc_debug_file;
  fprintf (gc_debug_file.11, "Clear nursery frag %p-%p\n", D.19697, D.19696);
  gc_debug_file.11 = gc_debug_file;
  fflush (gc_debug_file.11);
  <D.19695>:
  D.19696 = frag->fragment_end;
  D.19697 = frag->fragment_next;
  sgen_clear_range (D.19697, D.19696);
  D.19699 = frag->next;
  frag = unmask (D.19699);
  <D.19425>:
  if (frag != 0B) goto <D.19424>; else goto <D.19426>;
  <D.19426>:
}


sgen_clear_nursery_fragments ()
{
  <unnamed type> D.19700;
  void (*<T7e7>) (void) D.19703;

  D.19700 = sgen_get_nursery_clear_policy ();
  if (D.19700 == 1) goto <D.19701>; else goto <D.19702>;
  <D.19701>:
  sgen_clear_allocator_fragments (&mutator_allocator);
  D.19703 = sgen_minor_collector.clear_fragments;
  D.19703 ();
  <D.19702>:
}


sgen_clear_range (char * start, char * end)
{
  long int end.12;
  long int start.13;
  long int D.19706;
  _Bool D.19709;
  _Bool D.19710;
  _Bool D.19711;
  struct MonoVTable * D.19715;
  unsigned int D.19716;
  unsigned int D.19717;
  unsigned int D.19718;
  sizetype D.19719;
  char * D.19720;
  _Bool D.19721;
  long int D.19722;
  long int D.19723;
  struct MonoArray * o;
  size_t size;

  end.12 = (long int) end;
  start.13 = (long int) start;
  D.19706 = end.12 - start.13;
  size = (size_t) D.19706;
  D.19709 = start != 0B;
  D.19710 = end == 0B;
  D.19711 = D.19709 & D.19710;
  if (D.19711 != 0) goto <D.19707>; else goto <D.19712>;
  <D.19712>:
  if (start > end) goto <D.19707>; else goto <D.19708>;
  <D.19707>:
  monoeg_g_log (0B, 4, "Invalid range [%p %p]", start, end);
  <D.19436>:
  goto <D.19436>;
  <D.19708>:
  if (size <= 31) goto <D.19713>; else goto <D.19714>;
  <D.19713>:
  memset (start, 0, size);
  return;
  <D.19714>:
  o = start;
  D.19715 = sgen_get_array_fill_vtable ();
  o->obj.vtable = D.19715;
  o->obj.synchronisation = -1B;
  o->bounds = 0B;
  D.19716 = (unsigned int) size;
  D.19717 = D.19716 + 4294967264;
  o->max_length = D.19717;
  sgen_set_nursery_scan_start (start);
  D.19718 = sgen_safe_object_get_size (o);
  D.19719 = (sizetype) D.19718;
  D.19720 = start + D.19719;
  D.19721 = D.19720 != end;
  D.19722 = (long int) D.19721;
  D.19723 = __builtin_expect (D.19722, 0);
  if (D.19723 != 0) goto <D.19724>; else goto <D.19725>;
  <D.19724>:
  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.19725>:
}


sgen_set_nursery_scan_start (char * p)
{
  long int p.14;
  struct GCMemSection * nursery_section.15;
  char * D.19729;
  long int D.19730;
  long int D.19731;
  long int D.19732;
  char * * D.19733;
  long unsigned int D.19734;
  long unsigned int D.19735;
  char * * D.19736;
  _Bool D.19737;
  _Bool D.19738;
  _Bool D.19739;
  int idx;
  char * old;

  p.14 = (long int) p;
  nursery_section.15 = nursery_section;
  D.19729 = nursery_section.15->data;
  D.19730 = (long int) D.19729;
  D.19731 = p.14 - D.19730;
  D.19732 = D.19731 / 8192;
  idx = (int) D.19732;
  nursery_section.15 = nursery_section;
  D.19733 = nursery_section.15->scan_starts;
  D.19734 = (long unsigned int) idx;
  D.19735 = D.19734 * 8;
  D.19736 = D.19733 + D.19735;
  old = *D.19736;
  D.19737 = old == 0B;
  D.19738 = old > p;
  D.19739 = D.19737 | D.19738;
  if (D.19739 != 0) goto <D.19740>; else goto <D.19741>;
  <D.19740>:
  nursery_section.15 = nursery_section;
  D.19733 = nursery_section.15->scan_starts;
  D.19734 = (long unsigned int) idx;
  D.19735 = D.19734 * 8;
  D.19736 = D.19733 + D.19735;
  *D.19736 = p;
  <D.19741>:
}


sgen_safe_object_get_size (struct MonoObject * obj)
{
  char * iftmp.16;
  long unsigned int D.19743;
  long unsigned int D.19744;
  long unsigned int D.19747;
  guint D.19751;
  struct MonoVTable * D.19752;
  char * forwarded;

  D.19743 = MEM[(mword *)obj];
  D.19744 = D.19743 & 1;
  if (D.19744 != 0) goto <D.19745>; else goto <D.19746>;
  <D.19745>:
  D.19743 = MEM[(mword *)obj];
  D.19747 = D.19743 & 18446744073709551612;
  iftmp.16 = (char *) D.19747;
  goto <D.19748>;
  <D.19746>:
  iftmp.16 = 0B;
  <D.19748>:
  forwarded = iftmp.16;
  if (forwarded != 0B) goto <D.19749>; else goto <D.19750>;
  <D.19749>:
  obj = forwarded;
  <D.19750>:
  D.19743 = MEM[(mword *)obj];
  D.19747 = D.19743 & 18446744073709551612;
  D.19752 = (struct MonoVTable *) D.19747;
  D.19751 = sgen_par_object_get_size (D.19752, obj);
  return D.19751;
}


sgen_par_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  void * D.19754;
  long unsigned int D.19755;
  guint D.19760;
  int D.19761;
  int D.19762;
  unsigned int D.19763;
  long unsigned int D.19766;
  int D.19767;
  unsigned int D.19768;
  unsigned int element_size.17;
  unsigned int D.19770;
  long unsigned int D.19771;
  long unsigned int D.19772;
  struct MonoClass * D.19775;
  unsigned char D.19776;
  long unsigned int D.19777;
  long unsigned int D.19778;
  mword descr;
  mword type;

  D.19754 = vtable->gc_descr;
  descr = (mword) D.19754;
  type = descr & 7;
  D.19755 = type + 18446744073709551615;
  if (D.19755 <= 1) goto <D.19756>; else goto <D.19757>;
  <D.19756>:
  {
    mword size;

    size = descr & 65528;
    if (size == 0) goto <D.19758>; else goto <D.19759>;
    <D.19758>:
    D.19761 = MEM[(struct MonoString *)o].length;
    D.19762 = D.19761 * 2;
    D.19763 = (unsigned int) D.19762;
    D.19760 = D.19763 + 26;
    return D.19760;
    <D.19759>:
    D.19760 = (guint) size;
    return D.19760;
  }
  <D.19757>:
  if (type == 4) goto <D.19764>; else goto <D.19765>;
  <D.19764>:
  {
    int element_size;
    struct MonoArray * array;
    size_t size;

    D.19766 = descr >> 3;
    D.19767 = (int) D.19766;
    element_size = D.19767 & 1023;
    array = o;
    D.19768 = array->max_length;
    element_size.17 = (unsigned int) element_size;
    D.19770 = D.19768 * element_size.17;
    D.19771 = (long unsigned int) D.19770;
    size = D.19771 + 32;
    D.19772 = descr & 8192;
    if (D.19772 != 0) goto <D.19773>; else goto <D.19774>;
    <D.19773>:
    size = size + 3;
    size = size & 18446744073709551612;
    D.19775 = vtable->klass;
    D.19776 = D.19775->rank;
    D.19777 = (long unsigned int) D.19776;
    D.19778 = D.19777 * 8;
    size = D.19778 + size;
    <D.19774>:
    D.19760 = (guint) size;
    return D.19760;
  }
  <D.19765>:
  D.19760 = slow_object_get_size (vtable, o);
  return D.19760;
}


slow_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  struct MonoClass * D.19780;
  guint D.19783;
  int D.19784;
  int D.19785;
  unsigned int D.19786;
  unsigned char D.19787;
  int D.19790;
  unsigned int D.19791;
  unsigned int D.19792;
  unsigned int D.19793;
  long unsigned int D.19794;
  struct MonoArrayBounds * D.19795;
  _Bool D.19796;
  long int D.19797;
  long int D.19798;
  long unsigned int D.19801;
  long unsigned int D.19802;
  int D.19803;
  struct MonoClass * klass;

  klass = vtable->klass;
  D.19780 = mono_defaults.string_class;
  if (D.19780 == klass) goto <D.19781>; else goto <D.19782>;
  <D.19781>:
  D.19784 = MEM[(struct MonoString *)o].length;
  D.19785 = D.19784 * 2;
  D.19786 = (unsigned int) D.19785;
  D.19783 = D.19786 + 26;
  return D.19783;
  <D.19782>:
  D.19787 = klass->rank;
  if (D.19787 != 0) goto <D.19788>; else goto <D.19789>;
  <D.19788>:
  {
    struct MonoArray * array;
    size_t size;

    array = o;
    D.19790 = klass->sizes.element_size;
    D.19791 = (unsigned int) D.19790;
    D.19792 = array->max_length;
    D.19793 = D.19791 * D.19792;
    D.19794 = (long unsigned int) D.19793;
    size = D.19794 + 32;
    D.19795 = array->bounds;
    D.19796 = D.19795 != 0B;
    D.19797 = (long int) D.19796;
    D.19798 = __builtin_expect (D.19797, 0);
    if (D.19798 != 0) goto <D.19799>; else goto <D.19800>;
    <D.19799>:
    size = size + 3;
    size = size & 18446744073709551612;
    D.19787 = klass->rank;
    D.19801 = (long unsigned int) D.19787;
    D.19802 = D.19801 * 8;
    size = D.19802 + size;
    <D.19800>:
    D.19783 = (guint) size;
    return D.19783;
  }
  <D.19789>:
  D.19803 = klass->instance_size;
  D.19783 = (guint) D.19803;
  return D.19783;
}


sgen_nursery_allocator_prepare_for_pinning ()
{
  void (*<T7e7>) (void) D.19805;

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


sgen_build_nursery_fragments (struct GCMemSection * nursery_section, void * * start, int num_entries, struct SgenGrayQueue * unpin_queue)
{
  struct SgenFragment * (*<T2cb6>) (void) D.19806;
  unsigned int D.19807;
  long unsigned int D.19808;
  long unsigned int D.19809;
  char * * D.19810;
  long unsigned int D.19813;
  long unsigned int D.19814;
  void * * D.19815;
  int iftmp.18;
  struct GrayQueueSection * D.19826;
  int D.19828;
  _Bool D.19829;
  long int D.19830;
  long int D.19831;
  int D.19835;
  int D.19836;
  long unsigned int D.19838;
  long unsigned int D.19839;
  unsigned int D.19840;
  unsigned int D.19841;
  long unsigned int D.19842;
  char * D.19844;
  long int D.19845;
  long int addr1.19;
  long int D.19847;
  long int frag_end.20;
  long int frag_start.21;
  long int D.19850;
  _Bool D.19855;
  long int D.19856;
  long int D.19857;
  _Bool D.19860;
  _Bool D.19861;
  _Bool D.19862;
  _Bool D.19865;
  _Bool D.19866;
  _Bool D.19867;
  void (*<T7e7>) (void) D.19870;
  void (*<T2cbb>) (struct SgenFragmentAllocator *) D.19871;
  struct SgenFragment * D.19872;
  void * D.19873;
  int gc_debug_level.22;
  _Bool D.19877;
  long int D.19878;
  long int D.19879;
  struct FILE * gc_debug_file.23;
  void * D.19885;
  unsigned int D.19886;
  const char * D.19887;
  mword D.19888;
  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.19806 = sgen_minor_collector.build_fragments_get_exclude_head;
  frags_ranges = D.19806 ();
  D.19807 = nursery_section->num_scan_start;
  D.19808 = (long unsigned int) D.19807;
  D.19809 = D.19808 * 8;
  D.19810 = nursery_section->scan_starts;
  memset (D.19810, 0, D.19809);
  goto <D.19471>;
  <D.19472>:
  {
    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.19811>; else goto <D.19812>;
    <D.19811>:
    D.19813 = (long unsigned int) i;
    D.19814 = D.19813 * 8;
    D.19815 = start + D.19814;
    addr0 = *D.19815;
    <D.19812>:
    if (frags_ranges != 0B) goto <D.19816>; else goto <D.19817>;
    <D.19816>:
    addr1 = frags_ranges->fragment_start;
    <D.19817>:
    if (addr0 < addr1) goto <D.19818>; else goto <D.19819>;
    <D.19818>:
    if (unpin_queue != 0B) goto <D.19820>; else goto <D.19821>;
    <D.19820>:
    D.19826 = unpin_queue->first;
    if (D.19826 == 0B) goto <D.19823>; else goto <D.19827>;
    <D.19827>:
    D.19826 = unpin_queue->first;
    D.19828 = D.19826->end;
    if (D.19828 == 125) goto <D.19823>; else goto <D.19824>;
    <D.19823>:
    iftmp.18 = 1;
    goto <D.19825>;
    <D.19824>:
    iftmp.18 = 0;
    <D.19825>:
    D.19829 = iftmp.18 != 0;
    D.19830 = (long int) D.19829;
    D.19831 = __builtin_expect (D.19830, 0);
    if (D.19831 != 0) goto <D.19832>; else goto <D.19833>;
    <D.19832>:
    sgen_gray_object_enqueue (unpin_queue, addr0);
    goto <D.19834>;
    <D.19833>:
    D.19826 = unpin_queue->first;
    D.19826 = unpin_queue->first;
    D.19828 = D.19826->end;
    D.19835 = D.19828;
    D.19836 = D.19835 + 1;
    D.19826->end = D.19836;
    D.19826->objects[D.19835] = addr0;
    <D.19834>:
    __builtin_prefetch (addr0);
    goto <D.19837>;
    <D.19821>:
    D.19838 = MEM[(mword *)addr0];
    D.19839 = D.19838 & 18446744073709551613;
    MEM[(mword *)addr0] = D.19839;
    <D.19837>:
    sgen_set_nursery_scan_start (addr0);
    frag_end = addr0;
    D.19840 = sgen_safe_object_get_size (addr0);
    D.19841 = D.19840 + 7;
    D.19842 = (long unsigned int) D.19841;
    size = D.19842 & 4294967288;
    i = i + 1;
    goto <D.19843>;
    <D.19819>:
    frag_end = addr1;
    D.19844 = frags_ranges->fragment_next;
    D.19845 = (long int) D.19844;
    addr1.19 = (long int) addr1;
    D.19847 = D.19845 - addr1.19;
    size = (size_t) D.19847;
    last_frag = frags_ranges;
    frags_ranges = frags_ranges->next_in_order;
    <D.19843>:
    frag_end.20 = (long int) frag_end;
    frag_start.21 = (long int) frag_start;
    D.19850 = frag_end.20 - frag_start.21;
    frag_size = (size_t) D.19850;
    if (size == 0) goto <D.19851>; else goto <D.19852>;
    <D.19851>:
    // predicted unlikely by continue predictor.
    goto <D.19471>;
    <D.19852>:
    if (0 != 0) goto <D.19853>; else goto <D.19854>;
    <D.19853>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 802, "frag_size >= 0");
    <D.19854>:
    D.19855 = size == 0;
    D.19856 = (long int) D.19855;
    D.19857 = __builtin_expect (D.19856, 0);
    if (D.19857 != 0) goto <D.19858>; else goto <D.19859>;
    <D.19858>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 803, "size > 0");
    <D.19859>:
    D.19860 = frag_size != 0;
    D.19861 = size != 0;
    D.19862 = D.19860 & D.19861;
    if (D.19862 != 0) goto <D.19863>; else goto <D.19864>;
    <D.19863>:
    add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
    <D.19864>:
    frag_size = size;
    frag_start = frag_end + frag_size;
  }
  <D.19471>:
  D.19865 = i < num_entries;
  D.19866 = frags_ranges != 0B;
  D.19867 = D.19865 | D.19866;
  if (D.19867 != 0) goto <D.19472>; else goto <D.19473>;
  <D.19473>:
  nursery_last_pinned_end = frag_start;
  frag_end = sgen_nursery_end;
  frag_end.20 = (long int) frag_end;
  frag_start.21 = (long int) frag_start;
  D.19850 = frag_end.20 - frag_start.21;
  frag_size = (size_t) D.19850;
  if (frag_size != 0) goto <D.19868>; else goto <D.19869>;
  <D.19868>:
  add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
  <D.19869>:
  D.19870 = sgen_minor_collector.build_fragments_release_exclude_head;
  D.19870 ();
  fragment_list_reverse (&mutator_allocator);
  D.19871 = sgen_minor_collector.build_fragments_finish;
  D.19871 (&mutator_allocator);
  D.19872 = mutator_allocator.alloc_head;
  D.19873 = unmask (D.19872);
  if (D.19873 == 0B) goto <D.19874>; else goto <D.19875>;
  <D.19874>:
  gc_debug_level.22 = gc_debug_level;
  D.19877 = gc_debug_level.22 > 0;
  D.19878 = (long int) D.19877;
  D.19879 = __builtin_expect (D.19878, 0);
  if (D.19879 != 0) goto <D.19880>; else goto <D.19881>;
  <D.19880>:
  gc_debug_file.23 = gc_debug_file;
  fprintf (gc_debug_file.23, "Nursery fully pinned (%d)\n", num_entries);
  gc_debug_file.23 = gc_debug_file;
  fflush (gc_debug_file.23);
  <D.19881>:
  i = 0;
  goto <D.19475>;
  <D.19474>:
  if (0 != 0) goto <D.19883>; else goto <D.19884>;
  <D.19883>:
  D.19813 = (long unsigned int) i;
  D.19814 = D.19813 * 8;
  D.19815 = start + D.19814;
  D.19885 = *D.19815;
  D.19886 = sgen_safe_object_get_size (D.19885);
  D.19813 = (long unsigned int) i;
  D.19814 = D.19813 * 8;
  D.19815 = start + D.19814;
  D.19885 = *D.19815;
  D.19887 = sgen_safe_name (D.19885);
  D.19813 = (long unsigned int) i;
  D.19814 = D.19813 * 8;
  D.19815 = start + D.19814;
  D.19885 = *D.19815;
  gc_debug_file.23 = gc_debug_file;
  fprintf (gc_debug_file.23, "Bastard pinning obj %p (%s), size: %d\n", D.19885, D.19887, D.19886);
  gc_debug_file.23 = gc_debug_file;
  fflush (gc_debug_file.23);
  <D.19884>:
  i = i + 1;
  <D.19475>:
  if (i < num_entries) goto <D.19474>; else goto <D.19476>;
  <D.19476>:
  <D.19875>:
  D.19888 = fragment_total;
  return D.19888;
}


add_nursery_frag (struct SgenFragmentAllocator * allocator, size_t frag_size, char * frag_start, char * frag_end)
{
  struct FILE * gc_debug_file.24;
  <unnamed type> D.19895;
  long unsigned int fragment_total.25;
  long unsigned int fragment_total.26;

  if (0 != 0) goto <D.19890>; else goto <D.19891>;
  <D.19890>:
  gc_debug_file.24 = gc_debug_file;
  fprintf (gc_debug_file.24, "Found empty fragment: %p-%p, size: %zd\n", frag_start, frag_end, frag_size);
  gc_debug_file.24 = gc_debug_file;
  fflush (gc_debug_file.24);
  <D.19891>:
  if (frag_size > 511) goto <D.19893>; else goto <D.19894>;
  <D.19893>:
  D.19895 = sgen_get_nursery_clear_policy ();
  if (D.19895 == 0) goto <D.19896>; else goto <D.19897>;
  <D.19896>:
  memset (frag_start, 0, frag_size);
  <D.19897>:
  sgen_fragment_allocator_add (allocator, frag_start, frag_end);
  fragment_total.25 = fragment_total;
  fragment_total.26 = fragment_total.25 + frag_size;
  fragment_total = fragment_total.26;
  goto <D.19900>;
  <D.19894>:
  sgen_clear_range (frag_start, frag_end);
  <D.19900>:
}


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

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

    next = list->next;
    list->next = prev;
    list->next_in_order = prev;
    prev = list;
    list = next;
  }
  <D.19454>:
  if (list != 0B) goto <D.19453>; else goto <D.19455>;
  <D.19455>:
  allocator->alloc_head = prev;
  D.19901 = allocator->alloc_head;
  allocator->region_head = D.19901;
}


fprintf (struct FILE * restrict __stream, const char * restrict __fmt)
{
  int D.19902;

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


sgen_nursery_alloc_get_upper_alloc_bound ()
{
  char * D.19904;

  D.19904 = sgen_nursery_end;
  return D.19904;
}


sgen_nursery_retire_region (void * address, ptrdiff_t size)
{

}


sgen_can_alloc_size (size_t size)
{
  long unsigned int D.19906;
  struct SgenFragment * D.19907;
  char * D.19908;
  long int D.19909;
  char * D.19910;
  long int D.19911;
  long int D.19912;
  long unsigned int D.19913;
  gboolean D.19916;
  struct SgenFragment * D.19917;
  struct SgenFragment * frag;

  D.19906 = size + 7;
  size = D.19906 & 18446744073709551608;
  D.19907 = mutator_allocator.alloc_head;
  frag = unmask (D.19907);
  goto <D.19489>;
  <D.19488>:
  D.19908 = frag->fragment_end;
  D.19909 = (long int) D.19908;
  D.19910 = frag->fragment_next;
  D.19911 = (long int) D.19910;
  D.19912 = D.19909 - D.19911;
  D.19913 = (long unsigned int) D.19912;
  if (D.19913 >= size) goto <D.19914>; else goto <D.19915>;
  <D.19914>:
  D.19916 = 1;
  return D.19916;
  <D.19915>:
  D.19917 = frag->next;
  frag = unmask (D.19917);
  <D.19489>:
  if (frag != 0B) goto <D.19488>; else goto <D.19490>;
  <D.19490>:
  D.19916 = 0;
  return D.19916;
}


sgen_nursery_alloc (size_t size)
{
  struct FILE * gc_debug_file.27;
  long unsigned int D.19922;
  void * D.19923;

  if (0 != 0) goto <D.19919>; else goto <D.19920>;
  <D.19919>:
  gc_debug_file.27 = gc_debug_file;
  fprintf (gc_debug_file.27, "Searching nursery for size: %zd\n", size);
  gc_debug_file.27 = gc_debug_file;
  fflush (gc_debug_file.27);
  <D.19920>:
  D.19922 = size + 7;
  size = D.19922 & 18446744073709551608;
  D.19923 = sgen_fragment_allocator_par_alloc (&mutator_allocator, size);
  return D.19923;
}


sgen_nursery_alloc_range (size_t desired_size, size_t minimum_size, size_t * out_alloc_size)
{
  struct FILE * gc_debug_file.28;
  void * D.19928;

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


sgen_init_nursery_allocator ()
{
  sgen_register_fixed_internal_mem_type (1, 40);
}


sgen_nursery_alloc_prepare_for_minor ()
{
  void (*<T2cb2>) (char *, int) D.19930;
  int sgen_space_bitmap_size.29;
  char * sgen_space_bitmap.30;

  D.19930 = sgen_minor_collector.prepare_to_space;
  sgen_space_bitmap_size.29 = sgen_space_bitmap_size;
  sgen_space_bitmap.30 = sgen_space_bitmap;
  D.19930 (sgen_space_bitmap.30, sgen_space_bitmap_size.29);
}


sgen_nursery_alloc_prepare_for_major ()
{
  void (*<T2cb2>) (char *, int) D.19933;
  int sgen_space_bitmap_size.31;
  char * sgen_space_bitmap.32;

  D.19933 = sgen_minor_collector.prepare_to_space;
  sgen_space_bitmap_size.31 = sgen_space_bitmap_size;
  sgen_space_bitmap.32 = sgen_space_bitmap;
  D.19933 (sgen_space_bitmap.32, sgen_space_bitmap_size.31);
}


sgen_nursery_allocator_set_nursery_bounds (char * start, char * end)
{
  long int end.33;
  long int start.34;
  long int D.19938;
  long int D.19939;
  int sgen_space_bitmap_size.35;
  int sgen_space_bitmap_size.36;
  long unsigned int D.19942;
  void * sgen_space_bitmap.37;
  void (*<T2cbf>) (struct SgenFragmentAllocator *, char *, char *) D.19944;

  sgen_nursery_start = start;
  sgen_nursery_end = end;
  end.33 = (long int) end;
  start.34 = (long int) start;
  D.19938 = end.33 - start.34;
  D.19939 = D.19938 / 4096;
  sgen_space_bitmap_size.35 = (int) D.19939;
  sgen_space_bitmap_size = sgen_space_bitmap_size.35;
  sgen_space_bitmap_size.36 = sgen_space_bitmap_size;
  D.19942 = (long unsigned int) sgen_space_bitmap_size.36;
  sgen_space_bitmap.37 = monoeg_malloc0 (D.19942);
  sgen_space_bitmap = sgen_space_bitmap.37;
  D.19944 = sgen_minor_collector.init_nursery;
  D.19944 (&mutator_allocator, start, end);
}


