monoeg_g_pattern_spec_new (const gchar * pattern)
{
  struct GPatternSpec * D.6408;
  struct GSList * D.6411;
  struct GPatternSpec * spec;

  if (pattern == 0B) goto <D.6406>; else goto <D.6407>;
  <D.6406>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 127, "pattern != NULL");
  D.6408 = 0B;
  return D.6408;
  <D.6407>:
  spec = monoeg_malloc0 (8);
  if (pattern != 0B) goto <D.6409>; else goto <D.6410>;
  <D.6409>:
  D.6411 = compile_pattern (pattern);
  spec->pattern = D.6411;
  <D.6410>:
  D.6408 = spec;
  return D.6408;
}


compile_pattern (const gchar * pattern)
{
  struct GSList * D.6415;
  const gchar * D.6416;
  long unsigned int D.6421;
  gchar * D.6424;
  MatchType iftmp.0;
  char * D.6439;
  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.6413>; else goto <D.6414>;
  <D.6413>:
  D.6415 = 0B;
  return D.6415;
  <D.6414>:
  data = 0B;
  list = 0B;
  free_str = 1;
  str = monoeg_g_string_new ("");
  i = 0;
  len = strlen (pattern);
  goto <D.6364>;
  <D.6363>:
  D.6416 = pattern + i;
  c = *D.6416;
  if (c == 42) goto <D.6417>; else goto <D.6420>;
  <D.6420>:
  if (c == 63) goto <D.6417>; else goto <D.6418>;
  <D.6417>:
  D.6421 = str->len;
  if (D.6421 != 0) goto <D.6422>; else goto <D.6423>;
  <D.6422>:
  data = monoeg_malloc0 (16);
  data->type = 0;
  D.6424 = monoeg_g_string_free (str, 0);
  data->str = D.6424;
  list = monoeg_g_slist_append (list, data);
  str = monoeg_g_string_new ("");
  <D.6423>:
  if (last == 2) goto <D.6425>; else goto <D.6426>;
  <D.6425>:
  if (c == 42) goto <D.6427>; else goto <D.6428>;
  <D.6427>:
  // predicted unlikely by continue predictor.
  goto <D.6362>;
  <D.6428>:
  <D.6426>:
  data = monoeg_malloc0 (16);
  if (c == 42) goto <D.6430>; else goto <D.6431>;
  <D.6430>:
  iftmp.0 = 2;
  goto <D.6432>;
  <D.6431>:
  iftmp.0 = 1;
  <D.6432>:
  data->type = iftmp.0;
  list = monoeg_g_slist_append (list, data);
  last = data->type;
  goto <D.6419>;
  <D.6418>:
  monoeg_g_string_append_c (str, c);
  last = 0;
  <D.6419>:
  <D.6362>:
  i = i + 1;
  <D.6364>:
  if (i < len) goto <D.6363>; else goto <D.6365>;
  <D.6365>:
  if (last == 2) goto <D.6435>; else goto <D.6433>;
  <D.6435>:
  D.6421 = str->len;
  if (D.6421 == 0) goto <D.6436>; else goto <D.6433>;
  <D.6436>:
  data->type = 3;
  free_str = 1;
  goto <D.6434>;
  <D.6433>:
  D.6421 = str->len;
  if (D.6421 != 0) goto <D.6437>; else goto <D.6438>;
  <D.6437>:
  data = monoeg_malloc0 (16);
  data->type = 0;
  D.6439 = str->str;
  data->str = D.6439;
  free_str = 0;
  list = monoeg_g_slist_append (list, data);
  <D.6438>:
  <D.6434>:
  monoeg_g_string_free (str, free_str);
  D.6415 = list;
  return D.6415;
}


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

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


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

  d = data;
  D.6444 = d->str;
  if (D.6444 != 0B) goto <D.6445>; else goto <D.6446>;
  <D.6445>:
  D.6444 = d->str;
  monoeg_g_free (D.6444);
  <D.6446>:
  monoeg_g_free (d);
}


monoeg_g_pattern_match_string (struct GPatternSpec * pspec, const gchar * string)
{
  gboolean D.6449;
  struct GSList * D.6452;
  long unsigned int D.6455;

  if (pspec == 0B) goto <D.6447>; else goto <D.6448>;
  <D.6447>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 205, "pspec != NULL");
  D.6449 = 0;
  return D.6449;
  <D.6448>:
  if (string == 0B) goto <D.6450>; else goto <D.6451>;
  <D.6450>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 206, "string != NULL");
  D.6449 = 0;
  return D.6449;
  <D.6451>:
  D.6452 = pspec->pattern;
  if (D.6452 == 0B) goto <D.6453>; else goto <D.6454>;
  <D.6453>:
  D.6449 = 0;
  return D.6449;
  <D.6454>:
  D.6452 = pspec->pattern;
  D.6455 = strlen (string);
  D.6449 = match_string (D.6452, string, 0, D.6455);
  return D.6449;
}


match_string (struct GSList * list, const gchar * str, size_t idx, size_t max)
{
  <unnamed type> D.6457;
  gboolean D.6460;
  gchar * D.6463;
  const char * D.6464;
  int D.6465;
  struct GSList * D.6478;
  long unsigned int idx.1;
  int D.6480;
  int iftmp.2;
  size_t len;

  goto <D.6399>;
  <D.6398>:
  {
    struct PData * data;

    data = list->data;
    D.6457 = data->type;
    if (D.6457 == 3) goto <D.6458>; else goto <D.6459>;
    <D.6458>:
    D.6460 = 1;
    return D.6460;
    <D.6459>:
    D.6457 = data->type;
    if (D.6457 == 0) goto <D.6461>; else goto <D.6462>;
    <D.6461>:
    D.6463 = data->str;
    len = strlen (D.6463);
    D.6464 = str + idx;
    D.6463 = data->str;
    D.6465 = strncmp (D.6464, D.6463, len);
    if (D.6465 != 0) goto <D.6466>; else goto <D.6467>;
    <D.6466>:
    D.6460 = 0;
    return D.6460;
    <D.6467>:
    idx = idx + len;
    list = list->next;
    if (list != 0B) goto <D.6468>; else goto <D.6469>;
    <D.6468>:
    data = list->data;
    D.6457 = data->type;
    if (D.6457 == 3) goto <D.6470>; else goto <D.6471>;
    <D.6470>:
    D.6460 = 1;
    return D.6460;
    <D.6471>:
    <D.6469>:
    goto <D.6472>;
    <D.6462>:
    D.6457 = data->type;
    if (D.6457 == 1) goto <D.6473>; else goto <D.6474>;
    <D.6473>:
    idx = idx + 1;
    list = list->next;
    goto <D.6475>;
    <D.6474>:
    D.6457 = data->type;
    if (D.6457 == 2) goto <D.6476>; else goto <D.6477>;
    <D.6476>:
    goto <D.6396>;
    <D.6395>:
    D.6478 = list->next;
    idx.1 = idx;
    idx = idx.1 + 1;
    D.6480 = match_string (D.6478, str, idx.1, max);
    if (D.6480 != 0) goto <D.6481>; else goto <D.6482>;
    <D.6481>:
    D.6460 = 1;
    return D.6460;
    <D.6482>:
    <D.6396>:
    if (idx < max) goto <D.6395>; else goto <D.6397>;
    <D.6397>:
    D.6460 = 0;
    return D.6460;
    <D.6477>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "gpattern.c", 196);
    <D.6475>:
    <D.6472>:
  }
  <D.6399>:
  if (list != 0B) goto <D.6483>; else goto <D.6400>;
  <D.6483>:
  if (idx < max) goto <D.6398>; else goto <D.6400>;
  <D.6400>:
  if (list == 0B) goto <D.6487>; else goto <D.6485>;
  <D.6487>:
  if (idx >= max) goto <D.6488>; else goto <D.6485>;
  <D.6488>:
  iftmp.2 = 1;
  goto <D.6486>;
  <D.6485>:
  iftmp.2 = 0;
  <D.6486>:
  D.6460 = iftmp.2;
  return D.6460;
}


