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

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


lookup (struct SgenHashTable * hash_table, void * key, guint * _hash)
{
  unsigned int D.19810;
  struct SgenHashTableEntry * D.19813;
  guint (*<T166e>) (const void *) D.19814;
  unsigned int D.19815;
  struct SgenHashTableEntry * * D.19818;
  unsigned int D.19819;
  struct SgenHashTableEntry * * D.19820;
  void * D.19825;
  int D.19826;
  struct SgenHashTableEntry * entry;
  guint hash;
  gboolean (*GEqualFunc) (const void *, const void *) equal;

  equal = hash_table->equal_func;
  D.19810 = hash_table->size;
  if (D.19810 == 0) goto <D.19811>; else goto <D.19812>;
  <D.19811>:
  D.19813 = 0B;
  return D.19813;
  <D.19812>:
  D.19814 = hash_table->hash_func;
  D.19815 = D.19814 (key);
  D.19810 = hash_table->size;
  hash = D.19815 % D.19810;
  if (_hash != 0B) goto <D.19816>; else goto <D.19817>;
  <D.19816>:
  *_hash = hash;
  <D.19817>:
  D.19818 = hash_table->table;
  D.19819 = hash * 4;
  D.19820 = D.19818 + D.19819;
  entry = *D.19820;
  goto <D.19749>;
  <D.19748>:
  if (equal != 0B) goto <D.19824>; else goto <D.19821>;
  <D.19824>:
  D.19825 = entry->key;
  D.19826 = equal (D.19825, key);
  if (D.19826 != 0) goto <D.19822>; else goto <D.19821>;
  <D.19821>:
  if (equal == 0B) goto <D.19827>; else goto <D.19823>;
  <D.19827>:
  D.19825 = entry->key;
  if (D.19825 == key) goto <D.19822>; else goto <D.19823>;
  <D.19822>:
  D.19813 = entry;
  return D.19813;
  <D.19823>:
  entry = entry->next;
  <D.19749>:
  if (entry != 0B) goto <D.19748>; else goto <D.19750>;
  <D.19750>:
  D.19813 = 0B;
  return D.19813;
}


sgen_hash_table_replace (struct SgenHashTable * hash_table, void * key, void * new_value, void * old_value)
{
  char[0:] * D.19833;
  unsigned int D.19834;
  gboolean D.19835;
  int D.19836;
  struct SgenHashTableEntry * * D.19837;
  unsigned int hash.0;
  unsigned int D.19839;
  struct SgenHashTableEntry * * D.19840;
  struct SgenHashTableEntry * D.19841;
  unsigned int D.19842;
  unsigned int D.19843;
  guint hash;
  struct SgenHashTableEntry * entry;

  try
    {
      rehash_if_necessary (hash_table);
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.19829>; else goto <D.19830>;
      <D.19829>:
      if (old_value != 0B) goto <D.19831>; else goto <D.19832>;
      <D.19831>:
      D.19833 = &entry->data;
      D.19834 = hash_table->data_size;
      memcpy (old_value, D.19833, D.19834);
      <D.19832>:
      D.19833 = &entry->data;
      D.19834 = hash_table->data_size;
      memcpy (D.19833, new_value, D.19834);
      D.19835 = 0;
      return D.19835;
      <D.19830>:
      D.19836 = hash_table->entry_mem_type;
      entry = sgen_alloc_internal (D.19836);
      entry->key = key;
      D.19833 = &entry->data;
      D.19834 = hash_table->data_size;
      memcpy (D.19833, new_value, D.19834);
      D.19837 = hash_table->table;
      hash.0 = hash;
      D.19839 = hash.0 * 4;
      D.19840 = D.19837 + D.19839;
      D.19841 = *D.19840;
      entry->next = D.19841;
      D.19837 = hash_table->table;
      hash.0 = hash;
      D.19839 = hash.0 * 4;
      D.19840 = D.19837 + D.19839;
      *D.19840 = entry;
      D.19842 = hash_table->num_entries;
      D.19843 = D.19842 + 1;
      hash_table->num_entries = D.19843;
      D.19835 = 1;
      return D.19835;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


rehash_if_necessary (struct SgenHashTable * hash_table)
{
  unsigned int D.19846;
  unsigned int D.19847;
  unsigned int D.19848;

  D.19846 = hash_table->num_entries;
  D.19847 = hash_table->size;
  D.19848 = D.19847 * 2;
  if (D.19846 >= D.19848) goto <D.19849>; else goto <D.19850>;
  <D.19849>:
  rehash (hash_table);
  <D.19850>:
}


rehash (struct SgenHashTable * hash_table)
{
  int D.19853;
  unsigned int D.19854;
  unsigned int D.19855;
  unsigned int D.19857;
  unsigned int D.19858;
  int D.19859;
  unsigned int D.19860;
  struct SgenHashTableEntry * * D.19861;
  guint (*<T166e>) (const void *) D.19862;
  void * D.19863;
  unsigned int D.19864;
  unsigned int D.19865;
  struct SgenHashTableEntry * * D.19866;
  struct SgenHashTableEntry * D.19867;
  unsigned int D.19868;
  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.19851>; else goto <D.19852>;
  <D.19851>:
  D.19853 = hash_table->entry_mem_type;
  D.19854 = hash_table->data_size;
  D.19855 = D.19854 + 8;
  sgen_register_fixed_internal_mem_type (D.19853, D.19855);
  new_size = 13;
  goto <D.19856>;
  <D.19852>:
  D.19857 = hash_table->num_entries;
  new_size = monoeg_g_spaced_primes_closest (D.19857);
  <D.19856>:
  D.19858 = new_size * 4;
  D.19859 = hash_table->table_mem_type;
  new_hash = sgen_alloc_internal_dynamic (D.19858, D.19859, 1);
  i = 0;
  goto <D.19735>;
  <D.19734>:
  D.19860 = i * 4;
  D.19861 = old_hash + D.19860;
  entry = *D.19861;
  goto <D.19732>;
  <D.19731>:
  D.19862 = hash_table->hash_func;
  D.19863 = entry->key;
  D.19864 = D.19862 (D.19863);
  hash = D.19864 % new_size;
  next = entry->next;
  D.19865 = hash * 4;
  D.19866 = new_hash + D.19865;
  D.19867 = *D.19866;
  entry->next = D.19867;
  D.19865 = hash * 4;
  D.19866 = new_hash + D.19865;
  *D.19866 = entry;
  entry = next;
  <D.19732>:
  if (entry != 0B) goto <D.19731>; else goto <D.19733>;
  <D.19733>:
  i = i + 1;
  <D.19735>:
  if (i < old_hash_size) goto <D.19734>; else goto <D.19736>;
  <D.19736>:
  D.19868 = old_hash_size * 4;
  D.19859 = hash_table->table_mem_type;
  sgen_free_internal_dynamic (old_hash, D.19868, D.19859);
  hash_table->table = new_hash;
  hash_table->size = new_size;
}


memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.19869;
  unsigned int D.19870;

  D.19870 = __builtin_object_size (__dest, 0);
  D.19869 = __builtin___memcpy_chk (__dest, __src, __len, D.19870);
  return D.19869;
}


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

  try
    {
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.19872>; else goto <D.19873>;
      <D.19872>:
      if (old_value != 0B) goto <D.19874>; else goto <D.19875>;
      <D.19874>:
      D.19876 = &entry->data;
      D.19877 = hash_table->data_size;
      memcpy (old_value, D.19876, D.19877);
      <D.19875>:
      D.19876 = &entry->data;
      D.19877 = hash_table->data_size;
      memcpy (D.19876, new_value, D.19877);
      D.19878 = 1;
      return D.19878;
      <D.19873>:
      D.19878 = 0;
      return D.19878;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


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

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


sgen_hash_table_remove (struct SgenHashTable * hash_table, void * key, void * data_return)
{
  guint (*<T166e>) (const void *) D.19886;
  unsigned int D.19887;
  unsigned int D.19888;
  struct SgenHashTableEntry * * D.19889;
  unsigned int D.19890;
  struct SgenHashTableEntry * * D.19891;
  void * D.19896;
  int D.19897;
  struct SgenHashTableEntry * D.19901;
  unsigned int D.19903;
  unsigned int D.19904;
  char[0:] * D.19907;
  unsigned int D.19908;
  int D.19909;
  gboolean D.19910;
  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.19886 = hash_table->hash_func;
  D.19887 = D.19886 (key);
  D.19888 = hash_table->size;
  hash = D.19887 % D.19888;
  prev = 0B;
  D.19889 = hash_table->table;
  D.19890 = hash * 4;
  D.19891 = D.19889 + D.19890;
  entry = *D.19891;
  goto <D.19789>;
  <D.19788>:
  if (equal != 0B) goto <D.19895>; else goto <D.19892>;
  <D.19895>:
  D.19896 = entry->key;
  D.19897 = equal (D.19896, key);
  if (D.19897 != 0) goto <D.19893>; else goto <D.19892>;
  <D.19892>:
  if (equal == 0B) goto <D.19898>; else goto <D.19894>;
  <D.19898>:
  D.19896 = entry->key;
  if (D.19896 == key) goto <D.19893>; else goto <D.19894>;
  <D.19893>:
  if (prev != 0B) goto <D.19899>; else goto <D.19900>;
  <D.19899>:
  D.19901 = entry->next;
  prev->next = D.19901;
  goto <D.19902>;
  <D.19900>:
  D.19889 = hash_table->table;
  D.19890 = hash * 4;
  D.19891 = D.19889 + D.19890;
  D.19901 = entry->next;
  *D.19891 = D.19901;
  <D.19902>:
  D.19903 = hash_table->num_entries;
  D.19904 = D.19903 + 4294967295;
  hash_table->num_entries = D.19904;
  if (data_return != 0B) goto <D.19905>; else goto <D.19906>;
  <D.19905>:
  D.19907 = &entry->data;
  D.19908 = hash_table->data_size;
  memcpy (data_return, D.19907, D.19908);
  <D.19906>:
  D.19909 = hash_table->entry_mem_type;
  sgen_free_internal (entry, D.19909);
  D.19910 = 1;
  return D.19910;
  <D.19894>:
  prev = entry;
  entry = entry->next;
  <D.19789>:
  if (entry != 0B) goto <D.19788>; else goto <D.19790>;
  <D.19790>:
  D.19910 = 0;
  return D.19910;
}


sgen_hash_table_clean (struct SgenHashTable * hash_table)
{
  unsigned int D.19912;
  struct SgenHashTableEntry * * D.19915;
  _Bool D.19916;
  long int D.19917;
  long int D.19918;
  unsigned int D.19921;
  _Bool D.19922;
  long int D.19923;
  long int D.19924;
  unsigned int D.19927;
  struct SgenHashTableEntry * * D.19928;
  int D.19929;
  unsigned int D.19930;
  int D.19931;
  guint i;

  D.19912 = hash_table->size;
  if (D.19912 == 0) goto <D.19913>; else goto <D.19914>;
  <D.19913>:
  D.19915 = hash_table->table;
  D.19916 = D.19915 != 0B;
  D.19917 = (long int) D.19916;
  D.19918 = __builtin_expect (D.19917, 0);
  if (D.19918 != 0) goto <D.19919>; else goto <D.19920>;
  <D.19919>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 200, "!hash_table->table");
  <D.19920>:
  D.19921 = hash_table->num_entries;
  D.19922 = D.19921 != 0;
  D.19923 = (long int) D.19922;
  D.19924 = __builtin_expect (D.19923, 0);
  if (D.19924 != 0) goto <D.19925>; else goto <D.19926>;
  <D.19925>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 201, "!hash_table->num_entries");
  <D.19926>:
  return;
  <D.19914>:
  i = 0;
  goto <D.19801>;
  <D.19800>:
  {
    struct SgenHashTableEntry * entry;

    D.19915 = hash_table->table;
    D.19927 = i * 4;
    D.19928 = D.19915 + D.19927;
    entry = *D.19928;
    goto <D.19798>;
    <D.19797>:
    {
      struct SgenHashTableEntry * next;

      next = entry->next;
      D.19929 = hash_table->entry_mem_type;
      sgen_free_internal (entry, D.19929);
      entry = next;
    }
    <D.19798>:
    if (entry != 0B) goto <D.19797>; else goto <D.19799>;
    <D.19799>:
  }
  i = i + 1;
  <D.19801>:
  D.19912 = hash_table->size;
  if (D.19912 > i) goto <D.19800>; else goto <D.19802>;
  <D.19802>:
  D.19915 = hash_table->table;
  D.19912 = hash_table->size;
  D.19930 = D.19912 * 4;
  D.19931 = hash_table->table_mem_type;
  sgen_free_internal_dynamic (D.19915, D.19930, D.19931);
  hash_table->table = 0B;
  hash_table->size = 0;
  hash_table->num_entries = 0;
}


