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

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


lookup (struct SgenHashTable * hash_table, void * key, guint * _hash)
{
  unsigned int D.17608;
  struct SgenHashTableEntry * D.17611;
  guint (*<Tc82>) (const void *) D.17612;
  unsigned int D.17613;
  struct SgenHashTableEntry * * D.17616;
  long unsigned int D.17617;
  long unsigned int D.17618;
  struct SgenHashTableEntry * * D.17619;
  void * D.17624;
  int D.17625;
  struct SgenHashTableEntry * entry;
  guint hash;
  gboolean (*GEqualFunc) (const void *, const void *) equal;

  equal = hash_table->equal_func;
  D.17608 = hash_table->size;
  if (D.17608 == 0) goto <D.17609>; else goto <D.17610>;
  <D.17609>:
  D.17611 = 0B;
  return D.17611;
  <D.17610>:
  D.17612 = hash_table->hash_func;
  D.17613 = D.17612 (key);
  D.17608 = hash_table->size;
  hash = D.17613 % D.17608;
  if (_hash != 0B) goto <D.17614>; else goto <D.17615>;
  <D.17614>:
  *_hash = hash;
  <D.17615>:
  D.17616 = hash_table->table;
  D.17617 = (long unsigned int) hash;
  D.17618 = D.17617 * 8;
  D.17619 = D.17616 + D.17618;
  entry = *D.17619;
  goto <D.17549>;
  <D.17548>:
  if (equal != 0B) goto <D.17623>; else goto <D.17620>;
  <D.17623>:
  D.17624 = entry->key;
  D.17625 = equal (D.17624, key);
  if (D.17625 != 0) goto <D.17621>; else goto <D.17620>;
  <D.17620>:
  if (equal == 0B) goto <D.17626>; else goto <D.17622>;
  <D.17626>:
  D.17624 = entry->key;
  if (D.17624 == key) goto <D.17621>; else goto <D.17622>;
  <D.17621>:
  D.17611 = entry;
  return D.17611;
  <D.17622>:
  entry = entry->next;
  <D.17549>:
  if (entry != 0B) goto <D.17548>; else goto <D.17550>;
  <D.17550>:
  D.17611 = 0B;
  return D.17611;
}


sgen_hash_table_replace (struct SgenHashTable * hash_table, void * key, void * new_value, void * old_value)
{
  long unsigned int D.17632;
  char[0:] * D.17633;
  gboolean D.17634;
  int D.17635;
  struct SgenHashTableEntry * * D.17636;
  unsigned int hash.0;
  long unsigned int D.17638;
  long unsigned int D.17639;
  struct SgenHashTableEntry * * D.17640;
  struct SgenHashTableEntry * D.17641;
  unsigned int D.17642;
  unsigned int D.17643;
  guint hash;
  struct SgenHashTableEntry * entry;

  try
    {
      rehash_if_necessary (hash_table);
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.17628>; else goto <D.17629>;
      <D.17628>:
      if (old_value != 0B) goto <D.17630>; else goto <D.17631>;
      <D.17630>:
      D.17632 = hash_table->data_size;
      D.17633 = &entry->data;
      memcpy (old_value, D.17633, D.17632);
      <D.17631>:
      D.17632 = hash_table->data_size;
      D.17633 = &entry->data;
      memcpy (D.17633, new_value, D.17632);
      D.17634 = 0;
      return D.17634;
      <D.17629>:
      D.17635 = hash_table->entry_mem_type;
      entry = sgen_alloc_internal (D.17635);
      entry->key = key;
      D.17632 = hash_table->data_size;
      D.17633 = &entry->data;
      memcpy (D.17633, new_value, D.17632);
      D.17636 = hash_table->table;
      hash.0 = hash;
      D.17638 = (long unsigned int) hash.0;
      D.17639 = D.17638 * 8;
      D.17640 = D.17636 + D.17639;
      D.17641 = *D.17640;
      entry->next = D.17641;
      D.17636 = hash_table->table;
      hash.0 = hash;
      D.17638 = (long unsigned int) hash.0;
      D.17639 = D.17638 * 8;
      D.17640 = D.17636 + D.17639;
      *D.17640 = entry;
      D.17642 = hash_table->num_entries;
      D.17643 = D.17642 + 1;
      hash_table->num_entries = D.17643;
      D.17634 = 1;
      return D.17634;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


rehash_if_necessary (struct SgenHashTable * hash_table)
{
  unsigned int D.17646;
  unsigned int D.17647;
  unsigned int D.17648;

  D.17646 = hash_table->num_entries;
  D.17647 = hash_table->size;
  D.17648 = D.17647 * 2;
  if (D.17646 >= D.17648) goto <D.17649>; else goto <D.17650>;
  <D.17649>:
  rehash (hash_table);
  <D.17650>:
}


rehash (struct SgenHashTable * hash_table)
{
  long unsigned int D.17653;
  long unsigned int D.17654;
  int D.17655;
  unsigned int D.17657;
  int D.17658;
  long unsigned int D.17659;
  long unsigned int D.17660;
  long unsigned int D.17661;
  long unsigned int D.17662;
  struct SgenHashTableEntry * * D.17663;
  guint (*<Tc82>) (const void *) D.17664;
  void * D.17665;
  unsigned int D.17666;
  long unsigned int D.17667;
  long unsigned int D.17668;
  struct SgenHashTableEntry * * D.17669;
  struct SgenHashTableEntry * D.17670;
  long unsigned int D.17671;
  long unsigned int D.17672;
  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.17651>; else goto <D.17652>;
  <D.17651>:
  D.17653 = hash_table->data_size;
  D.17654 = D.17653 + 16;
  D.17655 = hash_table->entry_mem_type;
  sgen_register_fixed_internal_mem_type (D.17655, D.17654);
  new_size = 13;
  goto <D.17656>;
  <D.17652>:
  D.17657 = hash_table->num_entries;
  new_size = monoeg_g_spaced_primes_closest (D.17657);
  <D.17656>:
  D.17658 = hash_table->table_mem_type;
  D.17659 = (long unsigned int) new_size;
  D.17660 = D.17659 * 8;
  new_hash = sgen_alloc_internal_dynamic (D.17660, D.17658, 1);
  i = 0;
  goto <D.17535>;
  <D.17534>:
  D.17661 = (long unsigned int) i;
  D.17662 = D.17661 * 8;
  D.17663 = old_hash + D.17662;
  entry = *D.17663;
  goto <D.17532>;
  <D.17531>:
  D.17664 = hash_table->hash_func;
  D.17665 = entry->key;
  D.17666 = D.17664 (D.17665);
  hash = D.17666 % new_size;
  next = entry->next;
  D.17667 = (long unsigned int) hash;
  D.17668 = D.17667 * 8;
  D.17669 = new_hash + D.17668;
  D.17670 = *D.17669;
  entry->next = D.17670;
  D.17667 = (long unsigned int) hash;
  D.17668 = D.17667 * 8;
  D.17669 = new_hash + D.17668;
  *D.17669 = entry;
  entry = next;
  <D.17532>:
  if (entry != 0B) goto <D.17531>; else goto <D.17533>;
  <D.17533>:
  i = i + 1;
  <D.17535>:
  if (i < old_hash_size) goto <D.17534>; else goto <D.17536>;
  <D.17536>:
  D.17658 = hash_table->table_mem_type;
  D.17671 = (long unsigned int) old_hash_size;
  D.17672 = D.17671 * 8;
  sgen_free_internal_dynamic (old_hash, D.17672, D.17658);
  hash_table->table = new_hash;
  hash_table->size = new_size;
}


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

  D.17674 = __builtin_object_size (__dest, 0);
  D.17673 = __builtin___memcpy_chk (__dest, __src, __len, D.17674);
  return D.17673;
}


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

  try
    {
      entry = lookup (hash_table, key, &hash);
      if (entry != 0B) goto <D.17676>; else goto <D.17677>;
      <D.17676>:
      if (old_value != 0B) goto <D.17678>; else goto <D.17679>;
      <D.17678>:
      D.17680 = hash_table->data_size;
      D.17681 = &entry->data;
      memcpy (old_value, D.17681, D.17680);
      <D.17679>:
      D.17680 = hash_table->data_size;
      D.17681 = &entry->data;
      memcpy (D.17681, new_value, D.17680);
      D.17682 = 1;
      return D.17682;
      <D.17677>:
      D.17682 = 0;
      return D.17682;
    }
  finally
    {
      hash = {CLOBBER};
    }
}


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

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


sgen_hash_table_remove (struct SgenHashTable * hash_table, void * key, void * data_return)
{
  guint (*<Tc82>) (const void *) D.17690;
  unsigned int D.17691;
  unsigned int D.17692;
  struct SgenHashTableEntry * * D.17693;
  long unsigned int D.17694;
  long unsigned int D.17695;
  struct SgenHashTableEntry * * D.17696;
  void * D.17701;
  int D.17702;
  struct SgenHashTableEntry * D.17706;
  unsigned int D.17708;
  unsigned int D.17709;
  long unsigned int D.17712;
  char[0:] * D.17713;
  int D.17714;
  gboolean D.17715;
  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.17690 = hash_table->hash_func;
  D.17691 = D.17690 (key);
  D.17692 = hash_table->size;
  hash = D.17691 % D.17692;
  prev = 0B;
  D.17693 = hash_table->table;
  D.17694 = (long unsigned int) hash;
  D.17695 = D.17694 * 8;
  D.17696 = D.17693 + D.17695;
  entry = *D.17696;
  goto <D.17589>;
  <D.17588>:
  if (equal != 0B) goto <D.17700>; else goto <D.17697>;
  <D.17700>:
  D.17701 = entry->key;
  D.17702 = equal (D.17701, key);
  if (D.17702 != 0) goto <D.17698>; else goto <D.17697>;
  <D.17697>:
  if (equal == 0B) goto <D.17703>; else goto <D.17699>;
  <D.17703>:
  D.17701 = entry->key;
  if (D.17701 == key) goto <D.17698>; else goto <D.17699>;
  <D.17698>:
  if (prev != 0B) goto <D.17704>; else goto <D.17705>;
  <D.17704>:
  D.17706 = entry->next;
  prev->next = D.17706;
  goto <D.17707>;
  <D.17705>:
  D.17693 = hash_table->table;
  D.17694 = (long unsigned int) hash;
  D.17695 = D.17694 * 8;
  D.17696 = D.17693 + D.17695;
  D.17706 = entry->next;
  *D.17696 = D.17706;
  <D.17707>:
  D.17708 = hash_table->num_entries;
  D.17709 = D.17708 + 4294967295;
  hash_table->num_entries = D.17709;
  if (data_return != 0B) goto <D.17710>; else goto <D.17711>;
  <D.17710>:
  D.17712 = hash_table->data_size;
  D.17713 = &entry->data;
  memcpy (data_return, D.17713, D.17712);
  <D.17711>:
  D.17714 = hash_table->entry_mem_type;
  sgen_free_internal (entry, D.17714);
  D.17715 = 1;
  return D.17715;
  <D.17699>:
  prev = entry;
  entry = entry->next;
  <D.17589>:
  if (entry != 0B) goto <D.17588>; else goto <D.17590>;
  <D.17590>:
  D.17715 = 0;
  return D.17715;
}


sgen_hash_table_clean (struct SgenHashTable * hash_table)
{
  unsigned int D.17717;
  struct SgenHashTableEntry * * D.17720;
  _Bool D.17721;
  long int D.17722;
  long int D.17723;
  unsigned int D.17726;
  _Bool D.17727;
  long int D.17728;
  long int D.17729;
  long unsigned int D.17732;
  long unsigned int D.17733;
  struct SgenHashTableEntry * * D.17734;
  int D.17735;
  int D.17736;
  long unsigned int D.17737;
  long unsigned int D.17738;
  guint i;

  D.17717 = hash_table->size;
  if (D.17717 == 0) goto <D.17718>; else goto <D.17719>;
  <D.17718>:
  D.17720 = hash_table->table;
  D.17721 = D.17720 != 0B;
  D.17722 = (long int) D.17721;
  D.17723 = __builtin_expect (D.17722, 0);
  if (D.17723 != 0) goto <D.17724>; else goto <D.17725>;
  <D.17724>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 200, "!hash_table->table");
  <D.17725>:
  D.17726 = hash_table->num_entries;
  D.17727 = D.17726 != 0;
  D.17728 = (long int) D.17727;
  D.17729 = __builtin_expect (D.17728, 0);
  if (D.17729 != 0) goto <D.17730>; else goto <D.17731>;
  <D.17730>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "sgen-hash-table.c", 201, "!hash_table->num_entries");
  <D.17731>:
  return;
  <D.17719>:
  i = 0;
  goto <D.17601>;
  <D.17600>:
  {
    struct SgenHashTableEntry * entry;

    D.17720 = hash_table->table;
    D.17732 = (long unsigned int) i;
    D.17733 = D.17732 * 8;
    D.17734 = D.17720 + D.17733;
    entry = *D.17734;
    goto <D.17598>;
    <D.17597>:
    {
      struct SgenHashTableEntry * next;

      next = entry->next;
      D.17735 = hash_table->entry_mem_type;
      sgen_free_internal (entry, D.17735);
      entry = next;
    }
    <D.17598>:
    if (entry != 0B) goto <D.17597>; else goto <D.17599>;
    <D.17599>:
  }
  i = i + 1;
  <D.17601>:
  D.17717 = hash_table->size;
  if (D.17717 > i) goto <D.17600>; else goto <D.17602>;
  <D.17602>:
  D.17736 = hash_table->table_mem_type;
  D.17717 = hash_table->size;
  D.17737 = (long unsigned int) D.17717;
  D.17738 = D.17737 * 8;
  D.17720 = hash_table->table;
  sgen_free_internal_dynamic (D.17720, D.17738, D.17736);
  hash_table->table = 0B;
  hash_table->size = 0;
  hash_table->num_entries = 0;
}


