monoeg_g_pattern_spec_new (const gchar * pattern)
{
  struct GPatternSpec * D.5564;
  struct GSList * D.5567;
  struct GPatternSpec * spec;

  if (pattern == 0B) goto <D.5562>; else goto <D.5563>;
  <D.5562>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 127, "pattern != NULL");
  D.5564 = 0B;
  return D.5564;
  <D.5563>:
  spec = monoeg_malloc0 (4);
  if (pattern != 0B) goto <D.5565>; else goto <D.5566>;
  <D.5565>:
  D.5567 = compile_pattern (pattern);
  spec->pattern = D.5567;
  <D.5566>:
  D.5564 = spec;
  return D.5564;
}


compile_pattern (const gchar * pattern)
{
  struct GSList * D.5571;
  const gchar * D.5572;
  unsigned int D.5577;
  gchar * D.5580;
  MatchType iftmp.0;
  int D.5589;
  char * D.5596;
  struct GSList * list;
  size_t i;
  size_t len;
  struct PData * data;
  gchar c;
  MatchType last;
  struct GString * str;
  gboolean free_str;

  last = -1;
  if (pattern == 0B) goto <D.5569>; else goto <D.5570>;
  <D.5569>:
  D.5571 = 0B;
  return D.5571;
  <D.5570>:
  data = 0B;
  list = 0B;
  free_str = 1;
  str = monoeg_g_string_new ("");
  i = 0;
  len = strlen (pattern);
  goto <D.5520>;
  <D.5519>:
  D.5572 = pattern + i;
  c = *D.5572;
  if (c == 42) goto <D.5573>; else goto <D.5576>;
  <D.5576>:
  if (c == 63) goto <D.5573>; else goto <D.5574>;
  <D.5573>:
  D.5577 = str->len;
  if (D.5577 != 0) goto <D.5578>; else goto <D.5579>;
  <D.5578>:
  data = monoeg_malloc0 (8);
  data->type = 0;
  D.5580 = monoeg_g_string_free (str, 0);
  data->str = D.5580;
  list = monoeg_g_slist_append (list, data);
  str = monoeg_g_string_new ("");
  <D.5579>:
  if (last == 2) goto <D.5581>; else goto <D.5582>;
  <D.5581>:
  if (c == 42) goto <D.5583>; else goto <D.5584>;
  <D.5583>:
  // predicted unlikely by continue predictor.
  goto <D.5518>;
  <D.5584>:
  <D.5582>:
  data = monoeg_malloc0 (8);
  if (c == 42) goto <D.5586>; else goto <D.5587>;
  <D.5586>:
  iftmp.0 = 2;
  goto <D.5588>;
  <D.5587>:
  iftmp.0 = 1;
  <D.5588>:
  data->type = iftmp.0;
  list = monoeg_g_slist_append (list, data);
  last = data->type;
  goto <D.5575>;
  <D.5574>:
  D.5589 = (int) c;
  monoeg_g_string_append_c (str, D.5589);
  last = 0;
  <D.5575>:
  <D.5518>:
  i = i + 1;
  <D.5520>:
  if (i < len) goto <D.5519>; else goto <D.5521>;
  <D.5521>:
  if (last == 2) goto <D.5592>; else goto <D.5590>;
  <D.5592>:
  D.5577 = str->len;
  if (D.5577 == 0) goto <D.5593>; else goto <D.5590>;
  <D.5593>:
  data->type = 3;
  free_str = 1;
  goto <D.5591>;
  <D.5590>:
  D.5577 = str->len;
  if (D.5577 != 0) goto <D.5594>; else goto <D.5595>;
  <D.5594>:
  data = monoeg_malloc0 (8);
  data->type = 0;
  D.5596 = str->str;
  data->str = D.5596;
  free_str = 0;
  list = monoeg_g_slist_append (list, data);
  <D.5595>:
  <D.5591>:
  monoeg_g_string_free (str, free_str);
  D.5571 = list;
  return D.5571;
}


monoeg_g_pattern_spec_free (struct GPatternSpec * pspec)
{
  struct GSList * D.5600;

  if (pspec != 0B) goto <D.5598>; else goto <D.5599>;
  <D.5598>:
  D.5600 = pspec->pattern;
  monoeg_g_slist_foreach (D.5600, free_pdata, 0B);
  D.5600 = pspec->pattern;
  monoeg_g_slist_free (D.5600);
  pspec->pattern = 0B;
  <D.5599>:
  monoeg_g_free (pspec);
}


free_pdata (void * data, void * user_data)
{
  gchar * D.5601;
  struct PData * d;

  d = data;
  D.5601 = d->str;
  if (D.5601 != 0B) goto <D.5602>; else goto <D.5603>;
  <D.5602>:
  D.5601 = d->str;
  monoeg_g_free (D.5601);
  <D.5603>:
  monoeg_g_free (d);
}


monoeg_g_pattern_match_string (struct GPatternSpec * pspec, const gchar * string)
{
  gboolean D.5606;
  struct GSList * D.5609;
  unsigned int D.5612;

  if (pspec == 0B) goto <D.5604>; else goto <D.5605>;
  <D.5604>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 205, "pspec != NULL");
  D.5606 = 0;
  return D.5606;
  <D.5605>:
  if (string == 0B) goto <D.5607>; else goto <D.5608>;
  <D.5607>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 206, "string != NULL");
  D.5606 = 0;
  return D.5606;
  <D.5608>:
  D.5609 = pspec->pattern;
  if (D.5609 == 0B) goto <D.5610>; else goto <D.5611>;
  <D.5610>:
  D.5606 = 0;
  return D.5606;
  <D.5611>:
  D.5609 = pspec->pattern;
  D.5612 = strlen (string);
  D.5606 = match_string (D.5609, string, 0, D.5612);
  return D.5606;
}


match_string (struct GSList * list, const gchar * str, size_t idx, size_t max)
{
  <unnamed type> D.5614;
  gboolean D.5617;
  gchar * D.5620;
  const char * D.5621;
  int D.5622;
  struct GSList * D.5635;
  unsigned int idx.1;
  int D.5637;
  int iftmp.2;
  size_t len;

  goto <D.5555>;
  <D.5554>:
  {
    struct PData * data;

    data = list->data;
    D.5614 = data->type;
    if (D.5614 == 3) goto <D.5615>; else goto <D.5616>;
    <D.5615>:
    D.5617 = 1;
    return D.5617;
    <D.5616>:
    D.5614 = data->type;
    if (D.5614 == 0) goto <D.5618>; else goto <D.5619>;
    <D.5618>:
    D.5620 = data->str;
    len = strlen (D.5620);
    D.5621 = str + idx;
    D.5620 = data->str;
    D.5622 = strncmp (D.5621, D.5620, len);
    if (D.5622 != 0) goto <D.5623>; else goto <D.5624>;
    <D.5623>:
    D.5617 = 0;
    return D.5617;
    <D.5624>:
    idx = idx + len;
    list = list->next;
    if (list != 0B) goto <D.5625>; else goto <D.5626>;
    <D.5625>:
    data = list->data;
    D.5614 = data->type;
    if (D.5614 == 3) goto <D.5627>; else goto <D.5628>;
    <D.5627>:
    D.5617 = 1;
    return D.5617;
    <D.5628>:
    <D.5626>:
    goto <D.5629>;
    <D.5619>:
    D.5614 = data->type;
    if (D.5614 == 1) goto <D.5630>; else goto <D.5631>;
    <D.5630>:
    idx = idx + 1;
    list = list->next;
    goto <D.5632>;
    <D.5631>:
    D.5614 = data->type;
    if (D.5614 == 2) goto <D.5633>; else goto <D.5634>;
    <D.5633>:
    goto <D.5552>;
    <D.5551>:
    D.5635 = list->next;
    idx.1 = idx;
    idx = idx.1 + 1;
    D.5637 = match_string (D.5635, str, idx.1, max);
    if (D.5637 != 0) goto <D.5638>; else goto <D.5639>;
    <D.5638>:
    D.5617 = 1;
    return D.5617;
    <D.5639>:
    <D.5552>:
    if (idx < max) goto <D.5551>; else goto <D.5553>;
    <D.5553>:
    D.5617 = 0;
    return D.5617;
    <D.5634>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "gpattern.c", 196);
    <D.5632>:
    <D.5629>:
  }
  <D.5555>:
  if (list != 0B) goto <D.5640>; else goto <D.5556>;
  <D.5640>:
  if (idx < max) goto <D.5554>; else goto <D.5556>;
  <D.5556>:
  if (list == 0B) goto <D.5644>; else goto <D.5642>;
  <D.5644>:
  if (idx >= max) goto <D.5645>; else goto <D.5642>;
  <D.5645>:
  iftmp.2 = 1;
  goto <D.5643>;
  <D.5642>:
  iftmp.2 = 0;
  <D.5643>:
  D.5617 = iftmp.2;
  return D.5617;
}


