run_test (struct Test * test, gchar * * result_out)
{
  gchar * (*<Te9f>) () D.5066;
  gboolean D.5069;
  gchar * result;

  D.5066 = test->handler;
  result = D.5066 ();
  if (result == 0B) goto <D.5067>; else goto <D.5068>;
  <D.5067>:
  *result_out = 0B;
  D.5069 = 1;
  return D.5069;
  <D.5068>:
  *result_out = result;
  D.5069 = 0;
  return D.5069;
}


run_group (struct Group * group, gint iterations, gboolean quiet, gboolean time, gchar * tests_to_run_s)
{
  struct Test * (*<Tea6>) () D.5071;
  const gchar * D.5076;
  int D.5022;
  long unsigned int D.5082;
  long unsigned int D.5083;
  struct Test * D.5084;
  const gchar * D.5085;
  long unsigned int D.5086;
  long unsigned int D.5087;
  gchar * * D.5088;
  gchar * D.5089;
  double D.5104;
  double D.5105;
  gchar * result.0;
  gchar * last_result.1;
  int global_passed.2;
  int global_passed.3;
  int global_tests.4;
  int global_tests.5;
  double D.5120;
  double D.5121;
  double D.5122;
  double D.5125;
  double D.5126;
  gboolean D.5130;
  _Bool D.5131;
  struct Test * tests;
  gint i;
  gint j;
  gint passed;
  gint total;
  gdouble start_time_group;
  gdouble start_time_test;
  gchar * * tests_to_run;

  D.5071 = group->handler;
  tests = D.5071 ();
  passed = 0;
  total = 0;
  tests_to_run = 0B;
  if (quiet == 0) goto <D.5072>; else goto <D.5073>;
  <D.5072>:
  if (iterations > 1) goto <D.5074>; else goto <D.5075>;
  <D.5074>:
  D.5076 = group->name;
  printf ("[%s] (%dx)\n", D.5076, iterations);
  goto <D.5077>;
  <D.5075>:
  D.5076 = group->name;
  printf ("[%s]\n", D.5076);
  <D.5077>:
  <D.5073>:
  if (tests_to_run_s != 0B) goto <D.5078>; else goto <D.5079>;
  <D.5078>:
  tests_to_run = eg_strsplit (tests_to_run_s, ",", -1);
  <D.5079>:
  start_time_group = get_timestamp ();
  i = 0;
  goto <D.5031>;
  <D.5030>:
  {
    gchar * result;
    gboolean iter_pass;
    gboolean run;

    try
      {
        result = "";
        iter_pass = 0;
        if (tests_to_run != 0B) goto <D.5080>; else goto <D.5081>;
        <D.5080>:
        {
          gint j;

          run = 0;
          j = 0;
          goto <D.5025>;
          <D.5024>:
          {
            size_t __s1_len;
            size_t __s2_len;

            D.5082 = (long unsigned int) i;
            D.5083 = D.5082 * 16;
            D.5084 = tests + D.5083;
            D.5085 = D.5084->name;
            D.5086 = (long unsigned int) j;
            D.5087 = D.5086 * 8;
            D.5088 = tests_to_run + D.5087;
            D.5089 = *D.5088;
            D.5022 = __builtin_strcmp (D.5089, D.5085);
          }
          if (D.5022 == 0) goto <D.5090>; else goto <D.5091>;
          <D.5090>:
          run = 1;
          goto <D.5023>;
          <D.5091>:
          j = j + 1;
          <D.5025>:
          D.5086 = (long unsigned int) j;
          D.5087 = D.5086 * 8;
          D.5088 = tests_to_run + D.5087;
          D.5089 = *D.5088;
          if (D.5089 != 0B) goto <D.5024>; else goto <D.5023>;
          <D.5023>:
        }
        goto <D.5092>;
        <D.5081>:
        run = 1;
        <D.5092>:
        if (run == 0) goto <D.5093>; else goto <D.5094>;
        <D.5093>:
        // predicted unlikely by continue predictor.
        goto <D.5026>;
        <D.5094>:
        total = total + 1;
        if (quiet == 0) goto <D.5095>; else goto <D.5096>;
        <D.5095>:
        D.5082 = (long unsigned int) i;
        D.5083 = D.5082 * 16;
        D.5084 = tests + D.5083;
        D.5085 = D.5084->name;
        printf ("  %s: ", D.5085);
        <D.5096>:
        start_time_test = get_timestamp ();
        j = 0;
        goto <D.5029>;
        <D.5028>:
        D.5082 = (long unsigned int) i;
        D.5083 = D.5082 * 16;
        D.5084 = tests + D.5083;
        iter_pass = run_test (D.5084, &result);
        if (iter_pass == 0) goto <D.5027>; else goto <D.5097>;
        <D.5097>:
        j = j + 1;
        <D.5029>:
        if (j < iterations) goto <D.5028>; else goto <D.5027>;
        <D.5027>:
        if (iter_pass != 0) goto <D.5098>; else goto <D.5099>;
        <D.5098>:
        passed = passed + 1;
        if (quiet == 0) goto <D.5100>; else goto <D.5101>;
        <D.5100>:
        if (time != 0) goto <D.5102>; else goto <D.5103>;
        <D.5102>:
        D.5104 = get_timestamp ();
        D.5105 = D.5104 - start_time_test;
        printf ("OK (%g)\n", D.5105);
        goto <D.5106>;
        <D.5103>:
        printf ("OK\n");
        <D.5106>:
        <D.5101>:
        goto <D.5107>;
        <D.5099>:
        if (quiet == 0) goto <D.5108>; else goto <D.5109>;
        <D.5108>:
        result.0 = result;
        printf ("FAILED (%s)\n", result.0);
        <D.5109>:
        last_result.1 = last_result;
        result.0 = result;
        if (last_result.1 == result.0) goto <D.5112>; else goto <D.5113>;
        <D.5112>:
        last_result = 0B;
        result.0 = result;
        monoeg_g_free (result.0);
        <D.5113>:
        <D.5107>:
      }
    finally
      {
        result = {CLOBBER};
      }
  }
  <D.5026>:
  i = i + 1;
  <D.5031>:
  D.5082 = (long unsigned int) i;
  D.5083 = D.5082 * 16;
  D.5084 = tests + D.5083;
  D.5085 = D.5084->name;
  if (D.5085 != 0B) goto <D.5030>; else goto <D.5032>;
  <D.5032>:
  global_passed.2 = global_passed;
  global_passed.3 = global_passed.2 + passed;
  global_passed = global_passed.3;
  global_tests.4 = global_tests;
  global_tests.5 = global_tests.4 + total;
  global_tests = global_tests.5;
  if (quiet == 0) goto <D.5118>; else goto <D.5119>;
  <D.5118>:
  {
    gdouble pass_percentage;

    D.5120 = (double) passed;
    D.5121 = (double) total;
    D.5122 = D.5120 / D.5121;
    pass_percentage = D.5122 * 1.0e+2;
    if (time != 0) goto <D.5123>; else goto <D.5124>;
    <D.5123>:
    D.5125 = get_timestamp ();
    D.5126 = D.5125 - start_time_group;
    printf ("  %d / %d (%g%%, %g)\n", passed, total, pass_percentage, D.5126);
    goto <D.5127>;
    <D.5124>:
    printf ("  %d / %d (%g%%)\n", passed, total, pass_percentage);
    <D.5127>:
  }
  <D.5119>:
  if (tests_to_run != 0B) goto <D.5128>; else goto <D.5129>;
  <D.5128>:
  eg_strfreev (tests_to_run);
  <D.5129>:
  D.5131 = passed == total;
  D.5130 = (gboolean) D.5131;
  return D.5130;
}


printf (const char * restrict __fmt)
{
  int D.5135;

  D.5135 = __printf_chk (1, __fmt, __builtin_va_arg_pack ());
  return D.5135;
}


FAILED (const gchar * format)
{
  gchar * D.5139;
  gchar * ret.6;
  gchar * ret;
  struct  args[1];
  gint n;

  try
    {
      __builtin_va_start (&args, 0);
      n = vasprintf (&ret, format, &args);
      __builtin_va_end (&args);
      if (n == -1) goto <D.5137>; else goto <D.5138>;
      <D.5137>:
      last_result = 0B;
      D.5139 = 0B;
      return D.5139;
      <D.5138>:
      ret.6 = ret;
      last_result = ret.6;
      D.5139 = ret;
      return D.5139;
    }
  finally
    {
      ret = {CLOBBER};
      args = {CLOBBER};
    }
}


vasprintf (char * * restrict __ptr, const char * restrict __fmt, struct  * __ap)
{
  int D.5143;

  D.5143 = __vasprintf_chk (__ptr, 1, __fmt, __ap);
  return D.5143;
}


get_timestamp ()
{
  gdouble D.5145;
  long int D.5146;
  double D.5147;
  long int D.5148;
  double D.5149;
  double D.5150;
  struct GTimeVal res;

  try
    {
      monoeg_g_get_current_time (&res);
      D.5146 = res.tv_sec;
      D.5147 = (double) D.5146;
      D.5148 = res.tv_usec;
      D.5149 = (double) D.5148;
      D.5150 = D.5149 * 9.99999999999999954748111825886258685613938723690807819366e-7;
      D.5145 = D.5147 + D.5150;
      return D.5145;
    }
  finally
    {
      res = {CLOBBER};
    }
}


eg_strsplit (const gchar * string, const gchar * delimiter, gint max_tokens)
{
  gchar * * D.5155;
  char D.5158;
  long unsigned int D.5161;
  gchar * D.5162;
  gchar * D.5163;
  gchar * * iftmp.7;
  int D.5168;
  long unsigned int D.5169;
  long unsigned int D.5170;
  long unsigned int D.5171;
  long unsigned int D.5172;
  sizetype D.5173;
  gchar * * D.5174;
  _Bool D.5175;
  _Bool D.5176;
  _Bool D.5177;
  _Bool D.5182;
  _Bool D.5183;
  _Bool D.5184;
  gchar * string_c;
  gchar * strtok_save;
  gchar * * vector;
  gchar * token;
  gchar * token_c;
  gint size;
  size_t token_length;

  try
    {
      size = 1;
      if (string == 0B) goto <D.5153>; else goto <D.5154>;
      <D.5153>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "test.c", 222, "string != NULL");
      D.5155 = 0B;
      return D.5155;
      <D.5154>:
      if (delimiter == 0B) goto <D.5156>; else goto <D.5157>;
      <D.5156>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "test.c", 223, "delimiter != NULL");
      D.5155 = 0B;
      return D.5155;
      <D.5157>:
      D.5158 = *delimiter;
      if (D.5158 == 0) goto <D.5159>; else goto <D.5160>;
      <D.5159>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "test.c", 224, "delimiter[0] != 0");
      D.5155 = 0B;
      return D.5155;
      <D.5160>:
      token_length = strlen (string);
      D.5161 = token_length + 1;
      string_c = monoeg_malloc (D.5161);
      memcpy (string_c, string, token_length);
      D.5162 = string_c + token_length;
      *D.5162 = 0;
      vector = 0B;
      token = __strtok_r (string_c, delimiter, &strtok_save);
      goto <D.5057>;
      <D.5056>:
      token_length = strlen (token);
      D.5161 = token_length + 1;
      token_c = monoeg_malloc (D.5161);
      memcpy (token_c, token, token_length);
      D.5163 = token_c + token_length;
      *D.5163 = 0;
      if (vector == 0B) goto <D.5165>; else goto <D.5166>;
      <D.5165>:
      iftmp.7 = monoeg_malloc (16);
      goto <D.5167>;
      <D.5166>:
      D.5168 = size + 1;
      D.5169 = (long unsigned int) D.5168;
      D.5170 = D.5169 * 8;
      iftmp.7 = monoeg_realloc (vector, D.5170);
      <D.5167>:
      vector = iftmp.7;
      D.5171 = (long unsigned int) size;
      D.5172 = D.5171 * 8;
      D.5173 = D.5172 + 18446744073709551608;
      D.5174 = vector + D.5173;
      *D.5174 = token_c;
      size = size + 1;
      D.5175 = max_tokens > 0;
      D.5176 = size >= max_tokens;
      D.5177 = D.5175 & D.5176;
      if (D.5177 != 0) goto <D.5178>; else goto <D.5179>;
      <D.5178>:
      if (size > max_tokens) goto <D.5055>; else goto <D.5180>;
      <D.5180>:
      token = strtok_save;
      goto <D.5181>;
      <D.5179>:
      token = __strtok_r (0B, delimiter, &strtok_save);
      <D.5181>:
      <D.5057>:
      if (token != 0B) goto <D.5056>; else goto <D.5055>;
      <D.5055>:
      D.5182 = vector != 0B;
      D.5183 = size > 0;
      D.5184 = D.5182 & D.5183;
      if (D.5184 != 0) goto <D.5185>; else goto <D.5186>;
      <D.5185>:
      D.5171 = (long unsigned int) size;
      D.5172 = D.5171 * 8;
      D.5173 = D.5172 + 18446744073709551608;
      D.5174 = vector + D.5173;
      *D.5174 = 0B;
      <D.5186>:
      monoeg_g_free (string_c);
      string_c = 0B;
      D.5155 = vector;
      return D.5155;
    }
  finally
    {
      strtok_save = {CLOBBER};
    }
}


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

  D.5190 = __builtin_object_size (__dest, 0);
  D.5189 = __builtin___memcpy_chk (__dest, __src, __len, D.5190);
  return D.5189;
}


eg_strfreev (gchar * * str_array)
{
  gchar * D.5194;
  gchar * * orig;

  orig = str_array;
  if (str_array == 0B) goto <D.5192>; else goto <D.5193>;
  <D.5192>:
  return;
  <D.5193>:
  goto <D.5063>;
  <D.5062>:
  D.5194 = *str_array;
  monoeg_g_free (D.5194);
  str_array = str_array + 8;
  <D.5063>:
  D.5194 = *str_array;
  if (D.5194 != 0B) goto <D.5062>; else goto <D.5064>;
  <D.5064>:
  monoeg_g_free (orig);
}


