monoeg_g_pattern_spec_new (const gchar * pattern)
{
  struct GPatternSpec * D.5544;
  struct GSList * D.5547;
  struct GPatternSpec * spec;

  if (pattern == 0B) goto <D.5542>; else goto <D.5543>;
  <D.5542>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 127, "pattern != NULL");
  D.5544 = 0B;
  return D.5544;
  <D.5543>:
  spec = monoeg_malloc0 (4);
  if (pattern != 0B) goto <D.5545>; else goto <D.5546>;
  <D.5545>:
  D.5547 = compile_pattern (pattern);
  spec->pattern = D.5547;
  <D.5546>:
  D.5544 = spec;
  return D.5544;
}


compile_pattern (const gchar * pattern)
{
  struct GSList * D.5551;
  const gchar * D.5552;
  _Bool D.5553;
  _Bool D.5554;
  _Bool D.5555;
  unsigned int D.5558;
  gchar * D.5561;
  _Bool D.5562;
  _Bool D.5563;
  MatchType iftmp.0;
  int D.5571;
  char * D.5578;
  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.5549>; else goto <D.5550>;
  <D.5549>:
  D.5551 = 0B;
  return D.5551;
  <D.5550>:
  data = 0B;
  list = 0B;
  free_str = 1;
  str = monoeg_g_string_new ("");
  i = 0;
  len = strlen (pattern);
  goto <D.5500>;
  <D.5499>:
  D.5552 = pattern + i;
  c = *D.5552;
  D.5553 = c == 42;
  D.5554 = c == 63;
  D.5555 = D.5553 | D.5554;
  if (D.5555 != 0) goto <D.5556>; else goto <D.5557>;
  <D.5556>:
  D.5558 = str->len;
  if (D.5558 != 0) goto <D.5559>; else goto <D.5560>;
  <D.5559>:
  data = monoeg_malloc0 (8);
  data->type = 0;
  D.5561 = monoeg_g_string_free (str, 0);
  data->str = D.5561;
  list = monoeg_g_slist_append (list, data);
  str = monoeg_g_string_new ("");
  <D.5560>:
  D.5562 = last == 2;
  D.5553 = c == 42;
  D.5563 = D.5562 & D.5553;
  if (D.5563 != 0) goto <D.5564>; else goto <D.5565>;
  <D.5564>:
  // predicted unlikely by continue predictor.
  goto <D.5498>;
  <D.5565>:
  data = monoeg_malloc0 (8);
  if (c == 42) goto <D.5567>; else goto <D.5568>;
  <D.5567>:
  iftmp.0 = 2;
  goto <D.5569>;
  <D.5568>:
  iftmp.0 = 1;
  <D.5569>:
  data->type = iftmp.0;
  list = monoeg_g_slist_append (list, data);
  last = data->type;
  goto <D.5570>;
  <D.5557>:
  D.5571 = (int) c;
  monoeg_g_string_append_c (str, D.5571);
  last = 0;
  <D.5570>:
  <D.5498>:
  i = i + 1;
  <D.5500>:
  if (i < len) goto <D.5499>; else goto <D.5501>;
  <D.5501>:
  if (last == 2) goto <D.5574>; else goto <D.5572>;
  <D.5574>:
  D.5558 = str->len;
  if (D.5558 == 0) goto <D.5575>; else goto <D.5572>;
  <D.5575>:
  data->type = 3;
  free_str = 1;
  goto <D.5573>;
  <D.5572>:
  D.5558 = str->len;
  if (D.5558 != 0) goto <D.5576>; else goto <D.5577>;
  <D.5576>:
  data = monoeg_malloc0 (8);
  data->type = 0;
  D.5578 = str->str;
  data->str = D.5578;
  free_str = 0;
  list = monoeg_g_slist_append (list, data);
  <D.5577>:
  <D.5573>:
  monoeg_g_string_free (str, free_str);
  D.5551 = list;
  return D.5551;
}


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

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


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

  d = data;
  D.5583 = d->str;
  if (D.5583 != 0B) goto <D.5584>; else goto <D.5585>;
  <D.5584>:
  D.5583 = d->str;
  monoeg_g_free (D.5583);
  <D.5585>:
  monoeg_g_free (d);
}


monoeg_g_pattern_match_string (struct GPatternSpec * pspec, const gchar * string)
{
  gboolean D.5588;
  struct GSList * D.5591;
  unsigned int D.5594;

  if (pspec == 0B) goto <D.5586>; else goto <D.5587>;
  <D.5586>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 205, "pspec != NULL");
  D.5588 = 0;
  return D.5588;
  <D.5587>:
  if (string == 0B) goto <D.5589>; else goto <D.5590>;
  <D.5589>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 206, "string != NULL");
  D.5588 = 0;
  return D.5588;
  <D.5590>:
  D.5591 = pspec->pattern;
  if (D.5591 == 0B) goto <D.5592>; else goto <D.5593>;
  <D.5592>:
  D.5588 = 0;
  return D.5588;
  <D.5593>:
  D.5594 = strlen (string);
  D.5591 = pspec->pattern;
  D.5588 = match_string (D.5591, string, 0, D.5594);
  return D.5588;
}


match_string (struct GSList * list, const gchar * str, size_t idx, size_t max)
{
  <unnamed type> D.5596;
  gboolean D.5599;
  gchar * D.5602;
  const char * D.5603;
  int D.5604;
  unsigned int idx.1;
  struct GSList * D.5618;
  int D.5619;
  _Bool D.5622;
  _Bool D.5623;
  _Bool D.5624;
  _Bool D.5625;
  _Bool D.5626;
  _Bool D.5627;
  size_t len;

  goto <D.5535>;
  <D.5534>:
  {
    struct PData * data;

    data = list->data;
    D.5596 = data->type;
    if (D.5596 == 3) goto <D.5597>; else goto <D.5598>;
    <D.5597>:
    D.5599 = 1;
    return D.5599;
    <D.5598>:
    D.5596 = data->type;
    if (D.5596 == 0) goto <D.5600>; else goto <D.5601>;
    <D.5600>:
    D.5602 = data->str;
    len = strlen (D.5602);
    D.5602 = data->str;
    D.5603 = str + idx;
    D.5604 = strncmp (D.5603, D.5602, len);
    if (D.5604 != 0) goto <D.5605>; else goto <D.5606>;
    <D.5605>:
    D.5599 = 0;
    return D.5599;
    <D.5606>:
    idx = idx + len;
    list = list->next;
    if (list != 0B) goto <D.5607>; else goto <D.5608>;
    <D.5607>:
    data = list->data;
    D.5596 = data->type;
    if (D.5596 == 3) goto <D.5609>; else goto <D.5610>;
    <D.5609>:
    D.5599 = 1;
    return D.5599;
    <D.5610>:
    <D.5608>:
    goto <D.5611>;
    <D.5601>:
    D.5596 = data->type;
    if (D.5596 == 1) goto <D.5612>; else goto <D.5613>;
    <D.5612>:
    idx = idx + 1;
    list = list->next;
    goto <D.5614>;
    <D.5613>:
    D.5596 = data->type;
    if (D.5596 == 2) goto <D.5615>; else goto <D.5616>;
    <D.5615>:
    goto <D.5532>;
    <D.5531>:
    idx.1 = idx;
    idx = idx.1 + 1;
    D.5618 = list->next;
    D.5619 = match_string (D.5618, str, idx.1, max);
    if (D.5619 != 0) goto <D.5620>; else goto <D.5621>;
    <D.5620>:
    D.5599 = 1;
    return D.5599;
    <D.5621>:
    <D.5532>:
    if (idx < max) goto <D.5531>; else goto <D.5533>;
    <D.5533>:
    D.5599 = 0;
    return D.5599;
    <D.5616>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "gpattern.c", 196);
    <D.5614>:
    <D.5611>:
  }
  <D.5535>:
  D.5622 = list != 0B;
  D.5623 = idx < max;
  D.5624 = D.5622 & D.5623;
  if (D.5624 != 0) goto <D.5534>; else goto <D.5536>;
  <D.5536>:
  D.5625 = list == 0B;
  D.5626 = idx >= max;
  D.5627 = D.5625 & D.5626;
  D.5599 = (gboolean) D.5627;
  return D.5599;
}


