sgen_hash_table_lookup (struct SgenHashTable * hash_table, void * key)
{
  void * D.18136;
  struct SgenHashTableEntry * entry;

  entry = lookup (hash_table, key, 0B);
  if (entry == 0B) goto <D.18134>; else goto <D.18135>;
  <D.18134>:
  D.18136 = 0B;
  return D.18136;
  <D.18135>:
  D.18136 = &entry->data;
  return D.18136;
}


lookup (struct SgenHashTable * hash_table, void * key, guint * _hash)
{
  unsigned int D.18138;
  struct SgenHashTableEntry * D.18141;
  guint (*<Tcb7>) (const void *) D.18142;
  unsigned int D.18143;
  struct SgenHashTableEntry * * D.18146;
  long unsigned int D.18147;
  long unsigned int D.18148;
  struct SgenHashTableEntry * * D.18149;
  void * D.18154;
  int D.18155;
  struct SgenHashTableEntry * entry;
  guint hash;
  gboolean (*GEqualFunc) (const void *, const void *) equal;

  equal = hash_table->equal_func;
  D.18138 = hash_table->size;
  if (D.18138 == 0) goto <D.18139>; else goto <D.18140>;
  <D.18139>:
  D.18141 = 0B;
  return D.18141;
  <D.18140>:
  D.18142 = hash_table->hash_func;
  D.18143 = D.18142 (key);
  D.18138 = hash_table->size;
  hash = D.18143 % D.18138;
  if (_hash != 0B) goto <D.18144>; else goto <D.18145>;
  <D.18144>:
  *_hash = hash;
  <D.18145>:
  D.18146 = hash_table->table;
  D.18147 = (long unsigned int) hash;
  D.18148 = D.18147 * 8;
  D.18149 = D.18146 + D.18148;
  entry = *D.18149;
  goto <D.18079>;
  <D.18078>:
  if (equal != 0B) goto <D.18153>; else goto <D.18150>;
  <D.18153>:
  D.18154 = entry->key;
  D.18155 = equal (D.18154, key);
  if (D.18155 != 0) goto <D.18151>; else goto <D.18150>;
  <D.18150>:
  if (equal == 0B) goto <D.18156>; else goto <D.18152>;
  <D.18156>:
  D.18154 = entry->key;
  if (D.18154 == key) goto <D.18151>; else goto <D.18152>;
  <D.18151>:
  D.18141 = entry;
  return D.18141;
  <D.18152>:
  entry = entry->next;
  <D.18079>:
  if (entry != 0B) goto <D.18078>; else goto <D.18080>;
  <D.18080>:
  D.18141 = 0B;
  return D.18141;
}


sgen_hash_table_replace (struct SgenHashTable * hash_table, void * key, void * new_value, void * old_value)
{
  char[0:] * D.18162;
  long unsigned int D.18163;
  gboolean D.18164;
  int D.18165;
  struct SgenHashTableEntry * * D.18166;
  unsigned int hash.0;
  long unsigned int D.18168;
  long unsigned int D.18169;
  struct SgenHashTableEntry * * D.18170;
  struct SgenHashTableEntry * D.18171;
  unsigned int D.18172;
  unsigned int D.18173;
  guint hash;
  struct SgenHashTableEntry * entry;

  try
    {
      rehash_if_necessary (hash_table);
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.18158>; else goto <D.18159>;
      <D.18158>:
      if (old_value != 0B) goto <D.18160>; else goto <D.18161>;
      <D.18160>:
      D.18162 = &entry->data;
      D.18163 = hash_table->data_size;
      memcpy (old_value, D.18162, D.18163);
      <D.18161>:
      D.18162 = &entry->data;
      D.18163 = hash_table->data_size;
      memcpy (D.18162, new_value, D.18163);
      D.18164 = 0;
      return D.18164;
      <D.18159>:
      D.18165 = hash_table->entry_mem_type;
      entry = sgen_alloc_internal (D.18165);
      entry->key = key;
      D.18162 = &entry->data;
      D.18163 = hash_table->data_size;
      memcpy (D.18162, new_value, D.18163);
      D.18166 = hash_table->table;
      hash.0 = hash;
      D.18168 = (long unsigned int) hash.0;
      D.18169 = D.18168 * 8;
      D.18170 = D.18166 + D.18169;
      D.18171 = *D.18170;
      entry->next = D.18171;
      D.18166 = hash_table->table;
      hash.0 = hash;
      D.18168 = (long unsigned int) hash.0;
      D.18169 = D.18168 * 8;
      D.18170 = D.18166 + D.18169;
      *D.18170 = entry;
      D.18172 = hash_table->num_entries;
      D.18173 = D.18172 + 1;
      hash_table->num_entries = D.18173;
      D.18164 = 1;
      return D.18164;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


rehash_if_necessary (struct SgenHashTable * hash_table)
{
  unsigned int D.18176;
  unsigned int D.18177;
  unsigned int D.18178;

  D.18176 = hash_table->num_entries;
  D.18177 = hash_table->size;
  D.18178 = D.18177 * 2;
  if (D.18176 >= D.18178) goto <D.18179>; else goto <D.18180>;
  <D.18179>:
  rehash (hash_table);
  <D.18180>:
}


rehash (struct SgenHashTable * hash_table)
{
  int D.18183;
  long unsigned int D.18184;
  long unsigned int D.18185;
  unsigned int D.18187;
  long unsigned int D.18188;
  long unsigned int D.18189;
  int D.18190;
  long unsigned int D.18191;
  long unsigned int D.18192;
  struct SgenHashTableEntry * * D.18193;
  guint (*<Tcb7>) (const void *) D.18194;
  void * D.18195;
  unsigned int D.18196;
  long unsigned int D.18197;
  long unsigned int D.18198;
  struct SgenHashTableEntry * * D.18199;
  struct SgenHashTableEntry * D.18200;
  long unsigned int D.18201;
  long unsigned int D.18202;
  struct SgenHashTableEntry * * old_hash;
  guint old_hash_size;
  guint i;
  guint hash;
  guint new_size;
  struct SgenHashTableEntry * * new_hash;
  struct SgenHashTableEntry * entry;
  struct SgenHashTableEntry * next;

  old_hash = hash_table->table;
  old_hash_size = hash_table->size;
  if (old_hash == 0B) goto <D.18181>; else goto <D.18182>;
  <D.18181>:
  D.18183 = hash_table->entry_mem_type;
  D.18184 = hash_table->data_size;
  D.18185 = D.18184 + 16;
  sgen_register_fixed_internal_mem_type (D.18183, D.18185);
  new_size = 13;
  goto <D.18186>;
  <D.18182>:
  D.18187 = hash_table->num_entries;
  new_size = monoeg_g_spaced_primes_closest (D.18187);
  <D.18186>:
  D.18188 = (long unsigned int) new_size;
  D.18189 = D.18188 * 8;
  D.18190 = hash_table->table_mem_type;
  new_hash = sgen_alloc_internal_dynamic (D.18189, D.18190, 1);
  i = 0;
  goto <D.18065>;
  <D.18064>:
  D.18191 = (long unsigned int) i;
  D.18192 = D.18191 * 8;
  D.18193 = old_hash + D.18192;
  entry = *D.18193;
  goto <D.18062>;
  <D.18061>:
  D.18194 = hash_table->hash_func;
  D.18195 = entry->key;
  D.18196 = D.18194 (D.18195);
  hash = D.18196 % new_size;
  next = entry->next;
  D.18197 = (long unsigned int) hash;
  D.18198 = D.18197 * 8;
  D.18199 = new_hash + D.18198;
  D.18200 = *D.18199;
  entry->next = D.18200;
  D.18197 = (long unsigned int) hash;
  D.18198 = D.18197 * 8;
  D.18199 = new_hash + D.18198;
  *D.18199 = entry;
  entry = next;
  <D.18062>:
  if (entry != 0B) goto <D.18061>; else goto <D.18063>;
  <D.18063>:
  i = i + 1;
  <D.18065>:
  if (i < old_hash_size) goto <D.18064>; else goto <D.18066>;
  <D.18066>:
  D.18201 = (long unsigned int) old_hash_size;
  D.18202 = D.18201 * 8;
  D.18190 = hash_table->table_mem_type;
  sgen_free_internal_dynamic (old_hash, D.18202, D.18190);
  hash_table->table = new_hash;
  hash_table->size = new_size;
}


memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.18203;
  long unsigned int D.18204;

  D.18204 = __builtin_object_size (__dest, 0);
  D.18203 = __builtin___memcpy_chk (__dest, __src, __len, D.18204);
  return D.18203;
}


sgen_hash_table_set_value (struct SgenHashTable * hash_table, void * key, void * new_value, void * old_value)
{
  char[0:] * D.18210;
  long unsigned int D.18211;
  gboolean D.18212;
  guint hash;
  struct SgenHashTableEntry * entry;

  try
    {
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.18206>; else goto <D.18207>;
      <D.18206>:
      if (old_value != 0B) goto <D.18208>; else goto <D.18209>;
      <D.18208>:
      D.18210 = &entry->data;
      D.18211 = hash_table->data_size;
      memcpy (old_value, D.18210, D.18211);
      <D.18209>:
      D.18210 = &entry->data;
      D.18211 = hash_table->data_size;
      memcpy (D.18210, new_value, D.18211);
      D.18212 = 1;
      return D.18212;
      <D.18207>:
      D.18212 = 0;
      return D.18212;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


sgen_hash_table_set_key (struct SgenHashTable * hash_table, void * old_key, void * new_key)
{
  gboolean D.18217;
  guint hash;
  struct SgenHashTableEntry * entry;

  try
    {
      entry = lookup (hash_table, old_key, &hash);
      if (entry != 0B) goto <D.18215>; else goto <D.18216>;
      <D.18215>:
      entry->key = new_key;
      D.18217 = 1;
      return D.18217;
      <D.18216>:
      D.18217 = 0;
      return D.18217;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


sgen_hash_table_remove (struct SgenHashTable * hash_table, void * key, void * data_return)
{
  guint (*<Tcb7>) (const void *) D.18220;
  unsigned int D.18221;
  unsigned int D.18222;
  struct SgenHashTableEntry * * D.18223;
  long unsigned int D.18224;
  long unsigned int D.18225;
  struct SgenHashTableEntry * * D.18226;
  void * D.18231;
  int D.18232;
  struct SgenHashTableEntry * D.18236;
  unsigned int D.18238;
  unsigned int D.18239;
  char[0:] * D.18242;
  long unsigned int D.18243;
  int D.18244;
  gboolean D.18245;
  struct SgenHashTableEntry * entry;
  struct SgenHashTableEntry * prev;
  guint hash;
  gboolean (*GEqualFunc) (const void *, const void *) equal;

  equal = hash_table->equal_func;
  rehash_if_necessary (hash_table);
  D.18220 = hash_table->hash_func;
  D.18221 = D.18220 (key);
  D.18222 = hash_table->size;
  hash = D.18221 % D.18222;
  prev = 0B;
  D.18223 = hash_table->table;
  D.18224 = (long unsigned int) hash;
  D.18225 = D.18224 * 8;
  D.18226 = D.18223 + D.18225;
  entry = *D.18226;
  goto <D.18119>;
  <D.18118>:
  if (equal != 0B) goto <D.18230>; else goto <D.18227>;
  <D.18230>:
  D.18231 = entry->key;
  D.18232 = equal (D.18231, key);
  if (D.18232 != 0) goto <D.18228>; else goto <D.18227>;
  <D.18227>:
  if (equal == 0B) goto <D.18233>; else goto <D.18229>;
  <D.18233>:
  D.18231 = entry->key;
  if (D.18231 == key) goto <D.18228>; else goto <D.18229>;
  <D.18228>:
  if (prev != 0B) goto <D.18234>; else goto <D.18235>;
  <D.18234>:
  D.18236 = entry->next;
  prev->next = D.18236;
  goto <D.18237>;
  <D.18235>:
  D.18223 = hash_table->table;
  D.18224 = (long unsigned int) hash;
  D.18225 = D.18224 * 8;
  D.18226 = D.18223 + D.18225;
  D.18236 = entry->next;
  *D.18226 = D.18236;
  <D.18237>:
  D.18238 = hash_table->num_entries;
  D.18239 = D.18238 + 4294967295;
  hash_table->num_entries = D.18239;
  if (data_return != 0B) goto <D.18240>; else goto <D.18241>;
  <D.18240>:
  D.18242 = &entry->data;
  D.18243 = hash_table->data_size;
  memcpy (data_return, D.18242, D.18243);
  <D.18241>:
  D.18244 = hash_table->entry_mem_type;
  sgen_free_internal (entry, D.18244);
  D.18245 = 1;
  return D.18245;
  <D.18229>:
  prev = entry;
  entry = entry->next;
  <D.18119>:
  if (entry != 0B) goto <D.18118>; else goto <D.18120>;
  <D.18120>:
  D.18245 = 0;
  return D.18245;
}


sgen_hash_table_clean (struct SgenHashTable * hash_table)
{
  unsigned int D.18247;
  struct SgenHashTableEntry * * D.18250;
  _Bool D.18251;
  long int D.18252;
  long int D.18253;
  unsigned int D.18256;
  _Bool D.18257;
  long int D.18258;
  long int D.18259;
  long unsigned int D.18262;
  long unsigned int D.18263;
  struct SgenHashTableEntry * * D.18264;
  int D.18265;
  long unsigned int D.18266;
  long unsigned int D.18267;
  int D.18268;
  guint i;

  D.18247 = hash_table->size;
  if (D.18247 == 0) goto <D.18248>; else goto <D.18249>;
  <D.18248>:
  D.18250 = hash_table->table;
  D.18251 = D.18250 != 0B;
  D.18252 = (long int) D.18251;
  D.18253 = __builtin_expect (D.18252, 0);
  if (D.18253 != 0) goto <D.18254>; else goto <D.18255>;
  <D.18254>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 200, "!hash_table->table");
  <D.18255>:
  D.18256 = hash_table->num_entries;
  D.18257 = D.18256 != 0;
  D.18258 = (long int) D.18257;
  D.18259 = __builtin_expect (D.18258, 0);
  if (D.18259 != 0) goto <D.18260>; else goto <D.18261>;
  <D.18260>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 201, "!hash_table->num_entries");
  <D.18261>:
  return;
  <D.18249>:
  i = 0;
  goto <D.18131>;
  <D.18130>:
  {
    struct SgenHashTableEntry * entry;

    D.18250 = hash_table->table;
    D.18262 = (long unsigned int) i;
    D.18263 = D.18262 * 8;
    D.18264 = D.18250 + D.18263;
    entry = *D.18264;
    goto <D.18128>;
    <D.18127>:
    {
      struct SgenHashTableEntry * next;

      next = entry->next;
      D.18265 = hash_table->entry_mem_type;
      sgen_free_internal (entry, D.18265);
      entry = next;
    }
    <D.18128>:
    if (entry != 0B) goto <D.18127>; else goto <D.18129>;
    <D.18129>:
  }
  i = i + 1;
  <D.18131>:
  D.18247 = hash_table->size;
  if (D.18247 > i) goto <D.18130>; else goto <D.18132>;
  <D.18132>:
  D.18250 = hash_table->table;
  D.18247 = hash_table->size;
  D.18266 = (long unsigned int) D.18247;
  D.18267 = D.18266 * 8;
  D.18268 = hash_table->table_mem_type;
  sgen_free_internal_dynamic (D.18250, D.18267, D.18268);
  hash_table->table = 0B;
  hash_table->size = 0;
  hash_table->num_entries = 0;
}


