GC_find_header (char * h)
{
  struct hdr * D.7101;
  long unsigned int h.0;
  long unsigned int D.7103;
  struct bottom_index * D.7104;
  long unsigned int D.7105;
  long unsigned int D.7106;

  h.0 = (long unsigned int) h;
  D.7103 = h.0 >> 22;
  D.7104 = GC_arrays._top_index[D.7103];
  h.0 = (long unsigned int) h;
  D.7105 = h.0 >> 12;
  D.7106 = D.7105 & 1023;
  D.7101 = D.7104->index[D.7106];
  return D.7101;
}


GC_scratch_alloc (word bytes)
{
  char * scratch_free_ptr.1;
  char * scratch_free_ptr.2;
  char * D.7110;
  char * D.7113;
  long unsigned int GC_page_size.3;
  long unsigned int D.7117;
  long unsigned int D.7118;
  sizetype D.7119;
  char * scratch_free_ptr.4;
  char * D.7121;
  char * D.7124;
  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.7110 = GC_arrays._scratch_end_ptr;
  scratch_free_ptr.1 = scratch_free_ptr;
  if (D.7110 >= scratch_free_ptr.1) goto <D.7111>; else goto <D.7112>;
  <D.7111>:
  D.7113 = result;
  return D.7113;
  <D.7112>:
  {
    word bytes_to_get;

    bytes_to_get = 65536;
    if (bytes_to_get <= bytes) goto <D.7114>; else goto <D.7115>;
    <D.7114>:
    bytes_to_get = bytes;
    GC_page_size.3 = GC_page_size;
    D.7117 = GC_page_size.3 + bytes_to_get;
    bytes_to_get = D.7117 + 4294967295;
    GC_page_size.3 = GC_page_size;
    D.7118 = -GC_page_size.3;
    bytes_to_get = D.7118 & bytes_to_get;
    result = GC_unix_get_mem (bytes_to_get);
    scratch_free_ptr.1 = scratch_free_ptr;
    D.7119 = -bytes;
    scratch_free_ptr.4 = scratch_free_ptr.1 + D.7119;
    scratch_free_ptr = scratch_free_ptr.4;
    D.7121 = result + bytes;
    GC_arrays._scratch_last_end_ptr = D.7121;
    D.7113 = result;
    return D.7113;
    <D.7115>:
    result = GC_unix_get_mem (bytes_to_get);
    if (result == 0B) goto <D.7122>; else goto <D.7123>;
    <D.7122>:
    scratch_free_ptr.1 = scratch_free_ptr;
    D.7119 = -bytes;
    scratch_free_ptr.4 = scratch_free_ptr.1 + D.7119;
    scratch_free_ptr = scratch_free_ptr.4;
    bytes_to_get = bytes;
    GC_page_size.3 = GC_page_size;
    D.7117 = GC_page_size.3 + bytes_to_get;
    bytes_to_get = D.7117 + 4294967295;
    GC_page_size.3 = GC_page_size;
    D.7118 = -GC_page_size.3;
    bytes_to_get = D.7118 & bytes_to_get;
    D.7113 = GC_unix_get_mem (bytes_to_get);
    return D.7113;
    <D.7123>:
    scratch_free_ptr = result;
    scratch_free_ptr.1 = scratch_free_ptr;
    D.7124 = scratch_free_ptr.1 + bytes_to_get;
    GC_arrays._scratch_end_ptr = D.7124;
    D.7110 = GC_arrays._scratch_end_ptr;
    GC_arrays._scratch_last_end_ptr = D.7110;
    D.7113 = GC_scratch_alloc (bytes);
    return D.7113;
  }
}


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

  D.7126 = GC_scratch_alloc (4108);
  GC_arrays._all_nils = D.7126;
  D.7127 = GC_arrays._all_nils;
  memset (D.7127, 0, 4108);
  i = 0;
  goto <D.7011>;
  <D.7010>:
  D.7127 = GC_arrays._all_nils;
  GC_arrays._top_index[i] = D.7127;
  i = i + 1;
  <D.7011>:
  if (i <= 1023) goto <D.7010>; else goto <D.7012>;
  <D.7012>:
  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.7132;
  int D.7137;
  void * D.7139;
  unsigned int D.7140;

  D.7132 = __builtin_constant_p (__len);
  if (D.7132 != 0) goto <D.7133>; else goto <D.7134>;
  <D.7133>:
  if (__len == 0) goto <D.7135>; else goto <D.7136>;
  <D.7135>:
  D.7137 = __builtin_constant_p (__ch);
  if (D.7137 == 0) goto <D.7130>; else goto <D.7138>;
  <D.7138>:
  if (__ch != 0) goto <D.7130>; else goto <D.7131>;
  <D.7130>:
  __warn_memset_zero_len ();
  D.7139 = __dest;
  return D.7139;
  <D.7131>:
  <D.7136>:
  <D.7134>:
  D.7140 = __builtin_object_size (__dest, 0);
  D.7139 = __builtin___memset_chk (__dest, __ch, __len, D.7140);
  return D.7139;
}


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

  hdr_free_list.7 = hdr_free_list;
  if (hdr_free_list.7 == 0B) goto <D.7143>; else goto <D.7144>;
  <D.7143>:
  result = GC_scratch_alloc (152);
  goto <D.7145>;
  <D.7144>:
  result = hdr_free_list;
  hdr_free_list.8 = result->hb_next;
  hdr_free_list = hdr_free_list.8;
  <D.7145>:
  D.7147 = result;
  return D.7147;
}


GC_install_header (struct hblk * h)
{
  long unsigned int h.9;
  int D.7150;
  struct hblkhdr * D.7153;
  long unsigned int D.7154;
  struct bottom_index * D.7155;
  long unsigned int D.7156;
  long unsigned int D.7157;
  long unsigned int GC_gc_no.10;
  short unsigned int D.7159;
  struct hdr * result;

  h.9 = (long unsigned int) h;
  D.7150 = get_index (h.9);
  if (D.7150 == 0) goto <D.7151>; else goto <D.7152>;
  <D.7151>:
  D.7153 = 0B;
  return D.7153;
  <D.7152>:
  result = alloc_hdr ();
  h.9 = (long unsigned int) h;
  D.7154 = h.9 >> 22;
  D.7155 = GC_arrays._top_index[D.7154];
  h.9 = (long unsigned int) h;
  D.7156 = h.9 >> 12;
  D.7157 = D.7156 & 1023;
  D.7155->index[D.7157] = result;
  GC_gc_no.10 = GC_gc_no;
  D.7159 = (short unsigned int) GC_gc_no.10;
  result->hb_last_reclaimed = D.7159;
  D.7153 = result;
  return D.7153;
}


get_index (word addr)
{
  struct bottom_index * D.7161;
  struct bottom_index * D.7162;
  GC_bool D.7165;
  long unsigned int D.7169;
  word hi;
  struct bottom_index * r;
  struct bottom_index * p;
  struct bottom_index * * prev;
  struct bottom_index * pi;

  hi = addr >> 22;
  D.7161 = GC_arrays._top_index[hi];
  D.7162 = GC_arrays._all_nils;
  if (D.7161 != D.7162) goto <D.7163>; else goto <D.7164>;
  <D.7163>:
  D.7165 = 1;
  return D.7165;
  <D.7164>:
  r = GC_scratch_alloc (4108);
  if (r == 0B) goto <D.7166>; else goto <D.7167>;
  <D.7166>:
  D.7165 = 0;
  return D.7165;
  <D.7167>:
  GC_arrays._top_index[hi] = r;
  memset (r, 0, 4108);
  r->key = hi;
  prev = &GC_all_bottom_indices;
  pi = 0B;
  goto <D.7022>;
  <D.7021>:
  pi = p;
  prev = &p->asc_link;
  <D.7022>:
  p = *prev;
  if (p != 0B) goto <D.7168>; else goto <D.7023>;
  <D.7168>:
  D.7169 = p->key;
  if (D.7169 < hi) goto <D.7021>; else goto <D.7023>;
  <D.7023>:
  r->desc_link = pi;
  if (p == 0B) goto <D.7170>; else goto <D.7171>;
  <D.7170>:
  GC_all_bottom_indices_end = r;
  goto <D.7172>;
  <D.7171>:
  p->desc_link = r;
  <D.7172>:
  r->asc_link = p;
  *prev = r;
  D.7165 = 1;
  return D.7165;
}


GC_install_counts (struct hblk * h, word sz)
{
  long unsigned int hbp.11;
  int D.7175;
  GC_bool D.7178;
  char * D.7179;
  long unsigned int h.12;
  long unsigned int D.7181;
  long unsigned int D.7182;
  int D.7183;
  int hbp.13;
  int h.14;
  int D.7188;
  long unsigned int D.7189;
  struct bottom_index * D.7190;
  long unsigned int D.7191;
  long unsigned int D.7192;
  long unsigned int i.15;
  long unsigned int D.7194;
  struct hdr * D.7195;
  register struct hblk * hbp;
  register int i;

  hbp = h;
  goto <D.7035>;
  <D.7034>:
  hbp.11 = (long unsigned int) hbp;
  D.7175 = get_index (hbp.11);
  if (D.7175 == 0) goto <D.7176>; else goto <D.7177>;
  <D.7176>:
  D.7178 = 0;
  return D.7178;
  <D.7177>:
  hbp = hbp + 4194304;
  <D.7035>:
  D.7179 = h + sz;
  if (D.7179 > hbp) goto <D.7034>; else goto <D.7036>;
  <D.7036>:
  h.12 = (long unsigned int) h;
  D.7181 = h.12 + sz;
  D.7182 = D.7181 + 4294967295;
  D.7183 = get_index (D.7182);
  if (D.7183 == 0) goto <D.7184>; else goto <D.7185>;
  <D.7184>:
  D.7178 = 0;
  return D.7178;
  <D.7185>:
  hbp = h + 4096;
  goto <D.7038>;
  <D.7037>:
  hbp.13 = (int) hbp;
  h.14 = (int) h;
  D.7188 = hbp.13 - h.14;
  i = D.7188 >> 12;
  hbp.11 = (long unsigned int) hbp;
  D.7189 = hbp.11 >> 22;
  D.7190 = GC_arrays._top_index[D.7189];
  hbp.11 = (long unsigned int) hbp;
  D.7191 = hbp.11 >> 12;
  D.7192 = D.7191 & 1023;
  i.15 = (long unsigned int) i;
  D.7194 = MIN_EXPR <i.15, 4095>;
  D.7195 = (struct hdr *) D.7194;
  D.7190->index[D.7192] = D.7195;
  hbp = hbp + 4096;
  <D.7038>:
  D.7179 = h + sz;
  if (D.7179 > hbp) goto <D.7037>; else goto <D.7039>;
  <D.7039>:
  D.7178 = 1;
  return D.7178;
}


GC_remove_header (struct hblk * h)
{
  long unsigned int h.16;
  long unsigned int D.7198;
  struct bottom_index * D.7199;
  long unsigned int D.7200;
  long unsigned int D.7201;
  struct hdr * D.7202;
  struct hdr * * ha;

  h.16 = (long unsigned int) h;
  D.7198 = h.16 >> 22;
  D.7199 = GC_arrays._top_index[D.7198];
  h.16 = (long unsigned int) h;
  D.7200 = h.16 >> 12;
  D.7201 = D.7200 & 1023;
  ha = &D.7199->index[D.7201];
  D.7202 = *ha;
  free_hdr (D.7202);
  *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.7205;
  struct bottom_index * D.7206;
  long unsigned int D.7207;
  long unsigned int D.7208;
  char * D.7209;
  register struct hblk * hbp;

  hbp = h + 4096;
  goto <D.7050>;
  <D.7049>:
  hbp.18 = (long unsigned int) hbp;
  D.7205 = hbp.18 >> 22;
  D.7206 = GC_arrays._top_index[D.7205];
  hbp.18 = (long unsigned int) hbp;
  D.7207 = hbp.18 >> 12;
  D.7208 = D.7207 & 1023;
  D.7206->index[D.7208] = 0B;
  hbp = hbp + 4096;
  <D.7050>:
  D.7209 = h + sz;
  if (D.7209 > hbp) goto <D.7049>; else goto <D.7051>;
  <D.7051>:
}


GC_apply_to_all_blocks (void (*<T1646>) (struct hblk *, word) fn, word client_data)
{
  struct hdr * D.7210;
  long unsigned int D.7211;
  map_entry_type * D.7214;
  map_entry_type * GC_invalid_map.19;
  long unsigned int D.7218;
  long unsigned int D.7219;
  long unsigned int j.20;
  long unsigned int D.7221;
  long unsigned int D.7222;
  struct hblk * D.7223;
  long unsigned int D.7228;
  register int j;
  register struct bottom_index * index_p;

  index_p = GC_all_bottom_indices;
  goto <D.7064>;
  <D.7063>:
  j = 1023;
  goto <D.7061>;
  <D.7060>:
  D.7210 = index_p->index[j];
  D.7211 = (long unsigned int) D.7210;
  if (D.7211 > 4095) goto <D.7212>; else goto <D.7213>;
  <D.7212>:
  D.7210 = index_p->index[j];
  D.7214 = D.7210->hb_map;
  GC_invalid_map.19 = GC_invalid_map;
  if (D.7214 != GC_invalid_map.19) goto <D.7216>; else goto <D.7217>;
  <D.7216>:
  D.7218 = index_p->key;
  D.7219 = D.7218 << 10;
  j.20 = (long unsigned int) j;
  D.7221 = D.7219 + j.20;
  D.7222 = D.7221 << 12;
  D.7223 = (struct hblk *) D.7222;
  fn (D.7223, client_data);
  <D.7217>:
  j = j + -1;
  goto <D.7224>;
  <D.7213>:
  D.7210 = index_p->index[j];
  if (D.7210 == 0B) goto <D.7225>; else goto <D.7226>;
  <D.7225>:
  j = j + -1;
  goto <D.7227>;
  <D.7226>:
  j.20 = (long unsigned int) j;
  D.7210 = index_p->index[j];
  D.7211 = (long unsigned int) D.7210;
  D.7228 = j.20 - D.7211;
  j = (int) D.7228;
  <D.7227>:
  <D.7224>:
  <D.7061>:
  if (j >= 0) goto <D.7060>; else goto <D.7062>;
  <D.7062>:
  index_p = index_p->asc_link;
  <D.7064>:
  if (index_p != 0B) goto <D.7063>; else goto <D.7065>;
  <D.7065>:
}


GC_next_used_block (struct hblk * h)
{
  long unsigned int h.21;
  long unsigned int D.7230;
  long unsigned int D.7231;
  struct bottom_index * D.7232;
  long unsigned int D.7236;
  long unsigned int hhdr.22;
  map_entry_type * D.7241;
  map_entry_type * GC_invalid_map.23;
  struct hblk * D.7245;
  long unsigned int D.7246;
  long unsigned int D.7247;
  long unsigned int D.7248;
  long unsigned int D.7249;
  long unsigned int D.7250;
  register struct bottom_index * bi;
  register word j;

  h.21 = (long unsigned int) h;
  D.7230 = h.21 >> 12;
  j = D.7230 & 1023;
  h.21 = (long unsigned int) h;
  D.7231 = h.21 >> 22;
  bi = GC_arrays._top_index[D.7231];
  D.7232 = GC_arrays._all_nils;
  if (D.7232 == bi) goto <D.7233>; else goto <D.7234>;
  <D.7233>:
  {
    register word hi;

    h.21 = (long unsigned int) h;
    hi = h.21 >> 22;
    bi = GC_all_bottom_indices;
    goto <D.7073>;
    <D.7072>:
    bi = bi->asc_link;
    <D.7073>:
    if (bi != 0B) goto <D.7235>; else goto <D.7074>;
    <D.7235>:
    D.7236 = bi->key;
    if (D.7236 < hi) goto <D.7072>; else goto <D.7074>;
    <D.7074>:
    j = 0;
  }
  <D.7234>:
  goto <D.7080>;
  <D.7079>:
  goto <D.7077>;
  <D.7076>:
  {
    struct hdr * hhdr;

    hhdr = bi->index[j];
    hhdr.22 = (long unsigned int) hhdr;
    if (hhdr.22 <= 4095) goto <D.7238>; else goto <D.7239>;
    <D.7238>:
    j = j + 1;
    goto <D.7240>;
    <D.7239>:
    D.7241 = hhdr->hb_map;
    GC_invalid_map.23 = GC_invalid_map;
    if (D.7241 != GC_invalid_map.23) goto <D.7243>; else goto <D.7244>;
    <D.7243>:
    D.7236 = bi->key;
    D.7246 = D.7236 << 10;
    D.7247 = D.7246 + j;
    D.7248 = D.7247 << 12;
    D.7245 = (struct hblk *) D.7248;
    return D.7245;
    <D.7244>:
    D.7249 = hhdr->hb_sz;
    D.7250 = D.7249 >> 12;
    j = D.7250 + j;
    <D.7240>:
  }
  <D.7077>:
  if (j <= 1023) goto <D.7076>; else goto <D.7078>;
  <D.7078>:
  j = 0;
  bi = bi->asc_link;
  <D.7080>:
  if (bi != 0B) goto <D.7079>; else goto <D.7081>;
  <D.7081>:
  D.7245 = 0B;
  return D.7245;
}


GC_prev_block (struct hblk * h)
{
  long unsigned int h.24;
  long unsigned int D.7253;
  long int D.7254;
  long unsigned int D.7255;
  struct bottom_index * D.7256;
  long unsigned int D.7260;
  long unsigned int hhdr.25;
  long int hhdr.26;
  struct hblk * D.7269;
  long unsigned int D.7270;
  long unsigned int j.27;
  long unsigned int D.7272;
  long unsigned int D.7273;
  register struct bottom_index * bi;
  register signed_word j;

  h.24 = (long unsigned int) h;
  D.7253 = h.24 >> 12;
  D.7254 = (long int) D.7253;
  j = D.7254 & 1023;
  h.24 = (long unsigned int) h;
  D.7255 = h.24 >> 22;
  bi = GC_arrays._top_index[D.7255];
  D.7256 = GC_arrays._all_nils;
  if (D.7256 == bi) goto <D.7257>; else goto <D.7258>;
  <D.7257>:
  {
    register word hi;

    h.24 = (long unsigned int) h;
    hi = h.24 >> 22;
    bi = GC_all_bottom_indices_end;
    goto <D.7089>;
    <D.7088>:
    bi = bi->desc_link;
    <D.7089>:
    if (bi != 0B) goto <D.7259>; else goto <D.7090>;
    <D.7259>:
    D.7260 = bi->key;
    if (D.7260 > hi) goto <D.7088>; else goto <D.7090>;
    <D.7090>:
    j = 1023;
  }
  <D.7258>:
  goto <D.7096>;
  <D.7095>:
  goto <D.7093>;
  <D.7092>:
  {
    struct hdr * hhdr;

    hhdr = bi->index[j];
    if (hhdr == 0B) goto <D.7261>; else goto <D.7262>;
    <D.7261>:
    j = j + -1;
    goto <D.7263>;
    <D.7262>:
    hhdr.25 = (long unsigned int) hhdr;
    if (hhdr.25 <= 4095) goto <D.7265>; else goto <D.7266>;
    <D.7265>:
    hhdr.26 = (long int) hhdr;
    j = j - hhdr.26;
    goto <D.7268>;
    <D.7266>:
    D.7260 = bi->key;
    D.7270 = D.7260 << 10;
    j.27 = (long unsigned int) j;
    D.7272 = D.7270 + j.27;
    D.7273 = D.7272 << 12;
    D.7269 = (struct hblk *) D.7273;
    return D.7269;
    <D.7268>:
    <D.7263>:
  }
  <D.7093>:
  if (j >= 0) goto <D.7092>; else goto <D.7094>;
  <D.7094>:
  j = 1023;
  bi = bi->desc_link;
  <D.7096>:
  if (bi != 0B) goto <D.7095>; else goto <D.7097>;
  <D.7097>:
  D.7269 = 0B;
  return D.7269;
}


