foreach (void * key, void * value, void * user_data)
{
  int foreach_count.0;
  int foreach_count.1;
  long int user_data.2;
  int D.5032;

  foreach_count.0 = foreach_count;
  foreach_count.1 = foreach_count.0 + 1;
  foreach_count = foreach_count.1;
  user_data.2 = (long int) user_data;
  D.5032 = (int) user_data.2;
  if (D.5032 != 97) goto <D.5033>; else goto <D.5034>;
  <D.5033>:
  foreach_fail = 1;
  <D.5034>:
}


hash_t1 ()
{
  int foreach_count.3;
  gchar * D.5038;
  int foreach_fail.4;
  int D.5042;
  unsigned int D.5045;
  int D.4965;
  int iftmp.5;
  int D.4964;
  char[5] * D.5051;
  unsigned char D.5052;
  int D.5053;
  unsigned char D.5054;
  int D.5055;
  _Bool D.5056;
  _Bool D.5057;
  _Bool D.5058;
  const unsigned char * D.5061;
  unsigned char D.5062;
  int D.5063;
  const unsigned char * D.5064;
  unsigned char D.5065;
  int D.5066;
  _Bool D.5067;
  _Bool D.5068;
  const unsigned char * D.5071;
  unsigned char D.5072;
  int D.5073;
  const unsigned char * D.5074;
  unsigned char D.5075;
  int D.5076;
  _Bool D.5077;
  _Bool D.5078;
  const unsigned char * D.5081;
  unsigned char D.5082;
  int D.5083;
  const unsigned char * D.5084;
  unsigned char D.5085;
  int D.5086;
  void * D.5088;
  int D.5091;
  unsigned int D.5094;
  struct GHashTable * t;

  t = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  foreach_count = 0;
  foreach_fail = 0;
  monoeg_g_hash_table_insert_replace (t, "hello", "world", 0);
  monoeg_g_hash_table_insert_replace (t, "my", "god", 0);
  monoeg_g_hash_table_foreach (t, foreach, 97B);
  foreach_count.3 = foreach_count;
  if (foreach_count.3 != 2) goto <D.5036>; else goto <D.5037>;
  <D.5036>:
  foreach_count.3 = foreach_count;
  D.5038 = FAILED ("did not find all keys, got %d expected 2", foreach_count.3);
  return D.5038;
  <D.5037>:
  foreach_fail.4 = foreach_fail;
  if (foreach_fail.4 != 0) goto <D.5040>; else goto <D.5041>;
  <D.5040>:
  D.5038 = FAILED ("failed to pass the user-data to foreach");
  return D.5038;
  <D.5041>:
  D.5042 = monoeg_g_hash_table_remove (t, "my");
  if (D.5042 == 0) goto <D.5043>; else goto <D.5044>;
  <D.5043>:
  D.5038 = FAILED ("did not find known key");
  return D.5038;
  <D.5044>:
  D.5045 = monoeg_g_hash_table_size (t);
  if (D.5045 != 1) goto <D.5046>; else goto <D.5047>;
  <D.5046>:
  D.5038 = FAILED ("unexpected size");
  return D.5038;
  <D.5047>:
  monoeg_g_hash_table_insert_replace (t, "hello", "moon", 0);
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 4;
    if (__s2_len <= 3) goto <D.5049>; else goto <D.5050>;
    <D.5049>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = monoeg_g_hash_table_lookup (t, "hello");
      D.5051 = "moon";
      D.5052 = MEM[(const unsigned char *)D.5051];
      D.5053 = (int) D.5052;
      D.5054 = *__s2;
      D.5055 = (int) D.5054;
      __result = D.5053 - D.5055;
      {
        D.5056 = __s2_len != 0;
        D.5057 = __result == 0;
        D.5058 = D.5056 & D.5057;
        if (D.5058 != 0) goto <D.5059>; else goto <D.5060>;
        <D.5059>:
        D.5061 = &MEM[(void *)"moon" + 1B];
        D.5062 = *D.5061;
        D.5063 = (int) D.5062;
        D.5064 = __s2 + 1;
        D.5065 = *D.5064;
        D.5066 = (int) D.5065;
        __result = D.5063 - D.5066;
        D.5067 = __s2_len > 1;
        D.5057 = __result == 0;
        D.5068 = D.5067 & D.5057;
        if (D.5068 != 0) goto <D.5069>; else goto <D.5070>;
        <D.5069>:
        D.5071 = &MEM[(void *)"moon" + 2B];
        D.5072 = *D.5071;
        D.5073 = (int) D.5072;
        D.5074 = __s2 + 2;
        D.5075 = *D.5074;
        D.5076 = (int) D.5075;
        __result = D.5073 - D.5076;
        D.5077 = __s2_len > 2;
        D.5057 = __result == 0;
        D.5078 = D.5077 & D.5057;
        if (D.5078 != 0) goto <D.5079>; else goto <D.5080>;
        <D.5079>:
        D.5081 = &MEM[(void *)"moon" + 3B];
        D.5082 = *D.5081;
        D.5083 = (int) D.5082;
        D.5084 = __s2 + 3;
        D.5085 = *D.5084;
        D.5086 = (int) D.5085;
        __result = D.5083 - D.5086;
        <D.5080>:
        <D.5070>:
        <D.5060>:
      }
      D.4964 = __result;
    }
    iftmp.5 = -D.4964;
    goto <D.5087>;
    <D.5050>:
    D.5088 = monoeg_g_hash_table_lookup (t, "hello");
    iftmp.5 = __builtin_strcmp (D.5088, "moon");
    <D.5087>:
    D.4965 = iftmp.5;
  }
  if (D.4965 != 0) goto <D.5089>; else goto <D.5090>;
  <D.5089>:
  D.5038 = FAILED ("did not replace world with moon");
  return D.5038;
  <D.5090>:
  D.5091 = monoeg_g_hash_table_remove (t, "hello");
  if (D.5091 == 0) goto <D.5092>; else goto <D.5093>;
  <D.5092>:
  D.5038 = FAILED ("did not find known key");
  return D.5038;
  <D.5093>:
  D.5094 = monoeg_g_hash_table_size (t);
  if (D.5094 != 0) goto <D.5095>; else goto <D.5096>;
  <D.5095>:
  D.5038 = FAILED ("unexpected size");
  return D.5038;
  <D.5096>:
  monoeg_g_hash_table_destroy (t);
  D.5038 = 0B;
  return D.5038;
}


hash_t2 ()
{
  gchar * D.5098;

  D.5098 = 0B;
  return D.5098;
}


hash_default ()
{
  gchar * D.5102;
  struct GHashTable * hash;

  hash = monoeg_g_hash_table_new (0B, 0B);
  if (hash == 0B) goto <D.5100>; else goto <D.5101>;
  <D.5100>:
  D.5102 = FAILED ("g_hash_table_new should return a valid hash");
  return D.5102;
  <D.5101>:
  monoeg_g_hash_table_destroy (hash);
  D.5102 = 0B;
  return D.5102;
}


hash_null_lookup ()
{
  int D.5104;
  gchar * D.5107;
  void * ok.6;
  void * ov.7;
  int D.5114;
  struct GHashTable * hash;
  void * ok;
  void * ov;

  try
    {
      hash = monoeg_g_hash_table_new (0B, 0B);
      monoeg_g_hash_table_insert_replace (hash, 0B, 1B, 0);
      monoeg_g_hash_table_insert_replace (hash, 1B, 2B, 0);
      D.5104 = monoeg_g_hash_table_lookup_extended (hash, 0B, &ok, &ov);
      if (D.5104 == 0) goto <D.5105>; else goto <D.5106>;
      <D.5105>:
      D.5107 = FAILED ("Did not find the NULL");
      return D.5107;
      <D.5106>:
      ok.6 = ok;
      if (ok.6 != 0B) goto <D.5109>; else goto <D.5110>;
      <D.5109>:
      D.5107 = FAILED ("Incorrect key found");
      return D.5107;
      <D.5110>:
      ov.7 = ov;
      if (ov.7 != 1B) goto <D.5112>; else goto <D.5113>;
      <D.5112>:
      ov.7 = ov;
      D.5107 = FAILED ("Got wrong value %p\n", ov.7);
      return D.5107;
      <D.5113>:
      D.5114 = monoeg_g_hash_table_lookup_extended (hash, 1B, &ok, &ov);
      if (D.5114 == 0) goto <D.5115>; else goto <D.5116>;
      <D.5115>:
      D.5107 = FAILED ("Did not find the 1");
      return D.5107;
      <D.5116>:
      ok.6 = ok;
      if (ok.6 != 1B) goto <D.5117>; else goto <D.5118>;
      <D.5117>:
      D.5107 = FAILED ("Incorrect key found");
      return D.5107;
      <D.5118>:
      ov.7 = ov;
      if (ov.7 != 2B) goto <D.5119>; else goto <D.5120>;
      <D.5119>:
      ov.7 = ov;
      D.5107 = FAILED ("Got wrong value %p\n", ov.7);
      return D.5107;
      <D.5120>:
      monoeg_g_hash_table_destroy (hash);
      D.5107 = 0B;
      return D.5107;
    }
  finally
    {
      ok = {CLOBBER};
      ov = {CLOBBER};
    }
}


hash_grow ()
{
  gchar * D.5123;
  gchar * D.5124;
  int D.5004;
  gchar * D.5127;
  unsigned int D.5128;
  unsigned int D.5131;
  int count.8;
  struct GHashTable * hash;
  int i;
  int count;

  try
    {
      hash = monoeg_g_hash_table_new_full (monoeg_g_str_hash, monoeg_g_str_equal, monoeg_g_free, monoeg_g_free);
      count = 0;
      i = 0;
      goto <D.4992>;
      <D.4991>:
      D.5123 = monoeg_g_strdup_printf ("x-%d", i);
      D.5124 = monoeg_g_strdup_printf ("%d", i);
      monoeg_g_hash_table_insert_replace (hash, D.5124, D.5123, 0);
      i = i + 1;
      <D.4992>:
      if (i <= 999) goto <D.4991>; else goto <D.4993>;
      <D.4993>:
      i = 0;
      goto <D.5006>;
      <D.5005>:
      {
        char buffer[30];
        void * value;

        try
          {
            sprintf (&buffer, "%d", i);
            value = monoeg_g_hash_table_lookup (hash, &buffer);
            sprintf (&buffer, "x-%d", i);
            {
              size_t __s1_len;
              size_t __s2_len;

              D.5004 = __builtin_strcmp (value, &buffer);
            }
            if (D.5004 != 0) goto <D.5125>; else goto <D.5126>;
            <D.5125>:
            D.5127 = FAILED ("Failed to lookup the key %d, the value was %s\n", i, value);
            return D.5127;
            <D.5126>:
          }
        finally
          {
            buffer = {CLOBBER};
          }
      }
      i = i + 1;
      <D.5006>:
      if (i <= 999) goto <D.5005>; else goto <D.5007>;
      <D.5007>:
      D.5128 = monoeg_g_hash_table_size (hash);
      if (D.5128 != 1000) goto <D.5129>; else goto <D.5130>;
      <D.5129>:
      D.5131 = monoeg_g_hash_table_size (hash);
      D.5127 = FAILED ("Did not find 1000 elements on the hash, found %d\n", D.5131);
      return D.5127;
      <D.5130>:
      monoeg_g_hash_table_foreach (hash, counter, &count);
      count.8 = count;
      if (count.8 != 1000) goto <D.5133>; else goto <D.5134>;
      <D.5133>:
      D.5127 = FAILED ("Foreach count is not 1000");
      return D.5127;
      <D.5134>:
      monoeg_g_hash_table_destroy (hash);
      D.5127 = 0B;
      return D.5127;
    }
  finally
    {
      count = {CLOBBER};
    }
}


counter (void * key, void * value, void * user_data)
{
  int D.5139;
  int D.5140;
  int * counter;

  counter = user_data;
  D.5139 = *counter;
  D.5140 = D.5139 + 1;
  *counter = D.5140;
}


sprintf (char * restrict __s, const char * restrict __fmt)
{
  int D.5141;
  long unsigned int D.5142;

  D.5142 = __builtin_object_size (__s, 1);
  D.5141 = __builtin___sprintf_chk (__s, 1, D.5142, __fmt, __builtin_va_arg_pack ());
  return D.5141;
}


hash_iter ()
{
  long unsigned int D.5144;
  void * D.5145;
  void * key.9;
  void * value.10;
  gchar * D.5150;
  long int key.11;
  unsigned int D.5152;
  unsigned int keys_sum.12;
  unsigned int D.5154;
  long int value.13;
  unsigned int D.5156;
  unsigned int values_sum.14;
  unsigned int D.5158;
  int D.5159;
  _Bool D.5160;
  _Bool D.5161;
  _Bool D.5162;
  struct GHashTable * hash;
  struct GHashTableIter iter;
  int i;
  int sum;
  int keys_sum;
  int values_sum;
  void * key;
  void * value;

  try
    {
      hash = monoeg_g_hash_table_new_full (monoeg_g_direct_hash, monoeg_g_direct_equal, 0B, 0B);
      sum = 0;
      i = 0;
      goto <D.5020>;
      <D.5019>:
      sum = sum + i;
      D.5144 = (long unsigned int) i;
      D.5145 = (void *) D.5144;
      D.5144 = (long unsigned int) i;
      D.5145 = (void *) D.5144;
      monoeg_g_hash_table_insert_replace (hash, D.5145, D.5145, 0);
      i = i + 1;
      <D.5020>:
      if (i <= 999) goto <D.5019>; else goto <D.5021>;
      <D.5021>:
      values_sum = 0;
      keys_sum = values_sum;
      monoeg_g_hash_table_iter_init (&iter, hash);
      goto <D.5023>;
      <D.5022>:
      key.9 = key;
      value.10 = value;
      if (key.9 != value.10) goto <D.5148>; else goto <D.5149>;
      <D.5148>:
      D.5150 = FAILED ("key != value");
      return D.5150;
      <D.5149>:
      key.9 = key;
      key.11 = (long int) key.9;
      D.5152 = (unsigned int) key.11;
      keys_sum.12 = (unsigned int) keys_sum;
      D.5154 = D.5152 + keys_sum.12;
      keys_sum = (int) D.5154;
      value.10 = value;
      value.13 = (long int) value.10;
      D.5156 = (unsigned int) value.13;
      values_sum.14 = (unsigned int) values_sum;
      D.5158 = D.5156 + values_sum.14;
      values_sum = (int) D.5158;
      <D.5023>:
      D.5159 = monoeg_g_hash_table_iter_next (&iter, &key, &value);
      if (D.5159 != 0) goto <D.5022>; else goto <D.5024>;
      <D.5024>:
      D.5160 = keys_sum != sum;
      D.5161 = values_sum != sum;
      D.5162 = D.5160 | D.5161;
      if (D.5162 != 0) goto <D.5163>; else goto <D.5164>;
      <D.5163>:
      D.5150 = FAILED ("Did not find all key-value pairs");
      return D.5150;
      <D.5164>:
      monoeg_g_hash_table_destroy (hash);
      D.5150 = 0B;
      return D.5150;
    }
  finally
    {
      iter = {CLOBBER};
      key = {CLOBBER};
      value = {CLOBBER};
    }
}


hashtable_tests_init ()
{
  struct Test * D.5167;

  D.5167 = &hashtable_tests;
  return D.5167;
}


