monoeg_g_pattern_spec_new (const gchar * pattern)
{
  struct GPatternSpec * D.8156;
  struct GSList * D.8159;
  struct GPatternSpec * spec;

  if (pattern == 0B) goto <D.8154>; else goto <D.8155>;
  <D.8154>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 127, "pattern != NULL");
  D.8156 = 0B;
  return D.8156;
  <D.8155>:
  spec = monoeg_malloc0 (4);
  if (pattern != 0B) goto <D.8157>; else goto <D.8158>;
  <D.8157>:
  D.8159 = compile_pattern (pattern);
  spec->pattern = D.8159;
  <D.8158>:
  D.8156 = spec;
  return D.8156;
}


compile_pattern (const gchar * pattern)
{
  struct GSList * D.8163;
  const gchar * D.8164;
  _Bool D.8165;
  _Bool D.8166;
  _Bool D.8167;
  unsigned int D.8170;
  gchar * D.8173;
  _Bool D.8174;
  _Bool D.8175;
  MatchType iftmp.0;
  char * D.8189;
  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.8161>; else goto <D.8162>;
  <D.8161>:
  D.8163 = 0B;
  return D.8163;
  <D.8162>:
  data = 0B;
  list = 0B;
  free_str = 1;
  str = monoeg_g_string_new ("");
  i = 0;
  len = strlen (pattern);
  goto <D.8110>;
  <D.8109>:
  D.8164 = pattern + i;
  c = *D.8164;
  D.8165 = c == 42;
  D.8166 = c == 63;
  D.8167 = D.8165 | D.8166;
  if (D.8167 != 0) goto <D.8168>; else goto <D.8169>;
  <D.8168>:
  D.8170 = str->len;
  if (D.8170 != 0) goto <D.8171>; else goto <D.8172>;
  <D.8171>:
  data = monoeg_malloc0 (8);
  data->type = 0;
  D.8173 = monoeg_g_string_free (str, 0);
  data->str = D.8173;
  list = monoeg_g_slist_append (list, data);
  str = monoeg_g_string_new ("");
  <D.8172>:
  D.8174 = last == 2;
  D.8165 = c == 42;
  D.8175 = D.8174 & D.8165;
  if (D.8175 != 0) goto <D.8176>; else goto <D.8177>;
  <D.8176>:
  // predicted unlikely by continue predictor.
  goto <D.8108>;
  <D.8177>:
  data = monoeg_malloc0 (8);
  if (c == 42) goto <D.8179>; else goto <D.8180>;
  <D.8179>:
  iftmp.0 = 2;
  goto <D.8181>;
  <D.8180>:
  iftmp.0 = 1;
  <D.8181>:
  data->type = iftmp.0;
  list = monoeg_g_slist_append (list, data);
  last = data->type;
  goto <D.8182>;
  <D.8169>:
  monoeg_g_string_append_c (str, c);
  last = 0;
  <D.8182>:
  <D.8108>:
  i = i + 1;
  <D.8110>:
  if (i < len) goto <D.8109>; else goto <D.8111>;
  <D.8111>:
  if (last == 2) goto <D.8185>; else goto <D.8183>;
  <D.8185>:
  D.8170 = str->len;
  if (D.8170 == 0) goto <D.8186>; else goto <D.8183>;
  <D.8186>:
  data->type = 3;
  free_str = 1;
  goto <D.8184>;
  <D.8183>:
  D.8170 = str->len;
  if (D.8170 != 0) goto <D.8187>; else goto <D.8188>;
  <D.8187>:
  data = monoeg_malloc0 (8);
  data->type = 0;
  D.8189 = str->str;
  data->str = D.8189;
  free_str = 0;
  list = monoeg_g_slist_append (list, data);
  <D.8188>:
  <D.8184>:
  monoeg_g_string_free (str, free_str);
  D.8163 = list;
  return D.8163;
}


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

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


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

  d = data;
  D.8194 = d->str;
  if (D.8194 != 0B) goto <D.8195>; else goto <D.8196>;
  <D.8195>:
  D.8194 = d->str;
  monoeg_g_free (D.8194);
  <D.8196>:
  monoeg_g_free (d);
}


monoeg_g_pattern_match_string (struct GPatternSpec * pspec, const gchar * string)
{
  gboolean D.8199;
  struct GSList * D.8202;
  unsigned int D.8205;

  if (pspec == 0B) goto <D.8197>; else goto <D.8198>;
  <D.8197>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 205, "pspec != NULL");
  D.8199 = 0;
  return D.8199;
  <D.8198>:
  if (string == 0B) goto <D.8200>; else goto <D.8201>;
  <D.8200>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 206, "string != NULL");
  D.8199 = 0;
  return D.8199;
  <D.8201>:
  D.8202 = pspec->pattern;
  if (D.8202 == 0B) goto <D.8203>; else goto <D.8204>;
  <D.8203>:
  D.8199 = 0;
  return D.8199;
  <D.8204>:
  D.8202 = pspec->pattern;
  D.8205 = strlen (string);
  D.8199 = match_string (D.8202, string, 0, D.8205);
  return D.8199;
}


match_string (struct GSList * list, const gchar * str, size_t idx, size_t max)
{
  <unnamed type> D.8207;
  gboolean D.8210;
  gchar * D.8213;
  const char * D.8214;
  int D.8215;
  struct GSList * D.8228;
  unsigned int idx.1;
  int D.8230;
  _Bool D.8233;
  _Bool D.8234;
  _Bool D.8235;
  _Bool D.8236;
  _Bool D.8237;
  _Bool D.8238;
  size_t len;

  goto <D.8145>;
  <D.8144>:
  {
    struct PData * data;

    data = list->data;
    D.8207 = data->type;
    if (D.8207 == 3) goto <D.8208>; else goto <D.8209>;
    <D.8208>:
    D.8210 = 1;
    return D.8210;
    <D.8209>:
    D.8207 = data->type;
    if (D.8207 == 0) goto <D.8211>; else goto <D.8212>;
    <D.8211>:
    D.8213 = data->str;
    len = strlen (D.8213);
    D.8214 = str + idx;
    D.8213 = data->str;
    D.8215 = strncmp (D.8214, D.8213, len);
    if (D.8215 != 0) goto <D.8216>; else goto <D.8217>;
    <D.8216>:
    D.8210 = 0;
    return D.8210;
    <D.8217>:
    idx = idx + len;
    list = list->next;
    if (list != 0B) goto <D.8218>; else goto <D.8219>;
    <D.8218>:
    data = list->data;
    D.8207 = data->type;
    if (D.8207 == 3) goto <D.8220>; else goto <D.8221>;
    <D.8220>:
    D.8210 = 1;
    return D.8210;
    <D.8221>:
    <D.8219>:
    goto <D.8222>;
    <D.8212>:
    D.8207 = data->type;
    if (D.8207 == 1) goto <D.8223>; else goto <D.8224>;
    <D.8223>:
    idx = idx + 1;
    list = list->next;
    goto <D.8225>;
    <D.8224>:
    D.8207 = data->type;
    if (D.8207 == 2) goto <D.8226>; else goto <D.8227>;
    <D.8226>:
    goto <D.8142>;
    <D.8141>:
    D.8228 = list->next;
    idx.1 = idx;
    idx = idx.1 + 1;
    D.8230 = match_string (D.8228, str, idx.1, max);
    if (D.8230 != 0) goto <D.8231>; else goto <D.8232>;
    <D.8231>:
    D.8210 = 1;
    return D.8210;
    <D.8232>:
    <D.8142>:
    if (idx < max) goto <D.8141>; else goto <D.8143>;
    <D.8143>:
    D.8210 = 0;
    return D.8210;
    <D.8227>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "gpattern.c", 196);
    <D.8225>:
    <D.8222>:
  }
  <D.8145>:
  D.8233 = list != 0B;
  D.8234 = idx < max;
  D.8235 = D.8233 & D.8234;
  if (D.8235 != 0) goto <D.8144>; else goto <D.8146>;
  <D.8146>:
  D.8236 = list == 0B;
  D.8237 = idx >= max;
  D.8238 = D.8236 & D.8237;
  D.8210 = (gboolean) D.8238;
  return D.8210;
}


