_wapi_glob (struct GDir * dir, const char * pattern, int flags, struct wapi_glob_t * pglob)
{
  int D.6309;
  int D.6312;
  const u_char * patnext.0;
  unsigned char D.6316;
  gchar * bufnext.1;
  char D.6320;
  gchar * bufnext.2;
  const u_char * patnext.3;
  unsigned char D.6325;
  int D.6326;
  int D.6327;
  int D.6328;
  const u_char * patnext;
  int c;
  gchar * bufnext;
  gchar * bufend;
  gchar patbuf[4096];

  try
    {
      patnext = pattern;
      D.6309 = flags & 1;
      if (D.6309 == 0) goto <D.6310>; else goto <D.6311>;
      <D.6310>:
      pglob->gl_pathc = 0;
      pglob->gl_pathv = 0B;
      pglob->gl_offs = 0;
      <D.6311>:
      D.6312 = flags & -257;
      pglob->gl_flags = D.6312;
      bufnext = &patbuf;
      bufend = bufnext + 4095;
      goto <D.6196>;
      <D.6195>:
      if (c == 92) goto <D.6313>; else goto <D.6314>;
      <D.6313>:
      patnext.0 = patnext;
      patnext = patnext.0 + 1;
      D.6316 = *patnext.0;
      c = (int) D.6316;
      if (c == 0) goto <D.6317>; else goto <D.6318>;
      <D.6317>:
      c = 92;
      patnext = patnext + 18446744073709551615;
      <D.6318>:
      bufnext.1 = bufnext;
      bufnext = bufnext.1 + 1;
      D.6320 = (char) c;
      *bufnext.1 = D.6320;
      goto <D.6321>;
      <D.6314>:
      bufnext.2 = bufnext;
      bufnext = bufnext.2 + 1;
      D.6320 = (char) c;
      *bufnext.2 = D.6320;
      <D.6321>:
      <D.6196>:
      if (bufnext < bufend) goto <D.6323>; else goto <D.6197>;
      <D.6323>:
      patnext.3 = patnext;
      patnext = patnext.3 + 1;
      D.6325 = *patnext.3;
      c = (int) D.6325;
      if (c != 0) goto <D.6195>; else goto <D.6197>;
      <D.6197>:
      *bufnext = 0;
      D.6327 = flags & 64;
      D.6328 = flags & 16384;
      D.6326 = glob0 (dir, &patbuf, pglob, D.6328, D.6327);
      return D.6326;
    }
  finally
    {
      patbuf = {CLOBBER};
    }
}


glob0 (struct GDir * dir, const gchar * pattern, struct wapi_glob_t * pglob, gboolean ignorecase, gboolean unique)
{
  int D.6331;
  int D.6332;
  gchar * bufnext.4;
  gchar * D.6337;
  char D.6338;
  gchar * bufnext.5;
  gchar * bufnext.6;
  char D.6341;
  const gchar * qpatnext.7;
  char D.6343;
  int D.6346;
  int D.6347;
  const gchar * qpatnext;
  int c;
  int err;
  int oldpathc;
  gchar * bufnext;
  gchar patbuf[4096];
  size_t limit;

  try
    {
      limit = 0;
      qpatnext = pattern;
      oldpathc = pglob->gl_pathc;
      bufnext = &patbuf;
      goto <D.6217>;
      <D.6216>:
      switch (c) <default: <D.6215>, case 42: <D.6214>, case 63: <D.6212>>
      <D.6212>:
      D.6331 = pglob->gl_flags;
      D.6332 = D.6331 | 256;
      pglob->gl_flags = D.6332;
      bufnext.4 = bufnext;
      bufnext = bufnext.4 + 1;
      *bufnext.4 = 63;
      goto <D.6213>;
      <D.6214>:
      D.6331 = pglob->gl_flags;
      D.6332 = D.6331 | 256;
      pglob->gl_flags = D.6332;
      if (&patbuf == bufnext) goto <D.6334>; else goto <D.6336>;
      <D.6336>:
      D.6337 = bufnext + 18446744073709551615;
      D.6338 = *D.6337;
      if (D.6338 != 42) goto <D.6334>; else goto <D.6335>;
      <D.6334>:
      bufnext.5 = bufnext;
      bufnext = bufnext.5 + 1;
      *bufnext.5 = 42;
      <D.6335>:
      goto <D.6213>;
      <D.6215>:
      bufnext.6 = bufnext;
      bufnext = bufnext.6 + 1;
      D.6341 = (char) c;
      *bufnext.6 = D.6341;
      goto <D.6213>;
      <D.6213>:
      <D.6217>:
      qpatnext.7 = qpatnext;
      qpatnext = qpatnext.7 + 1;
      D.6343 = *qpatnext.7;
      c = (int) D.6343;
      if (c != 0) goto <D.6216>; else goto <D.6218>;
      <D.6218>:
      *bufnext = 0;
      err = glob1 (dir, &patbuf, &MEM[(void *)&patbuf + 4095B], pglob, &limit, ignorecase, unique);
      if (err != 0) goto <D.6344>; else goto <D.6345>;
      <D.6344>:
      D.6346 = err;
      return D.6346;
      <D.6345>:
      D.6347 = pglob->gl_pathc;
      if (D.6347 == oldpathc) goto <D.6348>; else goto <D.6349>;
      <D.6348>:
      D.6346 = -3;
      return D.6346;
      <D.6349>:
      D.6346 = 0;
      return D.6346;
    }
  finally
    {
      patbuf = {CLOBBER};
      limit = {CLOBBER};
    }
}


glob1 (struct GDir * dir, gchar * pattern, gchar * pattern_last, struct wapi_glob_t * pglob, size_t * limitp, gboolean ignorecase, gboolean unique)
{
  char D.6352;
  int D.6355;

  D.6352 = *pattern;
  if (D.6352 == 0) goto <D.6353>; else goto <D.6354>;
  <D.6353>:
  D.6355 = 0;
  return D.6355;
  <D.6354>:
  D.6355 = glob3 (dir, pattern, pattern_last, pglob, limitp, ignorecase, unique);
  return D.6355;
}


glob3 (struct GDir * dir, gchar * pattern, gchar * pattern_last, struct wapi_glob_t * pglob, size_t * limitp, gboolean ignorecase, gboolean unique)
{
  long unsigned int D.6357;
  gchar * D.6358;
  int D.6359;
  int D.6365;
  int D.6366;
  const gchar * name;

  goto <D.6256>;
  <D.6257>:
  D.6357 = strlen (pattern);
  D.6358 = pattern + D.6357;
  D.6359 = match (name, pattern, D.6358, ignorecase);
  if (D.6359 == 0) goto <D.6360>; else goto <D.6361>;
  <D.6360>:
  // predicted unlikely by continue predictor.
  goto <D.6256>;
  <D.6361>:
  if (unique == 0) goto <D.6362>; else goto <D.6364>;
  <D.6364>:
  D.6365 = contains (pglob, name);
  if (D.6365 == 0) goto <D.6362>; else goto <D.6363>;
  <D.6362>:
  globextend (name, pglob, limitp);
  <D.6363>:
  <D.6256>:
  name = monoeg_g_dir_read_name (dir);
  if (name != 0B) goto <D.6257>; else goto <D.6258>;
  <D.6258>:
  D.6366 = 0;
  return D.6366;
}


match (const gchar * name, gchar * pat, gchar * patend, gboolean ignorecase)
{
  gchar * pat.8;
  int D.6369;
  int D.6370;
  int D.6373;
  int D.6374;
  const gchar * name.9;
  char D.6378;
  const gchar * name.10;
  char D.6380;
  const gchar * name.11;
  char D.6386;
  int D.6387;
  char D.6388;
  char D.6389;
  const gchar * name.12;
  char D.6394;
  char D.6397;
  _Bool D.6398;
  gchar c;

  goto <D.6290>;
  <D.6289>:
  pat.8 = pat;
  pat = pat.8 + 1;
  c = *pat.8;
  D.6369 = (int) c;
  D.6370 = D.6369 & 65535;
  switch (D.6370) <default: <D.6288>, case 42: <D.6283>, case 63: <D.6286>>
  <D.6283>:
  if (pat == patend) goto <D.6371>; else goto <D.6372>;
  <D.6371>:
  D.6373 = 1;
  return D.6373;
  <D.6372>:
  <D.6284>:
  D.6374 = match (name, pat, patend, ignorecase);
  if (D.6374 != 0) goto <D.6375>; else goto <D.6376>;
  <D.6375>:
  D.6373 = 1;
  return D.6373;
  <D.6376>:
  name.9 = name;
  name = name.9 + 1;
  D.6378 = *name.9;
  if (D.6378 != 0) goto <D.6284>; else goto <D.6285>;
  <D.6285>:
  D.6373 = 0;
  return D.6373;
  <D.6286>:
  name.10 = name;
  name = name.10 + 1;
  D.6380 = *name.10;
  if (D.6380 == 0) goto <D.6381>; else goto <D.6382>;
  <D.6381>:
  D.6373 = 0;
  return D.6373;
  <D.6382>:
  goto <D.6287>;
  <D.6288>:
  if (ignorecase != 0) goto <D.6383>; else goto <D.6384>;
  <D.6383>:
  name.11 = name;
  name = name.11 + 1;
  D.6386 = *name.11;
  D.6387 = (int) D.6386;
  D.6388 = monoeg_g_ascii_tolower (D.6387);
  D.6369 = (int) c;
  D.6389 = monoeg_g_ascii_tolower (D.6369);
  if (D.6388 != D.6389) goto <D.6390>; else goto <D.6391>;
  <D.6390>:
  D.6373 = 0;
  return D.6373;
  <D.6391>:
  goto <D.6392>;
  <D.6384>:
  name.12 = name;
  name = name.12 + 1;
  D.6394 = *name.12;
  if (D.6394 != c) goto <D.6395>; else goto <D.6396>;
  <D.6395>:
  D.6373 = 0;
  return D.6373;
  <D.6396>:
  <D.6392>:
  goto <D.6287>;
  <D.6287>:
  <D.6290>:
  if (pat < patend) goto <D.6289>; else goto <D.6291>;
  <D.6291>:
  D.6397 = *name;
  D.6398 = D.6397 == 0;
  D.6373 = (int) D.6398;
  return D.6373;
}


contains (struct wapi_glob_t * pglob, const gchar * name)
{
  char * * D.6400;
  int D.6403;
  long unsigned int D.6404;
  long unsigned int D.6405;
  char * D.6406;
  int D.6242;
  gboolean D.6411;
  int i.13;
  int i;
  char * * pp;

  D.6400 = pglob->gl_pathv;
  if (D.6400 != 0B) goto <D.6401>; else goto <D.6402>;
  <D.6401>:
  D.6400 = pglob->gl_pathv;
  D.6403 = pglob->gl_offs;
  D.6404 = (long unsigned int) D.6403;
  D.6405 = D.6404 * 8;
  pp = D.6400 + D.6405;
  i = pglob->gl_pathc;
  goto <D.6244>;
  <D.6243>:
  D.6406 = *pp;
  if (D.6406 != 0B) goto <D.6407>; else goto <D.6408>;
  <D.6407>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.6406 = *pp;
    D.6242 = __builtin_strcmp (D.6406, name);
  }
  if (D.6242 == 0) goto <D.6409>; else goto <D.6410>;
  <D.6409>:
  D.6411 = 1;
  return D.6411;
  <D.6410>:
  <D.6408>:
  pp = pp + 8;
  <D.6244>:
  i.13 = i;
  i = i.13 + -1;
  if (i.13 != 0) goto <D.6243>; else goto <D.6245>;
  <D.6245>:
  <D.6402>:
  D.6411 = 0;
  return D.6411;
}


globextend (const gchar * path, struct wapi_glob_t * pglob, size_t * limitp)
{
  int D.6414;
  int D.6415;
  int D.6416;
  int D.6417;
  long unsigned int D.6418;
  unsigned int D.6419;
  void * iftmp.14;
  char * * D.6421;
  long unsigned int D.6424;
  int D.6430;
  long unsigned int D.6435;
  long unsigned int D.6436;
  const gchar * p.15;
  char D.6438;
  long int p.16;
  long int path.17;
  long int D.6441;
  long unsigned int D.6442;
  long unsigned int D.6443;
  long unsigned int D.6444;
  int D.6447;
  int D.6450;
  int D.6451;
  int D.6452;
  long unsigned int D.6453;
  long unsigned int D.6454;
  char * * D.6455;
  int D.6456;
  long unsigned int D.6457;
  long unsigned int D.6458;
  char * * D.6459;
  int iftmp.18;
  char * * pathv;
  int i;
  u_int newsize;
  u_int len;
  char * copy;
  const gchar * p;

  D.6414 = pglob->gl_pathc;
  D.6415 = D.6414 + 2;
  D.6416 = pglob->gl_offs;
  D.6417 = D.6415 + D.6416;
  D.6418 = (long unsigned int) D.6417;
  D.6419 = (unsigned int) D.6418;
  newsize = D.6419 * 8;
  D.6421 = pglob->gl_pathv;
  if (D.6421 != 0B) goto <D.6422>; else goto <D.6423>;
  <D.6422>:
  D.6424 = (long unsigned int) newsize;
  D.6421 = pglob->gl_pathv;
  iftmp.14 = realloc (D.6421, D.6424);
  goto <D.6425>;
  <D.6423>:
  D.6424 = (long unsigned int) newsize;
  iftmp.14 = malloc (D.6424);
  <D.6425>:
  pathv = iftmp.14;
  if (pathv == 0B) goto <D.6426>; else goto <D.6427>;
  <D.6426>:
  D.6421 = pglob->gl_pathv;
  if (D.6421 != 0B) goto <D.6428>; else goto <D.6429>;
  <D.6428>:
  D.6421 = pglob->gl_pathv;
  free (D.6421);
  pglob->gl_pathv = 0B;
  <D.6429>:
  D.6430 = -1;
  return D.6430;
  <D.6427>:
  D.6421 = pglob->gl_pathv;
  if (D.6421 == 0B) goto <D.6431>; else goto <D.6432>;
  <D.6431>:
  D.6416 = pglob->gl_offs;
  if (D.6416 > 0) goto <D.6433>; else goto <D.6434>;
  <D.6433>:
  D.6416 = pglob->gl_offs;
  D.6435 = (long unsigned int) D.6416;
  D.6436 = D.6435 * 8;
  pathv = pathv + D.6436;
  i = pglob->gl_offs;
  goto <D.6271>;
  <D.6270>:
  pathv = pathv + 18446744073709551608;
  *pathv = 0B;
  <D.6271>:
  i = i + -1;
  if (i >= 0) goto <D.6270>; else goto <D.6272>;
  <D.6272>:
  <D.6434>:
  <D.6432>:
  pglob->gl_pathv = pathv;
  p = path;
  goto <D.6274>;
  <D.6273>:
  <D.6274>:
  p.15 = p;
  p = p.15 + 1;
  D.6438 = *p.15;
  if (D.6438 != 0) goto <D.6273>; else goto <D.6275>;
  <D.6275>:
  p.16 = (long int) p;
  path.17 = (long int) path;
  D.6441 = p.16 - path.17;
  len = (u_int) D.6441;
  D.6442 = *limitp;
  D.6443 = (long unsigned int) len;
  D.6444 = D.6442 + D.6443;
  *limitp = D.6444;
  D.6443 = (long unsigned int) len;
  copy = malloc (D.6443);
  if (copy != 0B) goto <D.6445>; else goto <D.6446>;
  <D.6445>:
  D.6447 = g_Ctoc (path, copy, len);
  if (D.6447 != 0) goto <D.6448>; else goto <D.6449>;
  <D.6448>:
  free (copy);
  D.6430 = -1;
  return D.6430;
  <D.6449>:
  D.6416 = pglob->gl_offs;
  D.6414 = pglob->gl_pathc;
  D.6450 = D.6414;
  D.6451 = D.6450 + 1;
  pglob->gl_pathc = D.6451;
  D.6452 = D.6416 + D.6450;
  D.6453 = (long unsigned int) D.6452;
  D.6454 = D.6453 * 8;
  D.6455 = pathv + D.6454;
  *D.6455 = copy;
  <D.6446>:
  D.6416 = pglob->gl_offs;
  D.6414 = pglob->gl_pathc;
  D.6456 = D.6416 + D.6414;
  D.6457 = (long unsigned int) D.6456;
  D.6458 = D.6457 * 8;
  D.6459 = pathv + D.6458;
  *D.6459 = 0B;
  if (copy == 0B) goto <D.6461>; else goto <D.6462>;
  <D.6461>:
  iftmp.18 = -1;
  goto <D.6463>;
  <D.6462>:
  iftmp.18 = 0;
  <D.6463>:
  D.6430 = iftmp.18;
  return D.6430;
}


g_Ctoc (const gchar * str, char * buf, u_int len)
{
  char * buf.19;
  const gchar * str.20;
  char D.6467;
  char D.6468;
  int D.6471;
  unsigned int len.21;

  goto <D.6306>;
  <D.6305>:
  buf.19 = buf;
  buf = buf.19 + 1;
  str.20 = str;
  str = str.20 + 1;
  D.6467 = *str.20;
  *buf.19 = D.6467;
  D.6468 = *buf.19;
  if (D.6468 == 0) goto <D.6469>; else goto <D.6470>;
  <D.6469>:
  D.6471 = 0;
  return D.6471;
  <D.6470>:
  <D.6306>:
  len.21 = len;
  len = len.21 + 4294967295;
  if (len.21 != 0) goto <D.6305>; else goto <D.6307>;
  <D.6307>:
  D.6471 = 1;
  return D.6471;
}


_wapi_globfree (struct wapi_glob_t * pglob)
{
  char * * D.6474;
  int D.6477;
  long unsigned int D.6478;
  long unsigned int D.6479;
  char * D.6480;
  int i.22;
  int i;
  char * * pp;

  D.6474 = pglob->gl_pathv;
  if (D.6474 != 0B) goto <D.6475>; else goto <D.6476>;
  <D.6475>:
  D.6474 = pglob->gl_pathv;
  D.6477 = pglob->gl_offs;
  D.6478 = (long unsigned int) D.6477;
  D.6479 = D.6478 * 8;
  pp = D.6474 + D.6479;
  i = pglob->gl_pathc;
  goto <D.6298>;
  <D.6297>:
  D.6480 = *pp;
  if (D.6480 != 0B) goto <D.6481>; else goto <D.6482>;
  <D.6481>:
  D.6480 = *pp;
  free (D.6480);
  <D.6482>:
  pp = pp + 8;
  <D.6298>:
  i.22 = i;
  i = i.22 + -1;
  if (i.22 != 0) goto <D.6297>; else goto <D.6299>;
  <D.6299>:
  D.6474 = pglob->gl_pathv;
  free (D.6474);
  pglob->gl_pathv = 0B;
  <D.6476>:
}


