monoeg_g_pattern_spec_new (const gchar * pattern)
{
  struct GPatternSpec * D.5894;
  struct GSList * D.5897;
  struct GPatternSpec * spec;

  if (pattern == 0B) goto <D.5892>; else goto <D.5893>;
  <D.5892>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 127, "pattern != NULL");
  D.5894 = 0B;
  return D.5894;
  <D.5893>:
  spec = monoeg_malloc0 (8);
  if (pattern != 0B) goto <D.5895>; else goto <D.5896>;
  <D.5895>:
  D.5897 = compile_pattern (pattern);
  spec->pattern = D.5897;
  <D.5896>:
  D.5894 = spec;
  return D.5894;
}


compile_pattern (const gchar * pattern)
{
  struct GSList * D.5901;
  const gchar * D.5902;
  _Bool D.5903;
  _Bool D.5904;
  _Bool D.5905;
  long unsigned int D.5908;
  gchar * D.5911;
  _Bool D.5912;
  _Bool D.5913;
  MatchType iftmp.0;
  int D.5921;
  char * D.5928;
  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.5899>; else goto <D.5900>;
  <D.5899>:
  D.5901 = 0B;
  return D.5901;
  <D.5900>:
  data = 0B;
  list = 0B;
  free_str = 1;
  str = monoeg_g_string_new ("");
  i = 0;
  len = strlen (pattern);
  goto <D.5850>;
  <D.5849>:
  D.5902 = pattern + i;
  c = *D.5902;
  D.5903 = c == 42;
  D.5904 = c == 63;
  D.5905 = D.5903 | D.5904;
  if (D.5905 != 0) goto <D.5906>; else goto <D.5907>;
  <D.5906>:
  D.5908 = str->len;
  if (D.5908 != 0) goto <D.5909>; else goto <D.5910>;
  <D.5909>:
  data = monoeg_malloc0 (16);
  data->type = 0;
  D.5911 = monoeg_g_string_free (str, 0);
  data->str = D.5911;
  list = monoeg_g_slist_append (list, data);
  str = monoeg_g_string_new ("");
  <D.5910>:
  D.5912 = last == 2;
  D.5903 = c == 42;
  D.5913 = D.5912 & D.5903;
  if (D.5913 != 0) goto <D.5914>; else goto <D.5915>;
  <D.5914>:
  // predicted unlikely by continue predictor.
  goto <D.5848>;
  <D.5915>:
  data = monoeg_malloc0 (16);
  if (c == 42) goto <D.5917>; else goto <D.5918>;
  <D.5917>:
  iftmp.0 = 2;
  goto <D.5919>;
  <D.5918>:
  iftmp.0 = 1;
  <D.5919>:
  data->type = iftmp.0;
  list = monoeg_g_slist_append (list, data);
  last = data->type;
  goto <D.5920>;
  <D.5907>:
  D.5921 = (int) c;
  monoeg_g_string_append_c (str, D.5921);
  last = 0;
  <D.5920>:
  <D.5848>:
  i = i + 1;
  <D.5850>:
  if (i < len) goto <D.5849>; else goto <D.5851>;
  <D.5851>:
  if (last == 2) goto <D.5924>; else goto <D.5922>;
  <D.5924>:
  D.5908 = str->len;
  if (D.5908 == 0) goto <D.5925>; else goto <D.5922>;
  <D.5925>:
  data->type = 3;
  free_str = 1;
  goto <D.5923>;
  <D.5922>:
  D.5908 = str->len;
  if (D.5908 != 0) goto <D.5926>; else goto <D.5927>;
  <D.5926>:
  data = monoeg_malloc0 (16);
  data->type = 0;
  D.5928 = str->str;
  data->str = D.5928;
  free_str = 0;
  list = monoeg_g_slist_append (list, data);
  <D.5927>:
  <D.5923>:
  monoeg_g_string_free (str, free_str);
  D.5901 = list;
  return D.5901;
}


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

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


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

  d = data;
  D.5933 = d->str;
  if (D.5933 != 0B) goto <D.5934>; else goto <D.5935>;
  <D.5934>:
  D.5933 = d->str;
  monoeg_g_free (D.5933);
  <D.5935>:
  monoeg_g_free (d);
}


monoeg_g_pattern_match_string (struct GPatternSpec * pspec, const gchar * string)
{
  gboolean D.5938;
  struct GSList * D.5941;
  long unsigned int D.5944;

  if (pspec == 0B) goto <D.5936>; else goto <D.5937>;
  <D.5936>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 205, "pspec != NULL");
  D.5938 = 0;
  return D.5938;
  <D.5937>:
  if (string == 0B) goto <D.5939>; else goto <D.5940>;
  <D.5939>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gpattern.c", 206, "string != NULL");
  D.5938 = 0;
  return D.5938;
  <D.5940>:
  D.5941 = pspec->pattern;
  if (D.5941 == 0B) goto <D.5942>; else goto <D.5943>;
  <D.5942>:
  D.5938 = 0;
  return D.5938;
  <D.5943>:
  D.5944 = strlen (string);
  D.5941 = pspec->pattern;
  D.5938 = match_string (D.5941, string, 0, D.5944);
  return D.5938;
}


match_string (struct GSList * list, const gchar * str, size_t idx, size_t max)
{
  <unnamed type> D.5946;
  gboolean D.5949;
  gchar * D.5952;
  const char * D.5953;
  int D.5954;
  long unsigned int idx.1;
  struct GSList * D.5968;
  int D.5969;
  _Bool D.5972;
  _Bool D.5973;
  _Bool D.5974;
  _Bool D.5975;
  _Bool D.5976;
  _Bool D.5977;
  size_t len;

  goto <D.5885>;
  <D.5884>:
  {
    struct PData * data;

    data = list->data;
    D.5946 = data->type;
    if (D.5946 == 3) goto <D.5947>; else goto <D.5948>;
    <D.5947>:
    D.5949 = 1;
    return D.5949;
    <D.5948>:
    D.5946 = data->type;
    if (D.5946 == 0) goto <D.5950>; else goto <D.5951>;
    <D.5950>:
    D.5952 = data->str;
    len = strlen (D.5952);
    D.5952 = data->str;
    D.5953 = str + idx;
    D.5954 = strncmp (D.5953, D.5952, len);
    if (D.5954 != 0) goto <D.5955>; else goto <D.5956>;
    <D.5955>:
    D.5949 = 0;
    return D.5949;
    <D.5956>:
    idx = idx + len;
    list = list->next;
    if (list != 0B) goto <D.5957>; else goto <D.5958>;
    <D.5957>:
    data = list->data;
    D.5946 = data->type;
    if (D.5946 == 3) goto <D.5959>; else goto <D.5960>;
    <D.5959>:
    D.5949 = 1;
    return D.5949;
    <D.5960>:
    <D.5958>:
    goto <D.5961>;
    <D.5951>:
    D.5946 = data->type;
    if (D.5946 == 1) goto <D.5962>; else goto <D.5963>;
    <D.5962>:
    idx = idx + 1;
    list = list->next;
    goto <D.5964>;
    <D.5963>:
    D.5946 = data->type;
    if (D.5946 == 2) goto <D.5965>; else goto <D.5966>;
    <D.5965>:
    goto <D.5882>;
    <D.5881>:
    idx.1 = idx;
    idx = idx.1 + 1;
    D.5968 = list->next;
    D.5969 = match_string (D.5968, str, idx.1, max);
    if (D.5969 != 0) goto <D.5970>; else goto <D.5971>;
    <D.5970>:
    D.5949 = 1;
    return D.5949;
    <D.5971>:
    <D.5882>:
    if (idx < max) goto <D.5881>; else goto <D.5883>;
    <D.5883>:
    D.5949 = 0;
    return D.5949;
    <D.5966>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "gpattern.c", 196);
    <D.5964>:
    <D.5961>:
  }
  <D.5885>:
  D.5972 = list != 0B;
  D.5973 = idx < max;
  D.5974 = D.5972 & D.5973;
  if (D.5974 != 0) goto <D.5884>; else goto <D.5886>;
  <D.5886>:
  D.5975 = list == 0B;
  D.5976 = idx >= max;
  D.5977 = D.5975 & D.5976;
  D.5949 = (gboolean) D.5977;
  return D.5949;
}


