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

  frag = fragment_freelist;
  if (frag != 0B) goto <D.19128>; else goto <D.19129>;
  <D.19128>:
  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.19131 = frag;
  return D.19131;
  <D.19129>:
  frag = sgen_alloc_internal (1);
  frag->next_in_order = 0B;
  fragment_freelist.0 = frag->next_in_order;
  frag->next = fragment_freelist.0;
  D.19131 = frag;
  return D.19131;
}


sgen_fragment_allocator_add (struct SgenFragmentAllocator * allocator, char * start, char * end)
{
  struct SgenFragment * D.19133;
  void * D.19134;
  struct SgenFragment * D.19135;
  struct SgenFragment * D.19136;
  char * D.19137;
  char * D.19138;
  _Bool D.19139;
  long int D.19140;
  long int D.19141;
  struct SgenFragment * fragment;

  fragment = sgen_fragment_allocator_alloc ();
  fragment->fragment_start = start;
  fragment->fragment_next = start;
  fragment->fragment_end = end;
  D.19133 = allocator->region_head;
  D.19134 = unmask (D.19133);
  fragment->next = D.19134;
  D.19135 = fragment->next;
  fragment->next_in_order = D.19135;
  allocator->alloc_head = fragment;
  D.19136 = allocator->alloc_head;
  allocator->region_head = D.19136;
  D.19137 = fragment->fragment_end;
  D.19138 = fragment->fragment_start;
  D.19139 = D.19137 <= D.19138;
  D.19140 = (long int) D.19139;
  D.19141 = __builtin_expect (D.19140, 0);
  if (D.19141 != 0) goto <D.19142>; else goto <D.19143>;
  <D.19142>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 293, "fragment->fragment_end > fragment->fragment_start");
  <D.19143>:
}


unmask (void * p)
{
  void * D.19144;
  unsigned int p.1;
  unsigned int D.19146;

  p.1 = (unsigned int) p;
  D.19146 = p.1 & 4294967292;
  D.19144 = (void *) D.19146;
  return D.19144;
}


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

  last = allocator->region_head;
  if (last == 0B) goto <D.19148>; else goto <D.19149>;
  <D.19148>:
  return;
  <D.19149>:
  goto <D.18946>;
  <D.18945>:
  last = last->next_in_order;
  <D.18946>:
  D.19150 = last->next_in_order;
  if (D.19150 != 0B) goto <D.18945>; else goto <D.18947>;
  <D.18947>:
  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.19154;
  char * D.19155;
  int D.19156;
  char * D.19157;
  int D.19158;
  int D.19159;
  unsigned int D.19160;
  void * D.19164;
  struct SgenFragment * D.19165;
  void * D.19166;
  struct SgenFragment * frag;
  void restart = <<< error >>>;

  restart:
  D.19154 = allocator->alloc_head;
  frag = unmask (D.19154);
  goto <D.18988>;
  <D.18987>:
  D.19155 = frag->fragment_end;
  D.19156 = (int) D.19155;
  D.19157 = frag->fragment_next;
  D.19158 = (int) D.19157;
  D.19159 = D.19156 - D.19158;
  D.19160 = (unsigned int) D.19159;
  if (D.19160 >= size) goto <D.19161>; else goto <D.19162>;
  <D.19161>:
  {
    void * p;

    p = par_alloc_from_fragment (allocator, frag, size);
    if (p == 0B) goto restart; else goto <D.19163>;
    <D.19163>:
    D.19164 = p;
    return D.19164;
  }
  <D.19162>:
  D.19165 = frag->next;
  frag = unmask (D.19165);
  <D.18988>:
  D.19166 = unmask (frag);
  if (D.19166 != 0B) goto <D.18987>; else goto <D.18989>;
  <D.18989>:
  D.19164 = 0B;
  return D.19164;
}


par_alloc_from_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag, size_t size)
{
  char * D.19168;
  void * D.19171;
  char * * D.19172;
  void * D.19173;
  int D.19176;
  int end.4;
  int D.19178;
  <unnamed type> D.19181;
  int D.19184;
  unsigned int D.19187;
  struct SgenFragment * * D.19190;
  void * D.19191;
  void * D.19192;
  void * D.19195;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19168 = frag->fragment_end;
  if (D.19168 < end) goto <D.19169>; else goto <D.19170>;
  <D.19169>:
  D.19171 = 0B;
  return D.19171;
  <D.19170>:
  mono_memory_barrier ();
  D.19172 = &frag->fragment_next;
  D.19173 = InterlockedCompareExchangePointer (D.19172, end, p);
  if (D.19173 != p) goto <D.19174>; else goto <D.19175>;
  <D.19174>:
  D.19171 = 0B;
  return D.19171;
  <D.19175>:
  D.19168 = frag->fragment_end;
  D.19176 = (int) D.19168;
  end.4 = (int) end;
  D.19178 = D.19176 - end.4;
  if (D.19178 <= 511) goto <D.19179>; else goto <D.19180>;
  <D.19179>:
  {
    struct SgenFragment * next;
    struct SgenFragment * * prev_ptr;

    D.19181 = sgen_get_nursery_clear_policy ();
    if (D.19181 == 1) goto <D.19182>; else goto <D.19183>;
    <D.19182>:
    D.19184 = claim_remaining_size (frag, end);
    if (D.19184 != 0) goto <D.19185>; else goto <D.19186>;
    <D.19185>:
    D.19168 = frag->fragment_end;
    sgen_clear_range (end, D.19168);
    <D.19186>:
    <D.19183>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    goto <D.18970>;
    <D.18972>:
    next = frag->next;
    D.19187 = get_mark (next);
    if (D.19187 == 0) goto <D.19188>; else goto <D.19189>;
    <D.19188>:
    mono_memory_write_barrier ();
    D.19190 = &frag->next;
    D.19191 = mask (next, 1);
    D.19192 = InterlockedCompareExchangePointer (D.19190, D.19191, next);
    if (D.19192 != next) goto <D.19193>; else goto <D.19194>;
    <D.19193>:
    // predicted unlikely by continue predictor.
    goto <D.18970>;
    <D.19194>:
    <D.19189>:
    mono_memory_write_barrier ();
    D.19195 = InterlockedCompareExchangePointer (prev_ptr, next, frag);
    if (D.19195 != frag) goto <D.19196>; else goto <D.19197>;
    <D.19196>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    // predicted unlikely by continue predictor.
    goto <D.18970>;
    <D.19197>:
    goto <D.18971>;
    <D.18970>:
    if (prev_ptr != 0B) goto <D.18972>; else goto <D.18971>;
    <D.18971>:
  }
  <D.19180>:
  D.19171 = p;
  return D.19171;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


claim_remaining_size (struct SgenFragment * frag, char * alloc_end)
{
  char * D.19199;
  gboolean D.19202;
  char * * D.19203;
  void * D.19204;
  _Bool D.19205;

  D.19199 = frag->fragment_end;
  if (D.19199 <= alloc_end) goto <D.19200>; else goto <D.19201>;
  <D.19200>:
  D.19202 = 0;
  return D.19202;
  <D.19201>:
  D.19203 = &frag->fragment_next;
  D.19199 = frag->fragment_end;
  D.19204 = InterlockedCompareExchangePointer (D.19203, D.19199, alloc_end);
  D.19205 = D.19204 == alloc_end;
  D.19202 = (gboolean) D.19205;
  return D.19202;
}


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

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


mask (void * n, uintptr_t bit)
{
  void * D.19210;
  unsigned int n.6;
  unsigned int D.19212;

  n.6 = (unsigned int) n;
  D.19212 = n.6 | bit;
  D.19210 = (void *) D.19212;
  return D.19210;
}


mono_memory_write_barrier ()
{
  mono_memory_barrier ();
}


InterlockedCompareExchangePointer (void * volatile * dest, void * exch, void * comp)
{
  void * D.19214;
  unsigned int comp.7;
  unsigned int exch.8;
  unsigned int D.19217;

  comp.7 = (unsigned int) comp;
  exch.8 = (unsigned int) exch;
  D.19217 = __sync_val_compare_and_swap_4 (dest, comp.7, exch.8);
  D.19214 = (void *) D.19217;
  return D.19214;
}


find_previous_pointer_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag)
{
  struct SgenFragment * D.19219;
  struct SgenFragment * * D.19222;
  unsigned int D.19224;
  void * D.19230;
  struct SgenFragment * * prev;
  struct SgenFragment * cur;
  struct SgenFragment * next;
  void try_again = <<< error >>>;

  try_again:
  prev = &allocator->alloc_head;
  D.19219 = *prev;
  cur = unmask (D.19219);
  <D.18956>:
  if (cur == 0B) goto <D.19220>; else goto <D.19221>;
  <D.19220>:
  D.19222 = 0B;
  return D.19222;
  <D.19221>:
  next = cur->next;
  mono_memory_read_barrier ();
  D.19219 = *prev;
  if (D.19219 != cur) goto try_again; else goto <D.19223>;
  <D.19223>:
  D.19224 = get_mark (next);
  if (D.19224 == 0) goto <D.19225>; else goto <D.19226>;
  <D.19225>:
  if (cur == frag) goto <D.19227>; else goto <D.19228>;
  <D.19227>:
  D.19222 = prev;
  return D.19222;
  <D.19228>:
  prev = &cur->next;
  goto <D.19229>;
  <D.19226>:
  next = unmask (next);
  D.19230 = InterlockedCompareExchangePointer (prev, next, cur);
  if (D.19230 != cur) goto try_again; else goto <D.19231>;
  <D.19231>:
  mono_memory_write_barrier ();
  <D.19229>:
  cur = mono_lls_pointer_unmask (next);
  goto <D.18956>;
  D.19222 = 0B;
  return D.19222;
}


mono_memory_read_barrier ()
{
  mono_memory_barrier ();
}


mono_lls_pointer_unmask (void * p)
{
  void * D.19233;
  unsigned int p.9;
  unsigned int D.19235;

  p.9 = (unsigned int) p;
  D.19235 = p.9 & 4294967292;
  D.19233 = (void *) D.19235;
  return D.19233;
}


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

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

    p = serial_alloc_from_fragment (previous, frag, size);
    if (p != 0B) goto <D.19237>; else goto <D.19238>;
    <D.19237>:
    D.19239 = p;
    return D.19239;
    <D.19238>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.18998>:
  if (frag != 0B) goto <D.18997>; else goto <D.18999>;
  <D.18999>:
  D.19239 = 0B;
  return D.19239;
}


serial_alloc_from_fragment (struct SgenFragment * * previous, struct SgenFragment * frag, size_t size)
{
  char * D.19241;
  void * D.19244;
  int D.19245;
  int end.10;
  int D.19247;
  struct SgenFragment * D.19250;
  unsigned int D.19251;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19241 = frag->fragment_end;
  if (D.19241 < end) goto <D.19242>; else goto <D.19243>;
  <D.19242>:
  D.19244 = 0B;
  return D.19244;
  <D.19243>:
  frag->fragment_next = end;
  D.19241 = frag->fragment_end;
  D.19245 = (int) D.19241;
  end.10 = (int) end;
  D.19247 = D.19245 - end.10;
  if (D.19247 <= 511) goto <D.19248>; else goto <D.19249>;
  <D.19248>:
  D.19250 = frag->next;
  *previous = D.19250;
  D.19241 = frag->fragment_end;
  D.19245 = (int) D.19241;
  end.10 = (int) end;
  D.19247 = D.19245 - end.10;
  D.19251 = (unsigned int) D.19247;
  memset (end, 0, D.19251);
  D.19250 = frag->next;
  *previous = D.19250;
  <D.19249>:
  D.19244 = p;
  return D.19244;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.19255;
  int D.19260;
  void * D.19262;
  unsigned int D.19263;

  D.19255 = __builtin_constant_p (__len);
  if (D.19255 != 0) goto <D.19256>; else goto <D.19257>;
  <D.19256>:
  if (__len == 0) goto <D.19258>; else goto <D.19259>;
  <D.19258>:
  D.19260 = __builtin_constant_p (__ch);
  if (D.19260 == 0) goto <D.19253>; else goto <D.19261>;
  <D.19261>:
  if (__ch != 0) goto <D.19253>; else goto <D.19254>;
  <D.19253>:
  __warn_memset_zero_len ();
  D.19262 = __dest;
  return D.19262;
  <D.19254>:
  <D.19259>:
  <D.19257>:
  D.19263 = __builtin_object_size (__dest, 0);
  D.19262 = __builtin___memset_chk (__dest, __ch, __len, D.19263);
  return D.19262;
}


sgen_fragment_allocator_serial_range_alloc (struct SgenFragmentAllocator * allocator, size_t desired_size, size_t minimum_size, size_t * out_alloc_size)
{
  char * D.19265;
  int D.19266;
  char * D.19267;
  int D.19268;
  int D.19269;
  void * D.19272;
  char * D.19277;
  int D.19278;
  char * D.19279;
  int D.19280;
  int D.19281;
  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.19014>;
  <D.19013>:
  {
    size_t frag_size;

    D.19265 = frag->fragment_end;
    D.19266 = (int) D.19265;
    D.19267 = frag->fragment_next;
    D.19268 = (int) D.19267;
    D.19269 = D.19266 - D.19268;
    frag_size = (size_t) D.19269;
    if (desired_size <= frag_size) goto <D.19270>; else goto <D.19271>;
    <D.19270>:
    {
      void * p;

      *out_alloc_size = desired_size;
      p = serial_alloc_from_fragment (previous, frag, desired_size);
      D.19272 = p;
      return D.19272;
    }
    <D.19271>:
    if (current_minimum <= frag_size) goto <D.19273>; else goto <D.19274>;
    <D.19273>:
    min_frag = frag;
    prev_min_frag = previous;
    current_minimum = frag_size;
    <D.19274>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.19014>:
  if (frag != 0B) goto <D.19013>; else goto <D.19015>;
  <D.19015>:
  if (min_frag != 0B) goto <D.19275>; else goto <D.19276>;
  <D.19275>:
  {
    void * p;
    size_t frag_size;

    D.19277 = min_frag->fragment_end;
    D.19278 = (int) D.19277;
    D.19279 = min_frag->fragment_next;
    D.19280 = (int) D.19279;
    D.19281 = D.19278 - D.19280;
    frag_size = (size_t) D.19281;
    *out_alloc_size = frag_size;
    p = serial_alloc_from_fragment (prev_min_frag, min_frag, frag_size);
    D.19272 = p;
    return D.19272;
  }
  <D.19276>:
  D.19272 = 0B;
  return D.19272;
}


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.19283;
  char * D.19284;
  int D.19285;
  char * D.19286;
  int D.19287;
  unsigned int frag_size.11;
  void * D.19292;
  struct SgenFragment * D.19295;
  char * D.19298;
  int D.19299;
  char * D.19300;
  int D.19301;
  unsigned int frag_size.12;
  struct SgenFragment * frag;
  struct SgenFragment * min_frag;
  size_t current_minimum;
  void restart = <<< error >>>;

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

    D.19284 = frag->fragment_end;
    D.19285 = (int) D.19284;
    D.19286 = frag->fragment_next;
    D.19287 = (int) D.19286;
    frag_size = D.19285 - D.19287;
    frag_size.11 = (unsigned int) frag_size;
    if (frag_size.11 >= desired_size) goto <D.19289>; else goto <D.19290>;
    <D.19289>:
    {
      void * p;

      *out_alloc_size = desired_size;
      p = par_alloc_from_fragment (allocator, frag, desired_size);
      if (p == 0B) goto restart; else goto <D.19291>;
      <D.19291>:
      D.19292 = p;
      return D.19292;
    }
    <D.19290>:
    frag_size.11 = (unsigned int) frag_size;
    if (frag_size.11 >= current_minimum) goto <D.19293>; else goto <D.19294>;
    <D.19293>:
    min_frag = frag;
    current_minimum = (size_t) frag_size;
    <D.19294>:
  }
  D.19295 = frag->next;
  frag = unmask (D.19295);
  <D.19031>:
  if (frag != 0B) goto <D.19030>; else goto <D.19032>;
  <D.19032>:
  mono_memory_barrier ();
  if (min_frag != 0B) goto <D.19296>; else goto <D.19297>;
  <D.19296>:
  {
    void * p;
    int frag_size;

    D.19298 = min_frag->fragment_end;
    D.19299 = (int) D.19298;
    D.19300 = min_frag->fragment_next;
    D.19301 = (int) D.19300;
    frag_size = D.19299 - D.19301;
    frag_size.12 = (unsigned int) frag_size;
    if (frag_size.12 < minimum_size) goto restart; else goto <D.19303>;
    <D.19303>:
    frag_size.12 = (unsigned int) frag_size;
    *out_alloc_size = frag_size.12;
    mono_memory_barrier ();
    frag_size.12 = (unsigned int) frag_size;
    p = par_alloc_from_fragment (allocator, min_frag, frag_size.12);
    if (p == 0B) goto restart; else goto <D.19304>;
    <D.19304>:
    D.19292 = p;
    return D.19292;
  }
  <D.19297>:
  D.19292 = 0B;
  return D.19292;
}


sgen_clear_allocator_fragments (struct SgenFragmentAllocator * allocator)
{
  struct SgenFragment * D.19306;
  struct FILE * gc_debug_file.13;
  char * D.19310;
  char * D.19311;
  struct SgenFragment * D.19312;
  struct SgenFragment * frag;

  D.19306 = allocator->alloc_head;
  frag = unmask (D.19306);
  goto <D.19040>;
  <D.19039>:
  if (0 != 0) goto <D.19307>; else goto <D.19308>;
  <D.19307>:
  gc_debug_file.13 = gc_debug_file;
  D.19310 = frag->fragment_next;
  D.19311 = frag->fragment_end;
  fprintf (gc_debug_file.13, "Clear nursery frag %p-%p\n", D.19310, D.19311);
  gc_debug_file.13 = gc_debug_file;
  fflush (gc_debug_file.13);
  <D.19308>:
  D.19310 = frag->fragment_next;
  D.19311 = frag->fragment_end;
  sgen_clear_range (D.19310, D.19311);
  D.19312 = frag->next;
  frag = unmask (D.19312);
  <D.19040>:
  if (frag != 0B) goto <D.19039>; else goto <D.19041>;
  <D.19041>:
}


sgen_clear_nursery_fragments ()
{
  <unnamed type> D.19313;
  void (*<T70e>) (void) D.19316;

  D.19313 = sgen_get_nursery_clear_policy ();
  if (D.19313 == 1) goto <D.19314>; else goto <D.19315>;
  <D.19314>:
  sgen_clear_allocator_fragments (&mutator_allocator);
  D.19316 = sgen_minor_collector.clear_fragments;
  D.19316 ();
  <D.19315>:
}


sgen_clear_range (char * start, char * end)
{
  int end.14;
  int start.15;
  int D.19319;
  struct MonoVTable * D.19326;
  unsigned int D.19327;
  unsigned int D.19328;
  char * D.19329;
  _Bool D.19330;
  long int D.19331;
  long int D.19332;
  struct MonoArray * o;
  size_t size;

  end.14 = (int) end;
  start.15 = (int) start;
  D.19319 = end.14 - start.15;
  size = (size_t) D.19319;
  if (start != 0B) goto <D.19323>; else goto <D.19320>;
  <D.19323>:
  if (end == 0B) goto <D.19321>; else goto <D.19320>;
  <D.19320>:
  if (start > end) goto <D.19321>; else goto <D.19322>;
  <D.19321>:
  monoeg_g_log (0B, 4, "Invalid range [%p %p]", start, end);
  <D.19051>:
  goto <D.19051>;
  <D.19322>:
  if (size <= 15) goto <D.19324>; else goto <D.19325>;
  <D.19324>:
  memset (start, 0, size);
  return;
  <D.19325>:
  o = start;
  D.19326 = sgen_get_array_fill_vtable ();
  o->obj.vtable = D.19326;
  o->obj.synchronisation = 4294967295B;
  o->bounds = 0B;
  D.19327 = size + 4294967280;
  o->max_length = D.19327;
  sgen_set_nursery_scan_start (start);
  D.19328 = sgen_safe_object_get_size (o);
  D.19329 = start + D.19328;
  D.19330 = D.19329 != end;
  D.19331 = (long int) D.19330;
  D.19332 = __builtin_expect (D.19331, 0);
  if (D.19332 != 0) goto <D.19333>; else goto <D.19334>;
  <D.19333>:
  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.19334>:
}


sgen_set_nursery_scan_start (char * p)
{
  int p.16;
  struct GCMemSection * nursery_section.17;
  char * D.19338;
  int D.19339;
  int D.19340;
  char * * D.19341;
  unsigned int idx.18;
  unsigned int D.19343;
  char * * D.19344;
  int idx;
  char * old;

  p.16 = (int) p;
  nursery_section.17 = nursery_section;
  D.19338 = nursery_section.17->data;
  D.19339 = (int) D.19338;
  D.19340 = p.16 - D.19339;
  idx = D.19340 / 8192;
  nursery_section.17 = nursery_section;
  D.19341 = nursery_section.17->scan_starts;
  idx.18 = (unsigned int) idx;
  D.19343 = idx.18 * 4;
  D.19344 = D.19341 + D.19343;
  old = *D.19344;
  if (old == 0B) goto <D.19345>; else goto <D.19347>;
  <D.19347>:
  if (old > p) goto <D.19345>; else goto <D.19346>;
  <D.19345>:
  nursery_section.17 = nursery_section;
  D.19341 = nursery_section.17->scan_starts;
  idx.18 = (unsigned int) idx;
  D.19343 = idx.18 * 4;
  D.19344 = D.19341 + D.19343;
  *D.19344 = p;
  <D.19346>:
}


sgen_safe_object_get_size (struct MonoObject * obj)
{
  char * iftmp.19;
  unsigned int D.19349;
  unsigned int D.19350;
  unsigned int D.19353;
  guint D.19357;
  struct MonoVTable * D.19358;
  char * forwarded;

  D.19349 = MEM[(mword *)obj];
  D.19350 = D.19349 & 1;
  if (D.19350 != 0) goto <D.19351>; else goto <D.19352>;
  <D.19351>:
  D.19349 = MEM[(mword *)obj];
  D.19353 = D.19349 & 4294967292;
  iftmp.19 = (char *) D.19353;
  goto <D.19354>;
  <D.19352>:
  iftmp.19 = 0B;
  <D.19354>:
  forwarded = iftmp.19;
  if (forwarded != 0B) goto <D.19355>; else goto <D.19356>;
  <D.19355>:
  obj = forwarded;
  <D.19356>:
  D.19349 = MEM[(mword *)obj];
  D.19353 = D.19349 & 4294967292;
  D.19358 = (struct MonoVTable *) D.19353;
  D.19357 = sgen_par_object_get_size (D.19358, obj);
  return D.19357;
}


sgen_par_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  void * D.19360;
  unsigned int D.19361;
  guint D.19366;
  int D.19367;
  int D.19368;
  unsigned int D.19369;
  unsigned int D.19372;
  int D.19373;
  unsigned int D.19374;
  unsigned int element_size.20;
  unsigned int D.19376;
  unsigned int D.19377;
  struct MonoClass * D.19380;
  unsigned char D.19381;
  unsigned int D.19382;
  unsigned int D.19383;
  mword descr;
  mword type;

  D.19360 = vtable->gc_descr;
  descr = (mword) D.19360;
  type = descr & 7;
  D.19361 = type + 4294967295;
  if (D.19361 <= 1) goto <D.19362>; else goto <D.19363>;
  <D.19362>:
  {
    mword size;

    size = descr & 65528;
    if (size == 0) goto <D.19364>; else goto <D.19365>;
    <D.19364>:
    D.19367 = MEM[(struct MonoString *)o].length;
    D.19368 = D.19367 * 2;
    D.19369 = (unsigned int) D.19368;
    D.19366 = D.19369 + 14;
    return D.19366;
    <D.19365>:
    D.19366 = size;
    return D.19366;
  }
  <D.19363>:
  if (type == 4) goto <D.19370>; else goto <D.19371>;
  <D.19370>:
  {
    int element_size;
    struct MonoArray * array;
    size_t size;

    D.19372 = descr >> 3;
    D.19373 = (int) D.19372;
    element_size = D.19373 & 1023;
    array = o;
    D.19374 = array->max_length;
    element_size.20 = (unsigned int) element_size;
    D.19376 = D.19374 * element_size.20;
    size = D.19376 + 16;
    D.19377 = descr & 8192;
    if (D.19377 != 0) goto <D.19378>; else goto <D.19379>;
    <D.19378>:
    size = size + 3;
    size = size & 4294967292;
    D.19380 = vtable->klass;
    D.19381 = D.19380->rank;
    D.19382 = (unsigned int) D.19381;
    D.19383 = D.19382 * 8;
    size = D.19383 + size;
    <D.19379>:
    D.19366 = size;
    return D.19366;
  }
  <D.19371>:
  D.19366 = slow_object_get_size (vtable, o);
  return D.19366;
}


slow_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  struct MonoClass * D.19385;
  guint D.19388;
  int D.19389;
  int D.19390;
  unsigned int D.19391;
  unsigned char D.19392;
  int D.19395;
  unsigned int D.19396;
  unsigned int D.19397;
  unsigned int D.19398;
  struct MonoArrayBounds * D.19399;
  _Bool D.19400;
  long int D.19401;
  long int D.19402;
  unsigned int D.19405;
  unsigned int D.19406;
  int D.19407;
  struct MonoClass * klass;

  klass = vtable->klass;
  D.19385 = mono_defaults.string_class;
  if (D.19385 == klass) goto <D.19386>; else goto <D.19387>;
  <D.19386>:
  D.19389 = MEM[(struct MonoString *)o].length;
  D.19390 = D.19389 * 2;
  D.19391 = (unsigned int) D.19390;
  D.19388 = D.19391 + 14;
  return D.19388;
  <D.19387>:
  D.19392 = klass->rank;
  if (D.19392 != 0) goto <D.19393>; else goto <D.19394>;
  <D.19393>:
  {
    struct MonoArray * array;
    size_t size;

    array = o;
    D.19395 = klass->sizes.element_size;
    D.19396 = (unsigned int) D.19395;
    D.19397 = array->max_length;
    D.19398 = D.19396 * D.19397;
    size = D.19398 + 16;
    D.19399 = array->bounds;
    D.19400 = D.19399 != 0B;
    D.19401 = (long int) D.19400;
    D.19402 = __builtin_expect (D.19401, 0);
    if (D.19402 != 0) goto <D.19403>; else goto <D.19404>;
    <D.19403>:
    size = size + 3;
    size = size & 4294967292;
    D.19392 = klass->rank;
    D.19405 = (unsigned int) D.19392;
    D.19406 = D.19405 * 8;
    size = D.19406 + size;
    <D.19404>:
    D.19388 = size;
    return D.19388;
  }
  <D.19394>:
  D.19407 = klass->instance_size;
  D.19388 = (guint) D.19407;
  return D.19388;
}


sgen_nursery_allocator_prepare_for_pinning ()
{
  void (*<T70e>) (void) D.19409;

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


sgen_build_nursery_fragments (struct GCMemSection * nursery_section, void * * start, int num_entries, struct SgenGrayQueue * unpin_queue)
{
  struct SgenFragment * (*<T2c04>) (void) D.19410;
  char * * D.19411;
  unsigned int D.19412;
  unsigned int D.19413;
  unsigned int i.21;
  unsigned int D.19417;
  void * * D.19418;
  int iftmp.22;
  struct GrayQueueSection * D.19429;
  int D.19431;
  _Bool D.19432;
  long int D.19433;
  long int D.19434;
  int D.19438;
  int D.19439;
  unsigned int D.19441;
  unsigned int D.19442;
  unsigned int D.19443;
  unsigned int D.19444;
  char * D.19446;
  int D.19447;
  int addr1.23;
  int D.19449;
  int frag_end.24;
  int frag_start.25;
  int D.19452;
  _Bool D.19457;
  long int D.19458;
  long int D.19459;
  void (*<T70e>) (void) D.19469;
  void (*<T2c09>) (struct SgenFragmentAllocator *) D.19470;
  struct SgenFragment * D.19471;
  void * D.19472;
  int gc_debug_level.26;
  _Bool D.19476;
  long int D.19477;
  long int D.19478;
  struct FILE * gc_debug_file.27;
  void * D.19484;
  const char * D.19485;
  unsigned int D.19486;
  mword D.19487;
  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.19410 = sgen_minor_collector.build_fragments_get_exclude_head;
  frags_ranges = D.19410 ();
  D.19411 = nursery_section->scan_starts;
  D.19412 = nursery_section->num_scan_start;
  D.19413 = D.19412 * 4;
  memset (D.19411, 0, D.19413);
  goto <D.19086>;
  <D.19087>:
  {
    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.19414>; else goto <D.19415>;
    <D.19414>:
    i.21 = (unsigned int) i;
    D.19417 = i.21 * 4;
    D.19418 = start + D.19417;
    addr0 = *D.19418;
    <D.19415>:
    if (frags_ranges != 0B) goto <D.19419>; else goto <D.19420>;
    <D.19419>:
    addr1 = frags_ranges->fragment_start;
    <D.19420>:
    if (addr0 < addr1) goto <D.19421>; else goto <D.19422>;
    <D.19421>:
    if (unpin_queue != 0B) goto <D.19423>; else goto <D.19424>;
    <D.19423>:
    D.19429 = unpin_queue->first;
    if (D.19429 == 0B) goto <D.19426>; else goto <D.19430>;
    <D.19430>:
    D.19429 = unpin_queue->first;
    D.19431 = D.19429->end;
    if (D.19431 == 125) goto <D.19426>; else goto <D.19427>;
    <D.19426>:
    iftmp.22 = 1;
    goto <D.19428>;
    <D.19427>:
    iftmp.22 = 0;
    <D.19428>:
    D.19432 = iftmp.22 != 0;
    D.19433 = (long int) D.19432;
    D.19434 = __builtin_expect (D.19433, 0);
    if (D.19434 != 0) goto <D.19435>; else goto <D.19436>;
    <D.19435>:
    sgen_gray_object_enqueue (unpin_queue, addr0);
    goto <D.19437>;
    <D.19436>:
    D.19429 = unpin_queue->first;
    D.19429 = unpin_queue->first;
    D.19431 = D.19429->end;
    D.19438 = D.19431;
    D.19439 = D.19438 + 1;
    D.19429->end = D.19439;
    D.19429->objects[D.19438] = addr0;
    <D.19437>:
    __builtin_prefetch (addr0);
    goto <D.19440>;
    <D.19424>:
    D.19441 = MEM[(mword *)addr0];
    D.19442 = D.19441 & 4294967293;
    MEM[(mword *)addr0] = D.19442;
    <D.19440>:
    sgen_set_nursery_scan_start (addr0);
    frag_end = addr0;
    D.19443 = sgen_safe_object_get_size (addr0);
    D.19444 = D.19443 + 7;
    size = D.19444 & 4294967288;
    i = i + 1;
    goto <D.19445>;
    <D.19422>:
    frag_end = addr1;
    D.19446 = frags_ranges->fragment_next;
    D.19447 = (int) D.19446;
    addr1.23 = (int) addr1;
    D.19449 = D.19447 - addr1.23;
    size = (size_t) D.19449;
    last_frag = frags_ranges;
    frags_ranges = frags_ranges->next_in_order;
    <D.19445>:
    frag_end.24 = (int) frag_end;
    frag_start.25 = (int) frag_start;
    D.19452 = frag_end.24 - frag_start.25;
    frag_size = (size_t) D.19452;
    if (size == 0) goto <D.19453>; else goto <D.19454>;
    <D.19453>:
    // predicted unlikely by continue predictor.
    goto <D.19086>;
    <D.19454>:
    if (0 != 0) goto <D.19455>; else goto <D.19456>;
    <D.19455>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 802, "frag_size >= 0");
    <D.19456>:
    D.19457 = size == 0;
    D.19458 = (long int) D.19457;
    D.19459 = __builtin_expect (D.19458, 0);
    if (D.19459 != 0) goto <D.19460>; else goto <D.19461>;
    <D.19460>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 803, "size > 0");
    <D.19461>:
    if (frag_size != 0) goto <D.19462>; else goto <D.19463>;
    <D.19462>:
    if (size != 0) goto <D.19464>; else goto <D.19465>;
    <D.19464>:
    add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
    <D.19465>:
    <D.19463>:
    frag_size = size;
    frag_start = frag_end + frag_size;
  }
  <D.19086>:
  if (i < num_entries) goto <D.19087>; else goto <D.19466>;
  <D.19466>:
  if (frags_ranges != 0B) goto <D.19087>; else goto <D.19088>;
  <D.19088>:
  nursery_last_pinned_end = frag_start;
  frag_end = sgen_nursery_end;
  frag_end.24 = (int) frag_end;
  frag_start.25 = (int) frag_start;
  D.19452 = frag_end.24 - frag_start.25;
  frag_size = (size_t) D.19452;
  if (frag_size != 0) goto <D.19467>; else goto <D.19468>;
  <D.19467>:
  add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
  <D.19468>:
  D.19469 = sgen_minor_collector.build_fragments_release_exclude_head;
  D.19469 ();
  fragment_list_reverse (&mutator_allocator);
  D.19470 = sgen_minor_collector.build_fragments_finish;
  D.19470 (&mutator_allocator);
  D.19471 = mutator_allocator.alloc_head;
  D.19472 = unmask (D.19471);
  if (D.19472 == 0B) goto <D.19473>; else goto <D.19474>;
  <D.19473>:
  gc_debug_level.26 = gc_debug_level;
  D.19476 = gc_debug_level.26 > 0;
  D.19477 = (long int) D.19476;
  D.19478 = __builtin_expect (D.19477, 0);
  if (D.19478 != 0) goto <D.19479>; else goto <D.19480>;
  <D.19479>:
  gc_debug_file.27 = gc_debug_file;
  fprintf (gc_debug_file.27, "Nursery fully pinned (%d)\n", num_entries);
  gc_debug_file.27 = gc_debug_file;
  fflush (gc_debug_file.27);
  <D.19480>:
  i = 0;
  goto <D.19090>;
  <D.19089>:
  if (0 != 0) goto <D.19482>; else goto <D.19483>;
  <D.19482>:
  gc_debug_file.27 = gc_debug_file;
  i.21 = (unsigned int) i;
  D.19417 = i.21 * 4;
  D.19418 = start + D.19417;
  D.19484 = *D.19418;
  i.21 = (unsigned int) i;
  D.19417 = i.21 * 4;
  D.19418 = start + D.19417;
  D.19484 = *D.19418;
  D.19485 = sgen_safe_name (D.19484);
  i.21 = (unsigned int) i;
  D.19417 = i.21 * 4;
  D.19418 = start + D.19417;
  D.19484 = *D.19418;
  D.19486 = sgen_safe_object_get_size (D.19484);
  fprintf (gc_debug_file.27, "Bastard pinning obj %p (%s), size: %d\n", D.19484, D.19485, D.19486);
  gc_debug_file.27 = gc_debug_file;
  fflush (gc_debug_file.27);
  <D.19483>:
  i = i + 1;
  <D.19090>:
  if (i < num_entries) goto <D.19089>; else goto <D.19091>;
  <D.19091>:
  <D.19474>:
  D.19487 = fragment_total;
  return D.19487;
}


add_nursery_frag (struct SgenFragmentAllocator * allocator, size_t frag_size, char * frag_start, char * frag_end)
{
  struct FILE * gc_debug_file.28;
  <unnamed type> D.19494;
  unsigned int fragment_total.29;
  unsigned int fragment_total.30;

  if (0 != 0) goto <D.19489>; else goto <D.19490>;
  <D.19489>:
  gc_debug_file.28 = gc_debug_file;
  fprintf (gc_debug_file.28, "Found empty fragment: %p-%p, size: %zd\n", frag_start, frag_end, frag_size);
  gc_debug_file.28 = gc_debug_file;
  fflush (gc_debug_file.28);
  <D.19490>:
  if (frag_size > 511) goto <D.19492>; else goto <D.19493>;
  <D.19492>:
  D.19494 = sgen_get_nursery_clear_policy ();
  if (D.19494 == 0) goto <D.19495>; else goto <D.19496>;
  <D.19495>:
  memset (frag_start, 0, frag_size);
  <D.19496>:
  sgen_fragment_allocator_add (allocator, frag_start, frag_end);
  fragment_total.29 = fragment_total;
  fragment_total.30 = fragment_total.29 + frag_size;
  fragment_total = fragment_total.30;
  goto <D.19499>;
  <D.19493>:
  sgen_clear_range (frag_start, frag_end);
  <D.19499>:
}


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

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

    next = list->next;
    list->next = prev;
    list->next_in_order = prev;
    prev = list;
    list = next;
  }
  <D.19069>:
  if (list != 0B) goto <D.19068>; else goto <D.19070>;
  <D.19070>:
  allocator->alloc_head = prev;
  D.19500 = allocator->alloc_head;
  allocator->region_head = D.19500;
}


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

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


sgen_nursery_alloc_get_upper_alloc_bound ()
{
  char * D.19503;

  D.19503 = sgen_nursery_end;
  return D.19503;
}


sgen_nursery_retire_region (void * address, ptrdiff_t size)
{

}


sgen_can_alloc_size (size_t size)
{
  unsigned int D.19505;
  struct SgenFragment * D.19506;
  char * D.19507;
  int D.19508;
  char * D.19509;
  int D.19510;
  int D.19511;
  unsigned int D.19512;
  gboolean D.19515;
  struct SgenFragment * D.19516;
  struct SgenFragment * frag;

  D.19505 = size + 7;
  size = D.19505 & 4294967288;
  D.19506 = mutator_allocator.alloc_head;
  frag = unmask (D.19506);
  goto <D.19104>;
  <D.19103>:
  D.19507 = frag->fragment_end;
  D.19508 = (int) D.19507;
  D.19509 = frag->fragment_next;
  D.19510 = (int) D.19509;
  D.19511 = D.19508 - D.19510;
  D.19512 = (unsigned int) D.19511;
  if (D.19512 >= size) goto <D.19513>; else goto <D.19514>;
  <D.19513>:
  D.19515 = 1;
  return D.19515;
  <D.19514>:
  D.19516 = frag->next;
  frag = unmask (D.19516);
  <D.19104>:
  if (frag != 0B) goto <D.19103>; else goto <D.19105>;
  <D.19105>:
  D.19515 = 0;
  return D.19515;
}


sgen_nursery_alloc (size_t size)
{
  struct FILE * gc_debug_file.31;
  unsigned int D.19521;
  void * D.19522;

  if (0 != 0) goto <D.19518>; else goto <D.19519>;
  <D.19518>:
  gc_debug_file.31 = gc_debug_file;
  fprintf (gc_debug_file.31, "Searching nursery for size: %zd\n", size);
  gc_debug_file.31 = gc_debug_file;
  fflush (gc_debug_file.31);
  <D.19519>:
  D.19521 = size + 7;
  size = D.19521 & 4294967288;
  D.19522 = sgen_fragment_allocator_par_alloc (&mutator_allocator, size);
  return D.19522;
}


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

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


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


sgen_nursery_alloc_prepare_for_minor ()
{
  void (*<T2c00>) (char *, int) D.19529;
  char * sgen_space_bitmap.33;
  int sgen_space_bitmap_size.34;

  D.19529 = sgen_minor_collector.prepare_to_space;
  sgen_space_bitmap.33 = sgen_space_bitmap;
  sgen_space_bitmap_size.34 = sgen_space_bitmap_size;
  D.19529 (sgen_space_bitmap.33, sgen_space_bitmap_size.34);
}


sgen_nursery_alloc_prepare_for_major ()
{
  void (*<T2c00>) (char *, int) D.19532;
  char * sgen_space_bitmap.35;
  int sgen_space_bitmap_size.36;

  D.19532 = sgen_minor_collector.prepare_to_space;
  sgen_space_bitmap.35 = sgen_space_bitmap;
  sgen_space_bitmap_size.36 = sgen_space_bitmap_size;
  D.19532 (sgen_space_bitmap.35, sgen_space_bitmap_size.36);
}


sgen_nursery_allocator_set_nursery_bounds (char * start, char * end)
{
  int end.37;
  int start.38;
  int D.19537;
  int sgen_space_bitmap_size.39;
  int sgen_space_bitmap_size.40;
  unsigned int sgen_space_bitmap_size.41;
  void * sgen_space_bitmap.42;
  void (*<T2c0d>) (struct SgenFragmentAllocator *, char *, char *) D.19542;

  sgen_nursery_start = start;
  sgen_nursery_end = end;
  end.37 = (int) end;
  start.38 = (int) start;
  D.19537 = end.37 - start.38;
  sgen_space_bitmap_size.39 = D.19537 / 4096;
  sgen_space_bitmap_size = sgen_space_bitmap_size.39;
  sgen_space_bitmap_size.40 = sgen_space_bitmap_size;
  sgen_space_bitmap_size.41 = (unsigned int) sgen_space_bitmap_size.40;
  sgen_space_bitmap.42 = monoeg_malloc0 (sgen_space_bitmap_size.41);
  sgen_space_bitmap = sgen_space_bitmap.42;
  D.19542 = sgen_minor_collector.init_nursery;
  D.19542 (&mutator_allocator, start, end);
}


