GC_find_header (char * h)
{
  struct hdr * D.4588;
  long unsigned int h.0;
  long unsigned int D.4590;
  struct bottom_index * D.4591;
  long unsigned int D.4592;
  long unsigned int D.4593;

  h.0 = (long unsigned int) h;
  D.4590 = h.0 >> 22;
  D.4591 = GC_arrays._top_index[D.4590];
  h.0 = (long unsigned int) h;
  D.4592 = h.0 >> 12;
  D.4593 = D.4592 & 1023;
  D.4588 = D.4591->index[D.4593];
  return D.4588;
}


GC_scratch_alloc (word bytes)
{
  char * scratch_free_ptr.1;
  char * scratch_free_ptr.2;
  char * D.4597;
  char * D.4600;
  long unsigned int GC_page_size.3;
  long unsigned int D.4604;
  long unsigned int D.4605;
  sizetype D.4606;
  char * scratch_free_ptr.4;
  char * D.4608;
  char * D.4611;
  register char * result;

  result = scratch_free_ptr;
  bytes = bytes + 7;
  bytes = bytes & 4294967288;
  scratch_free_ptr.1 = scratch_free_ptr;
  scratch_free_ptr.2 = scratch_free_ptr.1 + bytes;
  scratch_free_ptr = scratch_free_ptr.2;
  D.4597 = GC_arrays._scratch_end_ptr;
  scratch_free_ptr.1 = scratch_free_ptr;
  if (D.4597 >= scratch_free_ptr.1) goto <D.4598>; else goto <D.4599>;
  <D.4598>:
  D.4600 = result;
  return D.4600;
  <D.4599>:
  {
    word bytes_to_get;

    bytes_to_get = 65536;
    if (bytes_to_get <= bytes) goto <D.4601>; else goto <D.4602>;
    <D.4601>:
    bytes_to_get = bytes;
    GC_page_size.3 = GC_page_size;
    D.4604 = GC_page_size.3 + bytes_to_get;
    bytes_to_get = D.4604 + 4294967295;
    GC_page_size.3 = GC_page_size;
    D.4605 = -GC_page_size.3;
    bytes_to_get = D.4605 & bytes_to_get;
    result = GC_unix_get_mem (bytes_to_get);
    scratch_free_ptr.1 = scratch_free_ptr;
    D.4606 = -bytes;
    scratch_free_ptr.4 = scratch_free_ptr.1 + D.4606;
    scratch_free_ptr = scratch_free_ptr.4;
    D.4608 = result + bytes;
    GC_arrays._scratch_last_end_ptr = D.4608;
    D.4600 = result;
    return D.4600;
    <D.4602>:
    result = GC_unix_get_mem (bytes_to_get);
    if (result == 0B) goto <D.4609>; else goto <D.4610>;
    <D.4609>:
    scratch_free_ptr.1 = scratch_free_ptr;
    D.4606 = -bytes;
    scratch_free_ptr.4 = scratch_free_ptr.1 + D.4606;
    scratch_free_ptr = scratch_free_ptr.4;
    bytes_to_get = bytes;
    GC_page_size.3 = GC_page_size;
    D.4604 = GC_page_size.3 + bytes_to_get;
    bytes_to_get = D.4604 + 4294967295;
    GC_page_size.3 = GC_page_size;
    D.4605 = -GC_page_size.3;
    bytes_to_get = D.4605 & bytes_to_get;
    D.4600 = GC_unix_get_mem (bytes_to_get);
    return D.4600;
    <D.4610>:
    scratch_free_ptr = result;
    scratch_free_ptr.1 = scratch_free_ptr;
    D.4611 = scratch_free_ptr.1 + bytes_to_get;
    GC_arrays._scratch_end_ptr = D.4611;
    D.4597 = GC_arrays._scratch_end_ptr;
    GC_arrays._scratch_last_end_ptr = D.4597;
    D.4600 = GC_scratch_alloc (bytes);
    return D.4600;
  }
}


GC_init_headers ()
{
  char * D.4613;
  struct bottom_index * D.4614;
  struct hdr * GC_invalid_header.5;
  struct hdr * GC_invalid_header.6;
  register unsigned int i;

  D.4613 = GC_scratch_alloc (4108);
  GC_arrays._all_nils = D.4613;
  D.4614 = GC_arrays._all_nils;
  memset (D.4614, 0, 4108);
  i = 0;
  goto <D.4500>;
  <D.4499>:
  D.4614 = GC_arrays._all_nils;
  GC_arrays._top_index[i] = D.4614;
  i = i + 1;
  <D.4500>:
  if (i <= 1023) goto <D.4499>; else goto <D.4501>;
  <D.4501>:
  GC_invalid_header.5 = alloc_hdr ();
  GC_invalid_header = GC_invalid_header.5;
  GC_invalid_header.6 = GC_invalid_header;
  GC_invalidate_map (GC_invalid_header.6);
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.4619;
  int D.4624;
  void * D.4626;
  unsigned int D.4627;

  D.4619 = __builtin_constant_p (__len);
  if (D.4619 != 0) goto <D.4620>; else goto <D.4621>;
  <D.4620>:
  if (__len == 0) goto <D.4622>; else goto <D.4623>;
  <D.4622>:
  D.4624 = __builtin_constant_p (__ch);
  if (D.4624 == 0) goto <D.4617>; else goto <D.4625>;
  <D.4625>:
  if (__ch != 0) goto <D.4617>; else goto <D.4618>;
  <D.4617>:
  __warn_memset_zero_len ();
  D.4626 = __dest;
  return D.4626;
  <D.4618>:
  <D.4623>:
  <D.4621>:
  D.4627 = __builtin_object_size (__dest, 0);
  D.4626 = __builtin___memset_chk (__dest, __ch, __len, D.4627);
  return D.4626;
}


alloc_hdr ()
{
  struct hdr * hdr_free_list.7;
  struct hblk * hdr_free_list.8;
  struct hdr * D.4634;
  register struct hdr * result;

  hdr_free_list.7 = hdr_free_list;
  if (hdr_free_list.7 == 0B) goto <D.4630>; else goto <D.4631>;
  <D.4630>:
  result = GC_scratch_alloc (152);
  goto <D.4632>;
  <D.4631>:
  result = hdr_free_list;
  hdr_free_list.8 = result->hb_next;
  hdr_free_list = hdr_free_list.8;
  <D.4632>:
  D.4634 = result;
  return D.4634;
}


GC_install_header (struct hblk * h)
{
  long unsigned int h.9;
  int D.4637;
  struct hblkhdr * D.4640;
  long unsigned int D.4641;
  struct bottom_index * D.4642;
  long unsigned int D.4643;
  long unsigned int D.4644;
  long unsigned int GC_gc_no.10;
  short unsigned int D.4646;
  struct hdr * result;

  h.9 = (long unsigned int) h;
  D.4637 = get_index (h.9);
  if (D.4637 == 0) goto <D.4638>; else goto <D.4639>;
  <D.4638>:
  D.4640 = 0B;
  return D.4640;
  <D.4639>:
  result = alloc_hdr ();
  h.9 = (long unsigned int) h;
  D.4641 = h.9 >> 22;
  D.4642 = GC_arrays._top_index[D.4641];
  h.9 = (long unsigned int) h;
  D.4643 = h.9 >> 12;
  D.4644 = D.4643 & 1023;
  D.4642->index[D.4644] = result;
  GC_gc_no.10 = GC_gc_no;
  D.4646 = (short unsigned int) GC_gc_no.10;
  result->hb_last_reclaimed = D.4646;
  D.4640 = result;
  return D.4640;
}


get_index (word addr)
{
  struct bottom_index * D.4648;
  struct bottom_index * D.4649;
  GC_bool D.4652;
  long unsigned int D.4656;
  word hi;
  struct bottom_index * r;
  struct bottom_index * p;
  struct bottom_index * * prev;
  struct bottom_index * pi;

  hi = addr >> 22;
  D.4648 = GC_arrays._top_index[hi];
  D.4649 = GC_arrays._all_nils;
  if (D.4648 != D.4649) goto <D.4650>; else goto <D.4651>;
  <D.4650>:
  D.4652 = 1;
  return D.4652;
  <D.4651>:
  r = GC_scratch_alloc (4108);
  if (r == 0B) goto <D.4653>; else goto <D.4654>;
  <D.4653>:
  D.4652 = 0;
  return D.4652;
  <D.4654>:
  GC_arrays._top_index[hi] = r;
  memset (r, 0, 4108);
  r->key = hi;
  prev = &GC_all_bottom_indices;
  pi = 0B;
  goto <D.4511>;
  <D.4510>:
  pi = p;
  prev = &p->asc_link;
  <D.4511>:
  p = *prev;
  if (p != 0B) goto <D.4655>; else goto <D.4512>;
  <D.4655>:
  D.4656 = p->key;
  if (D.4656 < hi) goto <D.4510>; else goto <D.4512>;
  <D.4512>:
  r->desc_link = pi;
  if (p == 0B) goto <D.4657>; else goto <D.4658>;
  <D.4657>:
  GC_all_bottom_indices_end = r;
  goto <D.4659>;
  <D.4658>:
  p->desc_link = r;
  <D.4659>:
  r->asc_link = p;
  *prev = r;
  D.4652 = 1;
  return D.4652;
}


GC_install_counts (struct hblk * h, word sz)
{
  long unsigned int hbp.11;
  int D.4662;
  GC_bool D.4665;
  char * D.4666;
  long unsigned int h.12;
  long unsigned int D.4668;
  long unsigned int D.4669;
  int D.4670;
  int hbp.13;
  int h.14;
  int D.4675;
  long unsigned int D.4676;
  struct bottom_index * D.4677;
  long unsigned int D.4678;
  long unsigned int D.4679;
  long unsigned int i.15;
  long unsigned int D.4681;
  struct hdr * D.4682;
  register struct hblk * hbp;
  register int i;

  hbp = h;
  goto <D.4524>;
  <D.4523>:
  hbp.11 = (long unsigned int) hbp;
  D.4662 = get_index (hbp.11);
  if (D.4662 == 0) goto <D.4663>; else goto <D.4664>;
  <D.4663>:
  D.4665 = 0;
  return D.4665;
  <D.4664>:
  hbp = hbp + 4194304;
  <D.4524>:
  D.4666 = h + sz;
  if (D.4666 > hbp) goto <D.4523>; else goto <D.4525>;
  <D.4525>:
  h.12 = (long unsigned int) h;
  D.4668 = h.12 + sz;
  D.4669 = D.4668 + 4294967295;
  D.4670 = get_index (D.4669);
  if (D.4670 == 0) goto <D.4671>; else goto <D.4672>;
  <D.4671>:
  D.4665 = 0;
  return D.4665;
  <D.4672>:
  hbp = h + 4096;
  goto <D.4527>;
  <D.4526>:
  hbp.13 = (int) hbp;
  h.14 = (int) h;
  D.4675 = hbp.13 - h.14;
  i = D.4675 >> 12;
  hbp.11 = (long unsigned int) hbp;
  D.4676 = hbp.11 >> 22;
  D.4677 = GC_arrays._top_index[D.4676];
  hbp.11 = (long unsigned int) hbp;
  D.4678 = hbp.11 >> 12;
  D.4679 = D.4678 & 1023;
  i.15 = (long unsigned int) i;
  D.4681 = MIN_EXPR <i.15, 4095>;
  D.4682 = (struct hdr *) D.4681;
  D.4677->index[D.4679] = D.4682;
  hbp = hbp + 4096;
  <D.4527>:
  D.4666 = h + sz;
  if (D.4666 > hbp) goto <D.4526>; else goto <D.4528>;
  <D.4528>:
  D.4665 = 1;
  return D.4665;
}


GC_remove_header (struct hblk * h)
{
  long unsigned int h.16;
  long unsigned int D.4685;
  struct bottom_index * D.4686;
  long unsigned int D.4687;
  long unsigned int D.4688;
  struct hdr * D.4689;
  struct hdr * * ha;

  h.16 = (long unsigned int) h;
  D.4685 = h.16 >> 22;
  D.4686 = GC_arrays._top_index[D.4685];
  h.16 = (long unsigned int) h;
  D.4687 = h.16 >> 12;
  D.4688 = D.4687 & 1023;
  ha = &D.4686->index[D.4688];
  D.4689 = *ha;
  free_hdr (D.4689);
  *ha = 0B;
}


free_hdr (struct hdr * hhdr)
{
  struct hdr * hdr_free_list.17;

  hdr_free_list.17 = hdr_free_list;
  hhdr->hb_next = hdr_free_list.17;
  hdr_free_list = hhdr;
}


GC_remove_counts (struct hblk * h, word sz)
{
  long unsigned int hbp.18;
  long unsigned int D.4692;
  struct bottom_index * D.4693;
  long unsigned int D.4694;
  long unsigned int D.4695;
  char * D.4696;
  register struct hblk * hbp;

  hbp = h + 4096;
  goto <D.4539>;
  <D.4538>:
  hbp.18 = (long unsigned int) hbp;
  D.4692 = hbp.18 >> 22;
  D.4693 = GC_arrays._top_index[D.4692];
  hbp.18 = (long unsigned int) hbp;
  D.4694 = hbp.18 >> 12;
  D.4695 = D.4694 & 1023;
  D.4693->index[D.4695] = 0B;
  hbp = hbp + 4096;
  <D.4539>:
  D.4696 = h + sz;
  if (D.4696 > hbp) goto <D.4538>; else goto <D.4540>;
  <D.4540>:
}


GC_apply_to_all_blocks (void (*<Tc0e>) (struct hblk *, word) fn, word client_data)
{
  struct hdr * D.4697;
  long unsigned int D.4698;
  map_entry_type * D.4701;
  map_entry_type * GC_invalid_map.19;
  long unsigned int D.4705;
  long unsigned int D.4706;
  long unsigned int j.20;
  long unsigned int D.4708;
  long unsigned int D.4709;
  struct hblk * D.4710;
  long unsigned int D.4715;
  register int j;
  register struct bottom_index * index_p;

  index_p = GC_all_bottom_indices;
  goto <D.4553>;
  <D.4552>:
  j = 1023;
  goto <D.4550>;
  <D.4549>:
  D.4697 = index_p->index[j];
  D.4698 = (long unsigned int) D.4697;
  if (D.4698 > 4095) goto <D.4699>; else goto <D.4700>;
  <D.4699>:
  D.4697 = index_p->index[j];
  D.4701 = D.4697->hb_map;
  GC_invalid_map.19 = GC_invalid_map;
  if (D.4701 != GC_invalid_map.19) goto <D.4703>; else goto <D.4704>;
  <D.4703>:
  D.4705 = index_p->key;
  D.4706 = D.4705 << 10;
  j.20 = (long unsigned int) j;
  D.4708 = D.4706 + j.20;
  D.4709 = D.4708 << 12;
  D.4710 = (struct hblk *) D.4709;
  fn (D.4710, client_data);
  <D.4704>:
  j = j + -1;
  goto <D.4711>;
  <D.4700>:
  D.4697 = index_p->index[j];
  if (D.4697 == 0B) goto <D.4712>; else goto <D.4713>;
  <D.4712>:
  j = j + -1;
  goto <D.4714>;
  <D.4713>:
  j.20 = (long unsigned int) j;
  D.4697 = index_p->index[j];
  D.4698 = (long unsigned int) D.4697;
  D.4715 = j.20 - D.4698;
  j = (int) D.4715;
  <D.4714>:
  <D.4711>:
  <D.4550>:
  if (j >= 0) goto <D.4549>; else goto <D.4551>;
  <D.4551>:
  index_p = index_p->asc_link;
  <D.4553>:
  if (index_p != 0B) goto <D.4552>; else goto <D.4554>;
  <D.4554>:
}


GC_next_used_block (struct hblk * h)
{
  long unsigned int h.21;
  long unsigned int D.4717;
  long unsigned int D.4718;
  struct bottom_index * D.4719;
  long unsigned int D.4723;
  long unsigned int hhdr.22;
  map_entry_type * D.4728;
  map_entry_type * GC_invalid_map.23;
  struct hblk * D.4732;
  long unsigned int D.4733;
  long unsigned int D.4734;
  long unsigned int D.4735;
  long unsigned int D.4736;
  long unsigned int D.4737;
  register struct bottom_index * bi;
  register word j;

  h.21 = (long unsigned int) h;
  D.4717 = h.21 >> 12;
  j = D.4717 & 1023;
  h.21 = (long unsigned int) h;
  D.4718 = h.21 >> 22;
  bi = GC_arrays._top_index[D.4718];
  D.4719 = GC_arrays._all_nils;
  if (D.4719 == bi) goto <D.4720>; else goto <D.4721>;
  <D.4720>:
  {
    register word hi;

    h.21 = (long unsigned int) h;
    hi = h.21 >> 22;
    bi = GC_all_bottom_indices;
    goto <D.4562>;
    <D.4561>:
    bi = bi->asc_link;
    <D.4562>:
    if (bi != 0B) goto <D.4722>; else goto <D.4563>;
    <D.4722>:
    D.4723 = bi->key;
    if (D.4723 < hi) goto <D.4561>; else goto <D.4563>;
    <D.4563>:
    j = 0;
  }
  <D.4721>:
  goto <D.4569>;
  <D.4568>:
  goto <D.4566>;
  <D.4565>:
  {
    struct hdr * hhdr;

    hhdr = bi->index[j];
    hhdr.22 = (long unsigned int) hhdr;
    if (hhdr.22 <= 4095) goto <D.4725>; else goto <D.4726>;
    <D.4725>:
    j = j + 1;
    goto <D.4727>;
    <D.4726>:
    D.4728 = hhdr->hb_map;
    GC_invalid_map.23 = GC_invalid_map;
    if (D.4728 != GC_invalid_map.23) goto <D.4730>; else goto <D.4731>;
    <D.4730>:
    D.4723 = bi->key;
    D.4733 = D.4723 << 10;
    D.4734 = D.4733 + j;
    D.4735 = D.4734 << 12;
    D.4732 = (struct hblk *) D.4735;
    return D.4732;
    <D.4731>:
    D.4736 = hhdr->hb_sz;
    D.4737 = D.4736 >> 12;
    j = D.4737 + j;
    <D.4727>:
  }
  <D.4566>:
  if (j <= 1023) goto <D.4565>; else goto <D.4567>;
  <D.4567>:
  j = 0;
  bi = bi->asc_link;
  <D.4569>:
  if (bi != 0B) goto <D.4568>; else goto <D.4570>;
  <D.4570>:
  D.4732 = 0B;
  return D.4732;
}


GC_prev_block (struct hblk * h)
{
  long unsigned int h.24;
  long unsigned int D.4740;
  long int D.4741;
  long unsigned int D.4742;
  struct bottom_index * D.4743;
  long unsigned int D.4747;
  long unsigned int hhdr.25;
  long int hhdr.26;
  struct hblk * D.4756;
  long unsigned int D.4757;
  long unsigned int j.27;
  long unsigned int D.4759;
  long unsigned int D.4760;
  register struct bottom_index * bi;
  register signed_word j;

  h.24 = (long unsigned int) h;
  D.4740 = h.24 >> 12;
  D.4741 = (long int) D.4740;
  j = D.4741 & 1023;
  h.24 = (long unsigned int) h;
  D.4742 = h.24 >> 22;
  bi = GC_arrays._top_index[D.4742];
  D.4743 = GC_arrays._all_nils;
  if (D.4743 == bi) goto <D.4744>; else goto <D.4745>;
  <D.4744>:
  {
    register word hi;

    h.24 = (long unsigned int) h;
    hi = h.24 >> 22;
    bi = GC_all_bottom_indices_end;
    goto <D.4578>;
    <D.4577>:
    bi = bi->desc_link;
    <D.4578>:
    if (bi != 0B) goto <D.4746>; else goto <D.4579>;
    <D.4746>:
    D.4747 = bi->key;
    if (D.4747 > hi) goto <D.4577>; else goto <D.4579>;
    <D.4579>:
    j = 1023;
  }
  <D.4745>:
  goto <D.4585>;
  <D.4584>:
  goto <D.4582>;
  <D.4581>:
  {
    struct hdr * hhdr;

    hhdr = bi->index[j];
    if (hhdr == 0B) goto <D.4748>; else goto <D.4749>;
    <D.4748>:
    j = j + -1;
    goto <D.4750>;
    <D.4749>:
    hhdr.25 = (long unsigned int) hhdr;
    if (hhdr.25 <= 4095) goto <D.4752>; else goto <D.4753>;
    <D.4752>:
    hhdr.26 = (long int) hhdr;
    j = j - hhdr.26;
    goto <D.4755>;
    <D.4753>:
    D.4747 = bi->key;
    D.4757 = D.4747 << 10;
    j.27 = (long unsigned int) j;
    D.4759 = D.4757 + j.27;
    D.4760 = D.4759 << 12;
    D.4756 = (struct hblk *) D.4760;
    return D.4756;
    <D.4755>:
    <D.4750>:
  }
  <D.4582>:
  if (j >= 0) goto <D.4581>; else goto <D.4583>;
  <D.4583>:
  j = 1023;
  bi = bi->desc_link;
  <D.4585>:
  if (bi != 0B) goto <D.4584>; else goto <D.4586>;
  <D.4586>:
  D.4756 = 0B;
  return D.4756;
}


