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

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


sgen_fragment_allocator_add (struct SgenFragmentAllocator * allocator, char * start, char * end)
{
  struct SgenFragment * D.19153;
  void * D.19154;
  struct SgenFragment * D.19155;
  struct SgenFragment * D.19156;
  char * D.19157;
  char * D.19158;
  _Bool D.19159;
  long int D.19160;
  long int D.19161;
  struct SgenFragment * fragment;

  fragment = sgen_fragment_allocator_alloc ();
  fragment->fragment_start = start;
  fragment->fragment_next = start;
  fragment->fragment_end = end;
  D.19153 = allocator->region_head;
  D.19154 = unmask (D.19153);
  fragment->next = D.19154;
  D.19155 = fragment->next;
  fragment->next_in_order = D.19155;
  allocator->alloc_head = fragment;
  D.19156 = allocator->alloc_head;
  allocator->region_head = D.19156;
  D.19157 = fragment->fragment_end;
  D.19158 = fragment->fragment_start;
  D.19159 = D.19157 <= D.19158;
  D.19160 = (long int) D.19159;
  D.19161 = __builtin_expect (D.19160, 0);
  if (D.19161 != 0) goto <D.19162>; else goto <D.19163>;
  <D.19162>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 293, "fragment->fragment_end > fragment->fragment_start");
  <D.19163>:
}


unmask (void * p)
{
  void * D.19164;
  unsigned int p.1;
  unsigned int D.19166;

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


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

  last = allocator->region_head;
  if (last == 0B) goto <D.19168>; else goto <D.19169>;
  <D.19168>:
  return;
  <D.19169>:
  goto <D.18966>;
  <D.18965>:
  last = last->next_in_order;
  <D.18966>:
  D.19170 = last->next_in_order;
  if (D.19170 != 0B) goto <D.18965>; else goto <D.18967>;
  <D.18967>:
  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.19174;
  char * D.19175;
  int D.19176;
  char * D.19177;
  int D.19178;
  int D.19179;
  unsigned int D.19180;
  void * D.19184;
  struct SgenFragment * D.19185;
  void * D.19186;
  struct SgenFragment * frag;
  void restart = <<< error >>>;

  restart:
  D.19174 = allocator->alloc_head;
  frag = unmask (D.19174);
  goto <D.19008>;
  <D.19007>:
  D.19175 = frag->fragment_end;
  D.19176 = (int) D.19175;
  D.19177 = frag->fragment_next;
  D.19178 = (int) D.19177;
  D.19179 = D.19176 - D.19178;
  D.19180 = (unsigned int) D.19179;
  if (D.19180 >= size) goto <D.19181>; else goto <D.19182>;
  <D.19181>:
  {
    void * p;

    p = par_alloc_from_fragment (allocator, frag, size);
    if (p == 0B) goto restart; else goto <D.19183>;
    <D.19183>:
    D.19184 = p;
    return D.19184;
  }
  <D.19182>:
  D.19185 = frag->next;
  frag = unmask (D.19185);
  <D.19008>:
  D.19186 = unmask (frag);
  if (D.19186 != 0B) goto <D.19007>; else goto <D.19009>;
  <D.19009>:
  D.19184 = 0B;
  return D.19184;
}


par_alloc_from_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag, size_t size)
{
  char * D.19188;
  void * D.19191;
  char * * D.19192;
  void * D.19193;
  int D.19196;
  int end.4;
  int D.19198;
  <unnamed type> D.19201;
  int D.19204;
  unsigned int D.19207;
  void * D.19210;
  struct SgenFragment * * D.19211;
  void * D.19212;
  void * D.19215;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19188 = frag->fragment_end;
  if (D.19188 < end) goto <D.19189>; else goto <D.19190>;
  <D.19189>:
  D.19191 = 0B;
  return D.19191;
  <D.19190>:
  mono_memory_barrier ();
  D.19192 = &frag->fragment_next;
  D.19193 = InterlockedCompareExchangePointer (D.19192, end, p);
  if (D.19193 != p) goto <D.19194>; else goto <D.19195>;
  <D.19194>:
  D.19191 = 0B;
  return D.19191;
  <D.19195>:
  D.19188 = frag->fragment_end;
  D.19196 = (int) D.19188;
  end.4 = (int) end;
  D.19198 = D.19196 - end.4;
  if (D.19198 <= 511) goto <D.19199>; else goto <D.19200>;
  <D.19199>:
  {
    struct SgenFragment * next;
    struct SgenFragment * * prev_ptr;

    D.19201 = sgen_get_nursery_clear_policy ();
    if (D.19201 == 1) goto <D.19202>; else goto <D.19203>;
    <D.19202>:
    D.19204 = claim_remaining_size (frag, end);
    if (D.19204 != 0) goto <D.19205>; else goto <D.19206>;
    <D.19205>:
    D.19188 = frag->fragment_end;
    sgen_clear_range (end, D.19188);
    <D.19206>:
    <D.19203>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    goto <D.18990>;
    <D.18992>:
    next = frag->next;
    D.19207 = get_mark (next);
    if (D.19207 == 0) goto <D.19208>; else goto <D.19209>;
    <D.19208>:
    mono_memory_write_barrier ();
    D.19210 = mask (next, 1);
    D.19211 = &frag->next;
    D.19212 = InterlockedCompareExchangePointer (D.19211, D.19210, next);
    if (D.19212 != next) goto <D.19213>; else goto <D.19214>;
    <D.19213>:
    // predicted unlikely by continue predictor.
    goto <D.18990>;
    <D.19214>:
    <D.19209>:
    mono_memory_write_barrier ();
    D.19215 = InterlockedCompareExchangePointer (prev_ptr, next, frag);
    if (D.19215 != frag) goto <D.19216>; else goto <D.19217>;
    <D.19216>:
    prev_ptr = find_previous_pointer_fragment (allocator, frag);
    // predicted unlikely by continue predictor.
    goto <D.18990>;
    <D.19217>:
    goto <D.18991>;
    <D.18990>:
    if (prev_ptr != 0B) goto <D.18992>; else goto <D.18991>;
    <D.18991>:
  }
  <D.19200>:
  D.19191 = p;
  return D.19191;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


claim_remaining_size (struct SgenFragment * frag, char * alloc_end)
{
  char * D.19219;
  gboolean D.19222;
  char * * D.19223;
  void * D.19224;
  _Bool D.19225;

  D.19219 = frag->fragment_end;
  if (D.19219 <= alloc_end) goto <D.19220>; else goto <D.19221>;
  <D.19220>:
  D.19222 = 0;
  return D.19222;
  <D.19221>:
  D.19219 = frag->fragment_end;
  D.19223 = &frag->fragment_next;
  D.19224 = InterlockedCompareExchangePointer (D.19223, D.19219, alloc_end);
  D.19225 = D.19224 == alloc_end;
  D.19222 = (gboolean) D.19225;
  return D.19222;
}


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

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


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

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


mono_memory_write_barrier ()
{
  mono_memory_barrier ();
}


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

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


find_previous_pointer_fragment (struct SgenFragmentAllocator * allocator, struct SgenFragment * frag)
{
  struct SgenFragment * D.19239;
  struct SgenFragment * * D.19242;
  unsigned int D.19244;
  void * D.19250;
  struct SgenFragment * * prev;
  struct SgenFragment * cur;
  struct SgenFragment * next;
  void try_again = <<< error >>>;

  try_again:
  prev = &allocator->alloc_head;
  D.19239 = *prev;
  cur = unmask (D.19239);
  <D.18976>:
  if (cur == 0B) goto <D.19240>; else goto <D.19241>;
  <D.19240>:
  D.19242 = 0B;
  return D.19242;
  <D.19241>:
  next = cur->next;
  mono_memory_read_barrier ();
  D.19239 = *prev;
  if (D.19239 != cur) goto try_again; else goto <D.19243>;
  <D.19243>:
  D.19244 = get_mark (next);
  if (D.19244 == 0) goto <D.19245>; else goto <D.19246>;
  <D.19245>:
  if (cur == frag) goto <D.19247>; else goto <D.19248>;
  <D.19247>:
  D.19242 = prev;
  return D.19242;
  <D.19248>:
  prev = &cur->next;
  goto <D.19249>;
  <D.19246>:
  next = unmask (next);
  D.19250 = InterlockedCompareExchangePointer (prev, next, cur);
  if (D.19250 != cur) goto try_again; else goto <D.19251>;
  <D.19251>:
  mono_memory_write_barrier ();
  <D.19249>:
  cur = mono_lls_pointer_unmask (next);
  goto <D.18976>;
  D.19242 = 0B;
  return D.19242;
}


mono_memory_read_barrier ()
{
  mono_memory_barrier ();
}


mono_lls_pointer_unmask (void * p)
{
  void * D.19253;
  unsigned int p.9;
  unsigned int D.19255;

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


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

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

    p = serial_alloc_from_fragment (previous, frag, size);
    if (p != 0B) goto <D.19257>; else goto <D.19258>;
    <D.19257>:
    D.19259 = p;
    return D.19259;
    <D.19258>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.19018>:
  if (frag != 0B) goto <D.19017>; else goto <D.19019>;
  <D.19019>:
  D.19259 = 0B;
  return D.19259;
}


serial_alloc_from_fragment (struct SgenFragment * * previous, struct SgenFragment * frag, size_t size)
{
  char * D.19261;
  void * D.19264;
  int D.19265;
  int end.10;
  int D.19267;
  struct SgenFragment * D.19270;
  unsigned int D.19271;
  char * p;
  char * end;

  p = frag->fragment_next;
  end = p + size;
  D.19261 = frag->fragment_end;
  if (D.19261 < end) goto <D.19262>; else goto <D.19263>;
  <D.19262>:
  D.19264 = 0B;
  return D.19264;
  <D.19263>:
  frag->fragment_next = end;
  D.19261 = frag->fragment_end;
  D.19265 = (int) D.19261;
  end.10 = (int) end;
  D.19267 = D.19265 - end.10;
  if (D.19267 <= 511) goto <D.19268>; else goto <D.19269>;
  <D.19268>:
  D.19270 = frag->next;
  *previous = D.19270;
  D.19261 = frag->fragment_end;
  D.19265 = (int) D.19261;
  end.10 = (int) end;
  D.19267 = D.19265 - end.10;
  D.19271 = (unsigned int) D.19267;
  memset (end, 0, D.19271);
  D.19270 = frag->next;
  *previous = D.19270;
  <D.19269>:
  D.19264 = p;
  return D.19264;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.19275;
  int D.19280;
  void * D.19282;
  unsigned int D.19283;

  D.19275 = __builtin_constant_p (__len);
  if (D.19275 != 0) goto <D.19276>; else goto <D.19277>;
  <D.19276>:
  if (__len == 0) goto <D.19278>; else goto <D.19279>;
  <D.19278>:
  D.19280 = __builtin_constant_p (__ch);
  if (D.19280 == 0) goto <D.19273>; else goto <D.19281>;
  <D.19281>:
  if (__ch != 0) goto <D.19273>; else goto <D.19274>;
  <D.19273>:
  __warn_memset_zero_len ();
  D.19282 = __dest;
  return D.19282;
  <D.19274>:
  <D.19279>:
  <D.19277>:
  D.19283 = __builtin_object_size (__dest, 0);
  D.19282 = __builtin___memset_chk (__dest, __ch, __len, D.19283);
  return D.19282;
}


sgen_fragment_allocator_serial_range_alloc (struct SgenFragmentAllocator * allocator, size_t desired_size, size_t minimum_size, size_t * out_alloc_size)
{
  char * D.19285;
  int D.19286;
  char * D.19287;
  int D.19288;
  int D.19289;
  void * D.19292;
  char * D.19297;
  int D.19298;
  char * D.19299;
  int D.19300;
  int D.19301;
  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.19034>;
  <D.19033>:
  {
    size_t frag_size;

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

      *out_alloc_size = desired_size;
      p = serial_alloc_from_fragment (previous, frag, desired_size);
      D.19292 = p;
      return D.19292;
    }
    <D.19291>:
    if (current_minimum <= frag_size) goto <D.19293>; else goto <D.19294>;
    <D.19293>:
    min_frag = frag;
    prev_min_frag = previous;
    current_minimum = frag_size;
    <D.19294>:
    previous = &frag->next;
  }
  frag = *previous;
  <D.19034>:
  if (frag != 0B) goto <D.19033>; else goto <D.19035>;
  <D.19035>:
  if (min_frag != 0B) goto <D.19295>; else goto <D.19296>;
  <D.19295>:
  {
    void * p;
    size_t frag_size;

    D.19297 = min_frag->fragment_end;
    D.19298 = (int) D.19297;
    D.19299 = min_frag->fragment_next;
    D.19300 = (int) D.19299;
    D.19301 = D.19298 - D.19300;
    frag_size = (size_t) D.19301;
    *out_alloc_size = frag_size;
    p = serial_alloc_from_fragment (prev_min_frag, min_frag, frag_size);
    D.19292 = p;
    return D.19292;
  }
  <D.19296>:
  D.19292 = 0B;
  return D.19292;
}


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.19303;
  char * D.19304;
  int D.19305;
  char * D.19306;
  int D.19307;
  unsigned int frag_size.11;
  void * D.19312;
  struct SgenFragment * D.19315;
  char * D.19318;
  int D.19319;
  char * D.19320;
  int D.19321;
  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.19303 = allocator->alloc_head;
  frag = unmask (D.19303);
  goto <D.19051>;
  <D.19050>:
  {
    int frag_size;

    D.19304 = frag->fragment_end;
    D.19305 = (int) D.19304;
    D.19306 = frag->fragment_next;
    D.19307 = (int) D.19306;
    frag_size = D.19305 - D.19307;
    frag_size.11 = (unsigned int) frag_size;
    if (frag_size.11 >= desired_size) goto <D.19309>; else goto <D.19310>;
    <D.19309>:
    {
      void * p;

      *out_alloc_size = desired_size;
      p = par_alloc_from_fragment (allocator, frag, desired_size);
      if (p == 0B) goto restart; else goto <D.19311>;
      <D.19311>:
      D.19312 = p;
      return D.19312;
    }
    <D.19310>:
    frag_size.11 = (unsigned int) frag_size;
    if (frag_size.11 >= current_minimum) goto <D.19313>; else goto <D.19314>;
    <D.19313>:
    min_frag = frag;
    current_minimum = (size_t) frag_size;
    <D.19314>:
  }
  D.19315 = frag->next;
  frag = unmask (D.19315);
  <D.19051>:
  if (frag != 0B) goto <D.19050>; else goto <D.19052>;
  <D.19052>:
  mono_memory_barrier ();
  if (min_frag != 0B) goto <D.19316>; else goto <D.19317>;
  <D.19316>:
  {
    void * p;
    int frag_size;

    D.19318 = min_frag->fragment_end;
    D.19319 = (int) D.19318;
    D.19320 = min_frag->fragment_next;
    D.19321 = (int) D.19320;
    frag_size = D.19319 - D.19321;
    frag_size.12 = (unsigned int) frag_size;
    if (frag_size.12 < minimum_size) goto restart; else goto <D.19323>;
    <D.19323>:
    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.19324>;
    <D.19324>:
    D.19312 = p;
    return D.19312;
  }
  <D.19317>:
  D.19312 = 0B;
  return D.19312;
}


sgen_clear_allocator_fragments (struct SgenFragmentAllocator * allocator)
{
  struct SgenFragment * D.19326;
  char * D.19329;
  char * D.19330;
  struct FILE * gc_debug_file.13;
  struct SgenFragment * D.19332;
  struct SgenFragment * frag;

  D.19326 = allocator->alloc_head;
  frag = unmask (D.19326);
  goto <D.19060>;
  <D.19059>:
  if (0 != 0) goto <D.19327>; else goto <D.19328>;
  <D.19327>:
  D.19329 = frag->fragment_end;
  D.19330 = frag->fragment_next;
  gc_debug_file.13 = gc_debug_file;
  fprintf (gc_debug_file.13, "Clear nursery frag %p-%p\n", D.19330, D.19329);
  gc_debug_file.13 = gc_debug_file;
  fflush (gc_debug_file.13);
  <D.19328>:
  D.19329 = frag->fragment_end;
  D.19330 = frag->fragment_next;
  sgen_clear_range (D.19330, D.19329);
  D.19332 = frag->next;
  frag = unmask (D.19332);
  <D.19060>:
  if (frag != 0B) goto <D.19059>; else goto <D.19061>;
  <D.19061>:
}


sgen_clear_nursery_fragments ()
{
  <unnamed type> D.19333;
  void (*<T719>) (void) D.19336;

  D.19333 = sgen_get_nursery_clear_policy ();
  if (D.19333 == 1) goto <D.19334>; else goto <D.19335>;
  <D.19334>:
  sgen_clear_allocator_fragments (&mutator_allocator);
  D.19336 = sgen_minor_collector.clear_fragments;
  D.19336 ();
  <D.19335>:
}


sgen_clear_range (char * start, char * end)
{
  int end.14;
  int start.15;
  int D.19339;
  _Bool D.19342;
  _Bool D.19343;
  _Bool D.19344;
  struct MonoVTable * D.19348;
  unsigned int D.19349;
  unsigned int D.19350;
  char * D.19351;
  _Bool D.19352;
  long int D.19353;
  long int D.19354;
  struct MonoArray * o;
  size_t size;

  end.14 = (int) end;
  start.15 = (int) start;
  D.19339 = end.14 - start.15;
  size = (size_t) D.19339;
  D.19342 = start != 0B;
  D.19343 = end == 0B;
  D.19344 = D.19342 & D.19343;
  if (D.19344 != 0) goto <D.19340>; else goto <D.19345>;
  <D.19345>:
  if (start > end) goto <D.19340>; else goto <D.19341>;
  <D.19340>:
  monoeg_g_log (0B, 4, "Invalid range [%p %p]", start, end);
  <D.19071>:
  goto <D.19071>;
  <D.19341>:
  if (size <= 15) goto <D.19346>; else goto <D.19347>;
  <D.19346>:
  memset (start, 0, size);
  return;
  <D.19347>:
  o = start;
  D.19348 = sgen_get_array_fill_vtable ();
  o->obj.vtable = D.19348;
  o->obj.synchronisation = 4294967295B;
  o->bounds = 0B;
  D.19349 = size + 4294967280;
  o->max_length = D.19349;
  sgen_set_nursery_scan_start (start);
  D.19350 = sgen_safe_object_get_size (o);
  D.19351 = start + D.19350;
  D.19352 = D.19351 != end;
  D.19353 = (long int) D.19352;
  D.19354 = __builtin_expect (D.19353, 0);
  if (D.19354 != 0) goto <D.19355>; else goto <D.19356>;
  <D.19355>:
  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.19356>:
}


sgen_set_nursery_scan_start (char * p)
{
  int p.16;
  struct GCMemSection * nursery_section.17;
  char * D.19360;
  int D.19361;
  int D.19362;
  char * * D.19363;
  unsigned int idx.18;
  unsigned int D.19365;
  char * * D.19366;
  _Bool D.19367;
  _Bool D.19368;
  _Bool D.19369;
  int idx;
  char * old;

  p.16 = (int) p;
  nursery_section.17 = nursery_section;
  D.19360 = nursery_section.17->data;
  D.19361 = (int) D.19360;
  D.19362 = p.16 - D.19361;
  idx = D.19362 / 8192;
  nursery_section.17 = nursery_section;
  D.19363 = nursery_section.17->scan_starts;
  idx.18 = (unsigned int) idx;
  D.19365 = idx.18 * 4;
  D.19366 = D.19363 + D.19365;
  old = *D.19366;
  D.19367 = old == 0B;
  D.19368 = old > p;
  D.19369 = D.19367 | D.19368;
  if (D.19369 != 0) goto <D.19370>; else goto <D.19371>;
  <D.19370>:
  nursery_section.17 = nursery_section;
  D.19363 = nursery_section.17->scan_starts;
  idx.18 = (unsigned int) idx;
  D.19365 = idx.18 * 4;
  D.19366 = D.19363 + D.19365;
  *D.19366 = p;
  <D.19371>:
}


sgen_safe_object_get_size (struct MonoObject * obj)
{
  char * iftmp.19;
  unsigned int D.19373;
  unsigned int D.19374;
  unsigned int D.19377;
  guint D.19381;
  struct MonoVTable * D.19382;
  char * forwarded;

  D.19373 = MEM[(mword *)obj];
  D.19374 = D.19373 & 1;
  if (D.19374 != 0) goto <D.19375>; else goto <D.19376>;
  <D.19375>:
  D.19373 = MEM[(mword *)obj];
  D.19377 = D.19373 & 4294967292;
  iftmp.19 = (char *) D.19377;
  goto <D.19378>;
  <D.19376>:
  iftmp.19 = 0B;
  <D.19378>:
  forwarded = iftmp.19;
  if (forwarded != 0B) goto <D.19379>; else goto <D.19380>;
  <D.19379>:
  obj = forwarded;
  <D.19380>:
  D.19373 = MEM[(mword *)obj];
  D.19377 = D.19373 & 4294967292;
  D.19382 = (struct MonoVTable *) D.19377;
  D.19381 = sgen_par_object_get_size (D.19382, obj);
  return D.19381;
}


sgen_par_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  void * D.19384;
  unsigned int D.19385;
  guint D.19390;
  int D.19391;
  int D.19392;
  unsigned int D.19393;
  unsigned int D.19396;
  int D.19397;
  unsigned int D.19398;
  unsigned int element_size.20;
  unsigned int D.19400;
  unsigned int D.19401;
  struct MonoClass * D.19404;
  unsigned char D.19405;
  unsigned int D.19406;
  unsigned int D.19407;
  mword descr;
  mword type;

  D.19384 = vtable->gc_descr;
  descr = (mword) D.19384;
  type = descr & 7;
  D.19385 = type + 4294967295;
  if (D.19385 <= 1) goto <D.19386>; else goto <D.19387>;
  <D.19386>:
  {
    mword size;

    size = descr & 65528;
    if (size == 0) goto <D.19388>; else goto <D.19389>;
    <D.19388>:
    D.19391 = MEM[(struct MonoString *)o].length;
    D.19392 = D.19391 * 2;
    D.19393 = (unsigned int) D.19392;
    D.19390 = D.19393 + 14;
    return D.19390;
    <D.19389>:
    D.19390 = size;
    return D.19390;
  }
  <D.19387>:
  if (type == 4) goto <D.19394>; else goto <D.19395>;
  <D.19394>:
  {
    int element_size;
    struct MonoArray * array;
    size_t size;

    D.19396 = descr >> 3;
    D.19397 = (int) D.19396;
    element_size = D.19397 & 1023;
    array = o;
    D.19398 = array->max_length;
    element_size.20 = (unsigned int) element_size;
    D.19400 = D.19398 * element_size.20;
    size = D.19400 + 16;
    D.19401 = descr & 8192;
    if (D.19401 != 0) goto <D.19402>; else goto <D.19403>;
    <D.19402>:
    size = size + 3;
    size = size & 4294967292;
    D.19404 = vtable->klass;
    D.19405 = D.19404->rank;
    D.19406 = (unsigned int) D.19405;
    D.19407 = D.19406 * 8;
    size = D.19407 + size;
    <D.19403>:
    D.19390 = size;
    return D.19390;
  }
  <D.19395>:
  D.19390 = slow_object_get_size (vtable, o);
  return D.19390;
}


slow_object_get_size (struct MonoVTable * vtable, struct MonoObject * o)
{
  struct MonoClass * D.19409;
  guint D.19412;
  int D.19413;
  int D.19414;
  unsigned int D.19415;
  unsigned char D.19416;
  int D.19419;
  unsigned int D.19420;
  unsigned int D.19421;
  unsigned int D.19422;
  struct MonoArrayBounds * D.19423;
  _Bool D.19424;
  long int D.19425;
  long int D.19426;
  unsigned int D.19429;
  unsigned int D.19430;
  int D.19431;
  struct MonoClass * klass;

  klass = vtable->klass;
  D.19409 = mono_defaults.string_class;
  if (D.19409 == klass) goto <D.19410>; else goto <D.19411>;
  <D.19410>:
  D.19413 = MEM[(struct MonoString *)o].length;
  D.19414 = D.19413 * 2;
  D.19415 = (unsigned int) D.19414;
  D.19412 = D.19415 + 14;
  return D.19412;
  <D.19411>:
  D.19416 = klass->rank;
  if (D.19416 != 0) goto <D.19417>; else goto <D.19418>;
  <D.19417>:
  {
    struct MonoArray * array;
    size_t size;

    array = o;
    D.19419 = klass->sizes.element_size;
    D.19420 = (unsigned int) D.19419;
    D.19421 = array->max_length;
    D.19422 = D.19420 * D.19421;
    size = D.19422 + 16;
    D.19423 = array->bounds;
    D.19424 = D.19423 != 0B;
    D.19425 = (long int) D.19424;
    D.19426 = __builtin_expect (D.19425, 0);
    if (D.19426 != 0) goto <D.19427>; else goto <D.19428>;
    <D.19427>:
    size = size + 3;
    size = size & 4294967292;
    D.19416 = klass->rank;
    D.19429 = (unsigned int) D.19416;
    D.19430 = D.19429 * 8;
    size = D.19430 + size;
    <D.19428>:
    D.19412 = size;
    return D.19412;
  }
  <D.19418>:
  D.19431 = klass->instance_size;
  D.19412 = (guint) D.19431;
  return D.19412;
}


sgen_nursery_allocator_prepare_for_pinning ()
{
  void (*<T719>) (void) D.19433;

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


sgen_build_nursery_fragments (struct GCMemSection * nursery_section, void * * start, int num_entries, struct SgenGrayQueue * unpin_queue)
{
  struct SgenFragment * (*<T2c0a>) (void) D.19434;
  unsigned int D.19435;
  unsigned int D.19436;
  char * * D.19437;
  unsigned int i.21;
  unsigned int D.19441;
  void * * D.19442;
  int iftmp.22;
  struct GrayQueueSection * D.19453;
  int D.19455;
  _Bool D.19456;
  long int D.19457;
  long int D.19458;
  int D.19462;
  int D.19463;
  unsigned int D.19465;
  unsigned int D.19466;
  unsigned int D.19467;
  unsigned int D.19468;
  char * D.19470;
  int D.19471;
  int addr1.23;
  int D.19473;
  int frag_end.24;
  int frag_start.25;
  int D.19476;
  _Bool D.19481;
  long int D.19482;
  long int D.19483;
  _Bool D.19486;
  _Bool D.19487;
  _Bool D.19488;
  _Bool D.19491;
  _Bool D.19492;
  _Bool D.19493;
  void (*<T719>) (void) D.19496;
  void (*<T2c0f>) (struct SgenFragmentAllocator *) D.19497;
  struct SgenFragment * D.19498;
  void * D.19499;
  int gc_debug_level.26;
  _Bool D.19503;
  long int D.19504;
  long int D.19505;
  struct FILE * gc_debug_file.27;
  void * D.19511;
  unsigned int D.19512;
  const char * D.19513;
  mword D.19514;
  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.19434 = sgen_minor_collector.build_fragments_get_exclude_head;
  frags_ranges = D.19434 ();
  D.19435 = nursery_section->num_scan_start;
  D.19436 = D.19435 * 4;
  D.19437 = nursery_section->scan_starts;
  memset (D.19437, 0, D.19436);
  goto <D.19106>;
  <D.19107>:
  {
    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.19438>; else goto <D.19439>;
    <D.19438>:
    i.21 = (unsigned int) i;
    D.19441 = i.21 * 4;
    D.19442 = start + D.19441;
    addr0 = *D.19442;
    <D.19439>:
    if (frags_ranges != 0B) goto <D.19443>; else goto <D.19444>;
    <D.19443>:
    addr1 = frags_ranges->fragment_start;
    <D.19444>:
    if (addr0 < addr1) goto <D.19445>; else goto <D.19446>;
    <D.19445>:
    if (unpin_queue != 0B) goto <D.19447>; else goto <D.19448>;
    <D.19447>:
    D.19453 = unpin_queue->first;
    if (D.19453 == 0B) goto <D.19450>; else goto <D.19454>;
    <D.19454>:
    D.19453 = unpin_queue->first;
    D.19455 = D.19453->end;
    if (D.19455 == 125) goto <D.19450>; else goto <D.19451>;
    <D.19450>:
    iftmp.22 = 1;
    goto <D.19452>;
    <D.19451>:
    iftmp.22 = 0;
    <D.19452>:
    D.19456 = iftmp.22 != 0;
    D.19457 = (long int) D.19456;
    D.19458 = __builtin_expect (D.19457, 0);
    if (D.19458 != 0) goto <D.19459>; else goto <D.19460>;
    <D.19459>:
    sgen_gray_object_enqueue (unpin_queue, addr0);
    goto <D.19461>;
    <D.19460>:
    D.19453 = unpin_queue->first;
    D.19453 = unpin_queue->first;
    D.19455 = D.19453->end;
    D.19462 = D.19455;
    D.19463 = D.19462 + 1;
    D.19453->end = D.19463;
    D.19453->objects[D.19462] = addr0;
    <D.19461>:
    __builtin_prefetch (addr0);
    goto <D.19464>;
    <D.19448>:
    D.19465 = MEM[(mword *)addr0];
    D.19466 = D.19465 & 4294967293;
    MEM[(mword *)addr0] = D.19466;
    <D.19464>:
    sgen_set_nursery_scan_start (addr0);
    frag_end = addr0;
    D.19467 = sgen_safe_object_get_size (addr0);
    D.19468 = D.19467 + 7;
    size = D.19468 & 4294967288;
    i = i + 1;
    goto <D.19469>;
    <D.19446>:
    frag_end = addr1;
    D.19470 = frags_ranges->fragment_next;
    D.19471 = (int) D.19470;
    addr1.23 = (int) addr1;
    D.19473 = D.19471 - addr1.23;
    size = (size_t) D.19473;
    last_frag = frags_ranges;
    frags_ranges = frags_ranges->next_in_order;
    <D.19469>:
    frag_end.24 = (int) frag_end;
    frag_start.25 = (int) frag_start;
    D.19476 = frag_end.24 - frag_start.25;
    frag_size = (size_t) D.19476;
    if (size == 0) goto <D.19477>; else goto <D.19478>;
    <D.19477>:
    // predicted unlikely by continue predictor.
    goto <D.19106>;
    <D.19478>:
    if (0 != 0) goto <D.19479>; else goto <D.19480>;
    <D.19479>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 802, "frag_size >= 0");
    <D.19480>:
    D.19481 = size == 0;
    D.19482 = (long int) D.19481;
    D.19483 = __builtin_expect (D.19482, 0);
    if (D.19483 != 0) goto <D.19484>; else goto <D.19485>;
    <D.19484>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-nursery-allocator.c", 803, "size > 0");
    <D.19485>:
    D.19486 = frag_size != 0;
    D.19487 = size != 0;
    D.19488 = D.19486 & D.19487;
    if (D.19488 != 0) goto <D.19489>; else goto <D.19490>;
    <D.19489>:
    add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
    <D.19490>:
    frag_size = size;
    frag_start = frag_end + frag_size;
  }
  <D.19106>:
  D.19491 = i < num_entries;
  D.19492 = frags_ranges != 0B;
  D.19493 = D.19491 | D.19492;
  if (D.19493 != 0) goto <D.19107>; else goto <D.19108>;
  <D.19108>:
  nursery_last_pinned_end = frag_start;
  frag_end = sgen_nursery_end;
  frag_end.24 = (int) frag_end;
  frag_start.25 = (int) frag_start;
  D.19476 = frag_end.24 - frag_start.25;
  frag_size = (size_t) D.19476;
  if (frag_size != 0) goto <D.19494>; else goto <D.19495>;
  <D.19494>:
  add_nursery_frag (&mutator_allocator, frag_size, frag_start, frag_end);
  <D.19495>:
  D.19496 = sgen_minor_collector.build_fragments_release_exclude_head;
  D.19496 ();
  fragment_list_reverse (&mutator_allocator);
  D.19497 = sgen_minor_collector.build_fragments_finish;
  D.19497 (&mutator_allocator);
  D.19498 = mutator_allocator.alloc_head;
  D.19499 = unmask (D.19498);
  if (D.19499 == 0B) goto <D.19500>; else goto <D.19501>;
  <D.19500>:
  gc_debug_level.26 = gc_debug_level;
  D.19503 = gc_debug_level.26 > 0;
  D.19504 = (long int) D.19503;
  D.19505 = __builtin_expect (D.19504, 0);
  if (D.19505 != 0) goto <D.19506>; else goto <D.19507>;
  <D.19506>:
  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.19507>:
  i = 0;
  goto <D.19110>;
  <D.19109>:
  if (0 != 0) goto <D.19509>; else goto <D.19510>;
  <D.19509>:
  i.21 = (unsigned int) i;
  D.19441 = i.21 * 4;
  D.19442 = start + D.19441;
  D.19511 = *D.19442;
  D.19512 = sgen_safe_object_get_size (D.19511);
  i.21 = (unsigned int) i;
  D.19441 = i.21 * 4;
  D.19442 = start + D.19441;
  D.19511 = *D.19442;
  D.19513 = sgen_safe_name (D.19511);
  i.21 = (unsigned int) i;
  D.19441 = i.21 * 4;
  D.19442 = start + D.19441;
  D.19511 = *D.19442;
  gc_debug_file.27 = gc_debug_file;
  fprintf (gc_debug_file.27, "Bastard pinning obj %p (%s), size: %d\n", D.19511, D.19513, D.19512);
  gc_debug_file.27 = gc_debug_file;
  fflush (gc_debug_file.27);
  <D.19510>:
  i = i + 1;
  <D.19110>:
  if (i < num_entries) goto <D.19109>; else goto <D.19111>;
  <D.19111>:
  <D.19501>:
  D.19514 = fragment_total;
  return D.19514;
}


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.19521;
  unsigned int fragment_total.29;
  unsigned int fragment_total.30;

  if (0 != 0) goto <D.19516>; else goto <D.19517>;
  <D.19516>:
  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.19517>:
  if (frag_size > 511) goto <D.19519>; else goto <D.19520>;
  <D.19519>:
  D.19521 = sgen_get_nursery_clear_policy ();
  if (D.19521 == 0) goto <D.19522>; else goto <D.19523>;
  <D.19522>:
  memset (frag_start, 0, frag_size);
  <D.19523>:
  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.19526>;
  <D.19520>:
  sgen_clear_range (frag_start, frag_end);
  <D.19526>:
}


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

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

    next = list->next;
    list->next = prev;
    list->next_in_order = prev;
    prev = list;
    list = next;
  }
  <D.19089>:
  if (list != 0B) goto <D.19088>; else goto <D.19090>;
  <D.19090>:
  allocator->alloc_head = prev;
  D.19527 = allocator->alloc_head;
  allocator->region_head = D.19527;
}


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

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


sgen_nursery_alloc_get_upper_alloc_bound ()
{
  char * D.19530;

  D.19530 = sgen_nursery_end;
  return D.19530;
}


sgen_nursery_retire_region (void * address, ptrdiff_t size)
{

}


sgen_can_alloc_size (size_t size)
{
  unsigned int D.19532;
  struct SgenFragment * D.19533;
  char * D.19534;
  int D.19535;
  char * D.19536;
  int D.19537;
  int D.19538;
  unsigned int D.19539;
  gboolean D.19542;
  struct SgenFragment * D.19543;
  struct SgenFragment * frag;

  D.19532 = size + 7;
  size = D.19532 & 4294967288;
  D.19533 = mutator_allocator.alloc_head;
  frag = unmask (D.19533);
  goto <D.19124>;
  <D.19123>:
  D.19534 = frag->fragment_end;
  D.19535 = (int) D.19534;
  D.19536 = frag->fragment_next;
  D.19537 = (int) D.19536;
  D.19538 = D.19535 - D.19537;
  D.19539 = (unsigned int) D.19538;
  if (D.19539 >= size) goto <D.19540>; else goto <D.19541>;
  <D.19540>:
  D.19542 = 1;
  return D.19542;
  <D.19541>:
  D.19543 = frag->next;
  frag = unmask (D.19543);
  <D.19124>:
  if (frag != 0B) goto <D.19123>; else goto <D.19125>;
  <D.19125>:
  D.19542 = 0;
  return D.19542;
}


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

  if (0 != 0) goto <D.19545>; else goto <D.19546>;
  <D.19545>:
  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.19546>:
  D.19548 = size + 7;
  size = D.19548 & 4294967288;
  D.19549 = sgen_fragment_allocator_par_alloc (&mutator_allocator, size);
  return D.19549;
}


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

  if (0 != 0) goto <D.19551>; else goto <D.19552>;
  <D.19551>:
  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.19552>:
  D.19554 = sgen_fragment_allocator_par_range_alloc (&mutator_allocator, desired_size, minimum_size, out_alloc_size);
  return D.19554;
}


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


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

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


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

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


sgen_nursery_allocator_set_nursery_bounds (char * start, char * end)
{
  int end.37;
  int start.38;
  int D.19564;
  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 (*<T2c13>) (struct SgenFragmentAllocator *, char *, char *) D.19569;

  sgen_nursery_start = start;
  sgen_nursery_end = end;
  end.37 = (int) end;
  start.38 = (int) start;
  D.19564 = end.37 - start.38;
  sgen_space_bitmap_size.39 = D.19564 / 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.19569 = sgen_minor_collector.init_nursery;
  D.19569 (&mutator_allocator, start, end);
}


