__attribute__((visibility ("hidden")))
sgen_hash_table_lookup (struct SgenHashTable * hash_table, void * key)
{
  void * D.17750;
  struct SgenHashTableEntry * entry;

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


lookup (struct SgenHashTable * hash_table, void * key, guint * _hash)
{
  unsigned int D.17752;
  struct SgenHashTableEntry * D.17755;
  guint (*<Td90>) (const void *) D.17756;
  unsigned int D.17757;
  struct SgenHashTableEntry * * D.17760;
  long unsigned int D.17761;
  long unsigned int D.17762;
  struct SgenHashTableEntry * * D.17763;
  void * D.17768;
  int D.17769;
  struct SgenHashTableEntry * entry;
  guint hash;
  gboolean (*GEqualFunc) (const void *, const void *) equal;

  equal = hash_table->equal_func;
  D.17752 = hash_table->size;
  if (D.17752 == 0) goto <D.17753>; else goto <D.17754>;
  <D.17753>:
  D.17755 = 0B;
  return D.17755;
  <D.17754>:
  D.17756 = hash_table->hash_func;
  D.17757 = D.17756 (key);
  D.17752 = hash_table->size;
  hash = D.17757 % D.17752;
  if (_hash != 0B) goto <D.17758>; else goto <D.17759>;
  <D.17758>:
  *_hash = hash;
  <D.17759>:
  D.17760 = hash_table->table;
  D.17761 = (long unsigned int) hash;
  D.17762 = D.17761 * 8;
  D.17763 = D.17760 + D.17762;
  entry = *D.17763;
  goto <D.17693>;
  <D.17692>:
  if (equal != 0B) goto <D.17767>; else goto <D.17764>;
  <D.17767>:
  D.17768 = entry->key;
  D.17769 = equal (D.17768, key);
  if (D.17769 != 0) goto <D.17765>; else goto <D.17764>;
  <D.17764>:
  if (equal == 0B) goto <D.17770>; else goto <D.17766>;
  <D.17770>:
  D.17768 = entry->key;
  if (D.17768 == key) goto <D.17765>; else goto <D.17766>;
  <D.17765>:
  D.17755 = entry;
  return D.17755;
  <D.17766>:
  entry = entry->next;
  <D.17693>:
  if (entry != 0B) goto <D.17692>; else goto <D.17694>;
  <D.17694>:
  D.17755 = 0B;
  return D.17755;
}


__attribute__((visibility ("hidden")))
sgen_hash_table_replace (struct SgenHashTable * hash_table, void * key, void * new_value, void * old_value)
{
  char[0:] * D.17776;
  long unsigned int D.17777;
  gboolean D.17778;
  int D.17779;
  struct SgenHashTableEntry * * D.17780;
  unsigned int hash.0;
  long unsigned int D.17782;
  long unsigned int D.17783;
  struct SgenHashTableEntry * * D.17784;
  struct SgenHashTableEntry * D.17785;
  unsigned int D.17786;
  unsigned int D.17787;
  guint hash;
  struct SgenHashTableEntry * entry;

  try
    {
      rehash_if_necessary (hash_table);
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.17772>; else goto <D.17773>;
      <D.17772>:
      if (old_value != 0B) goto <D.17774>; else goto <D.17775>;
      <D.17774>:
      D.17776 = &entry->data;
      D.17777 = hash_table->data_size;
      memcpy (old_value, D.17776, D.17777);
      <D.17775>:
      D.17776 = &entry->data;
      D.17777 = hash_table->data_size;
      memcpy (D.17776, new_value, D.17777);
      D.17778 = 0;
      return D.17778;
      <D.17773>:
      D.17779 = hash_table->entry_mem_type;
      entry = sgen_alloc_internal (D.17779);
      entry->key = key;
      D.17776 = &entry->data;
      D.17777 = hash_table->data_size;
      memcpy (D.17776, new_value, D.17777);
      D.17780 = hash_table->table;
      hash.0 = hash;
      D.17782 = (long unsigned int) hash.0;
      D.17783 = D.17782 * 8;
      D.17784 = D.17780 + D.17783;
      D.17785 = *D.17784;
      entry->next = D.17785;
      D.17780 = hash_table->table;
      hash.0 = hash;
      D.17782 = (long unsigned int) hash.0;
      D.17783 = D.17782 * 8;
      D.17784 = D.17780 + D.17783;
      *D.17784 = entry;
      D.17786 = hash_table->num_entries;
      D.17787 = D.17786 + 1;
      hash_table->num_entries = D.17787;
      D.17778 = 1;
      return D.17778;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


rehash_if_necessary (struct SgenHashTable * hash_table)
{
  unsigned int D.17790;
  unsigned int D.17791;
  unsigned int D.17792;

  D.17790 = hash_table->num_entries;
  D.17791 = hash_table->size;
  D.17792 = D.17791 * 2;
  if (D.17790 >= D.17792) goto <D.17793>; else goto <D.17794>;
  <D.17793>:
  rehash (hash_table);
  <D.17794>:
}


rehash (struct SgenHashTable * hash_table)
{
  int D.17797;
  long unsigned int D.17798;
  long unsigned int D.17799;
  unsigned int D.17801;
  long unsigned int D.17802;
  long unsigned int D.17803;
  int D.17804;
  long unsigned int D.17805;
  long unsigned int D.17806;
  struct SgenHashTableEntry * * D.17807;
  guint (*<Td90>) (const void *) D.17808;
  void * D.17809;
  unsigned int D.17810;
  long unsigned int D.17811;
  long unsigned int D.17812;
  struct SgenHashTableEntry * * D.17813;
  struct SgenHashTableEntry * D.17814;
  long unsigned int D.17815;
  long unsigned int D.17816;
  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.17795>; else goto <D.17796>;
  <D.17795>:
  D.17797 = hash_table->entry_mem_type;
  D.17798 = hash_table->data_size;
  D.17799 = D.17798 + 16;
  sgen_register_fixed_internal_mem_type (D.17797, D.17799);
  new_size = 13;
  goto <D.17800>;
  <D.17796>:
  D.17801 = hash_table->num_entries;
  new_size = monoeg_g_spaced_primes_closest (D.17801);
  <D.17800>:
  D.17802 = (long unsigned int) new_size;
  D.17803 = D.17802 * 8;
  D.17804 = hash_table->table_mem_type;
  new_hash = sgen_alloc_internal_dynamic (D.17803, D.17804, 1);
  i = 0;
  goto <D.17679>;
  <D.17678>:
  D.17805 = (long unsigned int) i;
  D.17806 = D.17805 * 8;
  D.17807 = old_hash + D.17806;
  entry = *D.17807;
  goto <D.17676>;
  <D.17675>:
  D.17808 = hash_table->hash_func;
  D.17809 = entry->key;
  D.17810 = D.17808 (D.17809);
  hash = D.17810 % new_size;
  next = entry->next;
  D.17811 = (long unsigned int) hash;
  D.17812 = D.17811 * 8;
  D.17813 = new_hash + D.17812;
  D.17814 = *D.17813;
  entry->next = D.17814;
  D.17811 = (long unsigned int) hash;
  D.17812 = D.17811 * 8;
  D.17813 = new_hash + D.17812;
  *D.17813 = entry;
  entry = next;
  <D.17676>:
  if (entry != 0B) goto <D.17675>; else goto <D.17677>;
  <D.17677>:
  i = i + 1;
  <D.17679>:
  if (i < old_hash_size) goto <D.17678>; else goto <D.17680>;
  <D.17680>:
  D.17815 = (long unsigned int) old_hash_size;
  D.17816 = D.17815 * 8;
  D.17804 = hash_table->table_mem_type;
  sgen_free_internal_dynamic (old_hash, D.17816, D.17804);
  hash_table->table = new_hash;
  hash_table->size = new_size;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.17817;
  long unsigned int D.17818;

  D.17818 = __builtin_object_size (__dest, 0);
  D.17817 = __builtin___memcpy_chk (__dest, __src, __len, D.17818);
  return D.17817;
}


__attribute__((visibility ("hidden")))
sgen_hash_table_set_value (struct SgenHashTable * hash_table, void * key, void * new_value, void * old_value)
{
  char[0:] * D.17824;
  long unsigned int D.17825;
  gboolean D.17826;
  guint hash;
  struct SgenHashTableEntry * entry;

  try
    {
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.17820>; else goto <D.17821>;
      <D.17820>:
      if (old_value != 0B) goto <D.17822>; else goto <D.17823>;
      <D.17822>:
      D.17824 = &entry->data;
      D.17825 = hash_table->data_size;
      memcpy (old_value, D.17824, D.17825);
      <D.17823>:
      D.17824 = &entry->data;
      D.17825 = hash_table->data_size;
      memcpy (D.17824, new_value, D.17825);
      D.17826 = 1;
      return D.17826;
      <D.17821>:
      D.17826 = 0;
      return D.17826;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
sgen_hash_table_set_key (struct SgenHashTable * hash_table, void * old_key, void * new_key)
{
  gboolean D.17831;
  guint hash;
  struct SgenHashTableEntry * entry;

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


__attribute__((visibility ("hidden")))
sgen_hash_table_remove (struct SgenHashTable * hash_table, void * key, void * data_return)
{
  guint (*<Td90>) (const void *) D.17834;
  unsigned int D.17835;
  unsigned int D.17836;
  struct SgenHashTableEntry * * D.17837;
  long unsigned int D.17838;
  long unsigned int D.17839;
  struct SgenHashTableEntry * * D.17840;
  void * D.17845;
  int D.17846;
  struct SgenHashTableEntry * D.17850;
  unsigned int D.17852;
  unsigned int D.17853;
  char[0:] * D.17856;
  long unsigned int D.17857;
  int D.17858;
  gboolean D.17859;
  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.17834 = hash_table->hash_func;
  D.17835 = D.17834 (key);
  D.17836 = hash_table->size;
  hash = D.17835 % D.17836;
  prev = 0B;
  D.17837 = hash_table->table;
  D.17838 = (long unsigned int) hash;
  D.17839 = D.17838 * 8;
  D.17840 = D.17837 + D.17839;
  entry = *D.17840;
  goto <D.17733>;
  <D.17732>:
  if (equal != 0B) goto <D.17844>; else goto <D.17841>;
  <D.17844>:
  D.17845 = entry->key;
  D.17846 = equal (D.17845, key);
  if (D.17846 != 0) goto <D.17842>; else goto <D.17841>;
  <D.17841>:
  if (equal == 0B) goto <D.17847>; else goto <D.17843>;
  <D.17847>:
  D.17845 = entry->key;
  if (D.17845 == key) goto <D.17842>; else goto <D.17843>;
  <D.17842>:
  if (prev != 0B) goto <D.17848>; else goto <D.17849>;
  <D.17848>:
  D.17850 = entry->next;
  prev->next = D.17850;
  goto <D.17851>;
  <D.17849>:
  D.17837 = hash_table->table;
  D.17838 = (long unsigned int) hash;
  D.17839 = D.17838 * 8;
  D.17840 = D.17837 + D.17839;
  D.17850 = entry->next;
  *D.17840 = D.17850;
  <D.17851>:
  D.17852 = hash_table->num_entries;
  D.17853 = D.17852 + 4294967295;
  hash_table->num_entries = D.17853;
  if (data_return != 0B) goto <D.17854>; else goto <D.17855>;
  <D.17854>:
  D.17856 = &entry->data;
  D.17857 = hash_table->data_size;
  memcpy (data_return, D.17856, D.17857);
  <D.17855>:
  D.17858 = hash_table->entry_mem_type;
  sgen_free_internal (entry, D.17858);
  D.17859 = 1;
  return D.17859;
  <D.17843>:
  prev = entry;
  entry = entry->next;
  <D.17733>:
  if (entry != 0B) goto <D.17732>; else goto <D.17734>;
  <D.17734>:
  D.17859 = 0;
  return D.17859;
}


__attribute__((visibility ("hidden")))
sgen_hash_table_clean (struct SgenHashTable * hash_table)
{
  unsigned int D.17861;
  struct SgenHashTableEntry * * D.17864;
  _Bool D.17865;
  long int D.17866;
  long int D.17867;
  unsigned int D.17870;
  _Bool D.17871;
  long int D.17872;
  long int D.17873;
  long unsigned int D.17876;
  long unsigned int D.17877;
  struct SgenHashTableEntry * * D.17878;
  int D.17879;
  long unsigned int D.17880;
  long unsigned int D.17881;
  int D.17882;
  guint i;

  D.17861 = hash_table->size;
  if (D.17861 == 0) goto <D.17862>; else goto <D.17863>;
  <D.17862>:
  D.17864 = hash_table->table;
  D.17865 = D.17864 != 0B;
  D.17866 = (long int) D.17865;
  D.17867 = __builtin_expect (D.17866, 0);
  if (D.17867 != 0) goto <D.17868>; else goto <D.17869>;
  <D.17868>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 200, "!hash_table->table");
  <D.17869>:
  D.17870 = hash_table->num_entries;
  D.17871 = D.17870 != 0;
  D.17872 = (long int) D.17871;
  D.17873 = __builtin_expect (D.17872, 0);
  if (D.17873 != 0) goto <D.17874>; else goto <D.17875>;
  <D.17874>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 201, "!hash_table->num_entries");
  <D.17875>:
  return;
  <D.17863>:
  i = 0;
  goto <D.17745>;
  <D.17744>:
  {
    struct SgenHashTableEntry * entry;

    D.17864 = hash_table->table;
    D.17876 = (long unsigned int) i;
    D.17877 = D.17876 * 8;
    D.17878 = D.17864 + D.17877;
    entry = *D.17878;
    goto <D.17742>;
    <D.17741>:
    {
      struct SgenHashTableEntry * next;

      next = entry->next;
      D.17879 = hash_table->entry_mem_type;
      sgen_free_internal (entry, D.17879);
      entry = next;
    }
    <D.17742>:
    if (entry != 0B) goto <D.17741>; else goto <D.17743>;
    <D.17743>:
  }
  i = i + 1;
  <D.17745>:
  D.17861 = hash_table->size;
  if (D.17861 > i) goto <D.17744>; else goto <D.17746>;
  <D.17746>:
  D.17864 = hash_table->table;
  D.17861 = hash_table->size;
  D.17880 = (long unsigned int) D.17861;
  D.17881 = D.17880 * 8;
  D.17882 = hash_table->table_mem_type;
  sgen_free_internal_dynamic (D.17864, D.17881, D.17882);
  hash_table->table = 0B;
  hash_table->size = 0;
  hash_table->num_entries = 0;
}


