monoeg_g_file_get_contents (const gchar * filename, gchar * * contents, gsize * length, struct GError * * error)
{
  gboolean D.6356;
  struct GError * D.6361;
  int * D.6370;
  <unnamed type> D.6371;
  int D.6372;
  struct GError * D.6373;
  int D.6374;
  <unnamed type> D.6379;
  int D.6380;
  struct GError * D.6381;
  long int D.6382;
  long int D.6383;
  long unsigned int D.6384;
  sizetype offset.0;
  gchar * D.6386;
  long int D.6387;
  long unsigned int D.6388;
  long int D.6389;
  long int D.6392;
  int D.6396;
  sizetype D.6397;
  gchar * D.6398;
  long unsigned int D.6401;
  gchar * str;
  int fd;
  struct stat st;
  long int offset;
  int nread;

  try
    {
      if (filename == 0B) goto <D.6354>; else goto <D.6355>;
      <D.6354>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 61, "filename != NULL");
      D.6356 = 0;
      return D.6356;
      <D.6355>:
      if (contents == 0B) goto <D.6357>; else goto <D.6358>;
      <D.6357>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 62, "contents != NULL");
      D.6356 = 0;
      return D.6356;
      <D.6358>:
      if (error != 0B) goto <D.6359>; else goto <D.6360>;
      <D.6359>:
      D.6361 = *error;
      if (D.6361 != 0B) goto <D.6362>; else goto <D.6363>;
      <D.6362>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 63, "error == NULL || *error == NULL");
      D.6356 = 0;
      return D.6356;
      <D.6363>:
      <D.6360>:
      *contents = 0B;
      if (length != 0B) goto <D.6364>; else goto <D.6365>;
      <D.6364>:
      *length = 0;
      <D.6365>:
      fd = open (filename, 0);
      if (fd == -1) goto <D.6366>; else goto <D.6367>;
      <D.6366>:
      if (error != 0B) goto <D.6368>; else goto <D.6369>;
      <D.6368>:
      {
        int err;

        D.6370 = __errno_location ();
        err = *D.6370;
        D.6371 = monoeg_g_file_error_from_errno (err);
        D.6372 = (int) D.6371;
        D.6373 = monoeg_g_error_new (0B, D.6372, "Error opening file");
        *error = D.6373;
      }
      <D.6369>:
      D.6356 = 0;
      return D.6356;
      <D.6367>:
      D.6374 = fstat (fd, &st);
      if (D.6374 != 0) goto <D.6375>; else goto <D.6376>;
      <D.6375>:
      if (error != 0B) goto <D.6377>; else goto <D.6378>;
      <D.6377>:
      {
        int err;

        D.6370 = __errno_location ();
        err = *D.6370;
        D.6379 = monoeg_g_file_error_from_errno (err);
        D.6380 = (int) D.6379;
        D.6381 = monoeg_g_error_new (0B, D.6380, "Error in fstat()");
        *error = D.6381;
      }
      <D.6378>:
      close (fd);
      D.6356 = 0;
      return D.6356;
      <D.6376>:
      D.6382 = st.st_size;
      D.6383 = D.6382 + 1;
      D.6384 = (long unsigned int) D.6383;
      str = monoeg_malloc (D.6384);
      offset = 0;
      <D.6323>:
      offset.0 = (sizetype) offset;
      D.6386 = str + offset.0;
      D.6382 = st.st_size;
      D.6387 = D.6382 - offset;
      D.6388 = (long unsigned int) D.6387;
      D.6389 = read (fd, D.6386, D.6388);
      nread = (int) D.6389;
      if (nread > 0) goto <D.6390>; else goto <D.6391>;
      <D.6390>:
      D.6392 = (long int) nread;
      offset = D.6392 + offset;
      <D.6391>:
      if (nread > 0) goto <D.6394>; else goto <D.6393>;
      <D.6394>:
      D.6382 = st.st_size;
      if (D.6382 > offset) goto <D.6323>; else goto <D.6393>;
      <D.6393>:
      if (nread == -1) goto <D.6395>; else goto <D.6324>;
      <D.6395>:
      D.6370 = __errno_location ();
      D.6396 = *D.6370;
      if (D.6396 == 4) goto <D.6323>; else goto <D.6324>;
      <D.6324>:
      close (fd);
      D.6382 = st.st_size;
      D.6397 = (sizetype) D.6382;
      D.6398 = str + D.6397;
      *D.6398 = 0;
      if (length != 0B) goto <D.6399>; else goto <D.6400>;
      <D.6399>:
      D.6382 = st.st_size;
      D.6401 = (long unsigned int) D.6382;
      *length = D.6401;
      <D.6400>:
      *contents = str;
      D.6356 = 1;
      return D.6356;
    }
  finally
    {
      st = {CLOBBER};
    }
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
open (const char * __path, int __oflag)
{
  int D.6404;
  int D.6407;
  int D.6412;
  int D.6414;
  int D.6415;
  int D.6418;
  int D.6419;

  D.6404 = __builtin_va_arg_pack_len ();
  if (D.6404 > 1) goto <D.6405>; else goto <D.6406>;
  <D.6405>:
  __open_too_many_args ();
  <D.6406>:
  D.6407 = __builtin_constant_p (__oflag);
  if (D.6407 != 0) goto <D.6408>; else goto <D.6409>;
  <D.6408>:
  D.6412 = __oflag & 64;
  if (D.6412 != 0) goto <D.6410>; else goto <D.6413>;
  <D.6413>:
  D.6414 = __oflag & 4259840;
  if (D.6414 == 4259840) goto <D.6410>; else goto <D.6411>;
  <D.6410>:
  D.6415 = __builtin_va_arg_pack_len ();
  if (D.6415 <= 0) goto <D.6416>; else goto <D.6417>;
  <D.6416>:
  __open_missing_mode ();
  D.6418 = __open_2 (__path, __oflag);
  return D.6418;
  <D.6417>:
  <D.6411>:
  D.6418 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.6418;
  <D.6409>:
  D.6419 = __builtin_va_arg_pack_len ();
  if (D.6419 <= 0) goto <D.6420>; else goto <D.6421>;
  <D.6420>:
  D.6418 = __open_2 (__path, __oflag);
  return D.6418;
  <D.6421>:
  D.6418 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.6418;
}


__attribute__((__gnu_inline__, __leaf__, __nothrow__))
fstat (int __fd, struct stat * __statbuf)
{
  int D.6423;

  D.6423 = __fxstat (1, __fd, __statbuf);
  return D.6423;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
read (int __fd, void * __buf, size_t __nbytes)
{
  long unsigned int D.6425;
  int D.6428;
  ssize_t D.6431;
  long unsigned int D.6432;
  long unsigned int D.6433;
  long unsigned int D.6436;

  D.6425 = __builtin_object_size (__buf, 0);
  if (D.6425 != 18446744073709551615) goto <D.6426>; else goto <D.6427>;
  <D.6426>:
  D.6428 = __builtin_constant_p (__nbytes);
  if (D.6428 == 0) goto <D.6429>; else goto <D.6430>;
  <D.6429>:
  D.6432 = __builtin_object_size (__buf, 0);
  D.6431 = __read_chk (__fd, __buf, __nbytes, D.6432);
  return D.6431;
  <D.6430>:
  D.6433 = __builtin_object_size (__buf, 0);
  if (D.6433 < __nbytes) goto <D.6434>; else goto <D.6435>;
  <D.6434>:
  D.6436 = __builtin_object_size (__buf, 0);
  D.6431 = __read_chk_warn (__fd, __buf, __nbytes, D.6436);
  return D.6431;
  <D.6435>:
  <D.6427>:
  D.6431 = __read_alias (__fd, __buf, __nbytes);
  return D.6431;
}


monoeg_g_file_open_tmp (const gchar * tmpl, gchar * * name_used, struct GError * * error)
{
  struct GError * D.6440;
  gint D.6443;
  char * D.6446;
  struct GError * D.6451;
  int D.6342;
  int iftmp.1;
  int D.6341;
  sizetype D.6458;
  char[7] * D.6459;
  unsigned char D.6460;
  int D.6461;
  unsigned char D.6462;
  int D.6463;
  const unsigned char * D.6468;
  unsigned char D.6469;
  int D.6470;
  const unsigned char * D.6471;
  unsigned char D.6472;
  int D.6473;
  const unsigned char * D.6478;
  unsigned char D.6479;
  int D.6480;
  const unsigned char * D.6481;
  unsigned char D.6482;
  int D.6483;
  const unsigned char * D.6488;
  unsigned char D.6489;
  int D.6490;
  const unsigned char * D.6491;
  unsigned char D.6492;
  int D.6493;
  const gchar * D.6495;
  struct GError * D.6498;
  const gchar * D.6499;
  int * D.6504;
  <unnamed type> D.6505;
  int D.6506;
  struct GError * D.6507;
  static const gchar * default_tmpl = (const gchar *) ".XXXXXX";
  gchar * t;
  gint fd;
  size_t len;

  if (error != 0B) goto <D.6438>; else goto <D.6439>;
  <D.6438>:
  D.6440 = *error;
  if (D.6440 != 0B) goto <D.6441>; else goto <D.6442>;
  <D.6441>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 113, "error == NULL || *error == NULL");
  D.6443 = -1;
  return D.6443;
  <D.6442>:
  <D.6439>:
  if (tmpl == 0B) goto <D.6444>; else goto <D.6445>;
  <D.6444>:
  tmpl = default_tmpl;
  <D.6445>:
  D.6446 = __builtin_strchr (tmpl, 47);
  if (D.6446 != 0B) goto <D.6447>; else goto <D.6448>;
  <D.6447>:
  if (error != 0B) goto <D.6449>; else goto <D.6450>;
  <D.6449>:
  D.6451 = monoeg_g_error_new (0B, 24, "Template should not have any /");
  *error = D.6451;
  <D.6450>:
  D.6443 = -1;
  return D.6443;
  <D.6448>:
  len = strlen (tmpl);
  if (len <= 5) goto <D.6452>; else goto <D.6454>;
  <D.6454>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 6;
    if (__s2_len <= 3) goto <D.6456>; else goto <D.6457>;
    <D.6456>:
    {
      const unsigned char * __s2;
      int __result;

      D.6458 = len + 18446744073709551610;
      __s2 = tmpl + D.6458;
      D.6459 = "XXXXXX";
      D.6460 = MEM[(const unsigned char *)D.6459];
      D.6461 = (int) D.6460;
      D.6462 = *__s2;
      D.6463 = (int) D.6462;
      __result = D.6461 - D.6463;
      {
        if (__s2_len != 0) goto <D.6464>; else goto <D.6465>;
        <D.6464>:
        if (__result == 0) goto <D.6466>; else goto <D.6467>;
        <D.6466>:
        D.6468 = "XXXXXX" + 1;
        D.6469 = *D.6468;
        D.6470 = (int) D.6469;
        D.6471 = __s2 + 1;
        D.6472 = *D.6471;
        D.6473 = (int) D.6472;
        __result = D.6470 - D.6473;
        if (__s2_len > 1) goto <D.6474>; else goto <D.6475>;
        <D.6474>:
        if (__result == 0) goto <D.6476>; else goto <D.6477>;
        <D.6476>:
        D.6478 = "XXXXXX" + 2;
        D.6479 = *D.6478;
        D.6480 = (int) D.6479;
        D.6481 = __s2 + 2;
        D.6482 = *D.6481;
        D.6483 = (int) D.6482;
        __result = D.6480 - D.6483;
        if (__s2_len > 2) goto <D.6484>; else goto <D.6485>;
        <D.6484>:
        if (__result == 0) goto <D.6486>; else goto <D.6487>;
        <D.6486>:
        D.6488 = "XXXXXX" + 3;
        D.6489 = *D.6488;
        D.6490 = (int) D.6489;
        D.6491 = __s2 + 3;
        D.6492 = *D.6491;
        D.6493 = (int) D.6492;
        __result = D.6490 - D.6493;
        <D.6487>:
        <D.6485>:
        <D.6477>:
        <D.6475>:
        <D.6467>:
        <D.6465>:
      }
      D.6341 = __result;
    }
    iftmp.1 = -D.6341;
    goto <D.6494>;
    <D.6457>:
    D.6458 = len + 18446744073709551610;
    D.6495 = tmpl + D.6458;
    iftmp.1 = __builtin_strcmp (D.6495, "XXXXXX");
    <D.6494>:
    D.6342 = iftmp.1;
  }
  if (D.6342 != 0) goto <D.6452>; else goto <D.6453>;
  <D.6452>:
  if (error != 0B) goto <D.6496>; else goto <D.6497>;
  <D.6496>:
  D.6498 = monoeg_g_error_new (0B, 24, "Template should end with XXXXXX");
  *error = D.6498;
  <D.6497>:
  D.6443 = -1;
  return D.6443;
  <D.6453>:
  D.6499 = monoeg_g_get_tmp_dir ();
  t = monoeg_g_build_path ("/", D.6499, tmpl, 0B);
  fd = mkstemp (t);
  if (fd == -1) goto <D.6500>; else goto <D.6501>;
  <D.6500>:
  if (error != 0B) goto <D.6502>; else goto <D.6503>;
  <D.6502>:
  {
    int err;

    D.6504 = __errno_location ();
    err = *D.6504;
    D.6505 = monoeg_g_file_error_from_errno (err);
    D.6506 = (int) D.6505;
    D.6507 = monoeg_g_error_new (0B, D.6506, "Error in mkstemp()");
    *error = D.6507;
  }
  <D.6503>:
  monoeg_g_free (t);
  D.6443 = -1;
  return D.6443;
  <D.6501>:
  if (name_used != 0B) goto <D.6508>; else goto <D.6509>;
  <D.6508>:
  *name_used = t;
  goto <D.6510>;
  <D.6509>:
  monoeg_g_free (t);
  <D.6510>:
  D.6443 = fd;
  return D.6443;
}


monoeg_g_get_current_dir ()
{
  long unsigned int D.6512;
  long unsigned int D.6513;
  int iftmp.2;
  int * D.6518;
  int D.6519;
  gchar * D.6523;
  int s;
  char * buffer;
  char * r;
  gboolean fail;

  s = 32;
  buffer = 0B;
  <D.6351>:
  D.6512 = (long unsigned int) s;
  buffer = monoeg_realloc (buffer, D.6512);
  D.6513 = (long unsigned int) s;
  r = getcwd (buffer, D.6513);
  if (r == 0B) goto <D.6517>; else goto <D.6515>;
  <D.6517>:
  D.6518 = __errno_location ();
  D.6519 = *D.6518;
  if (D.6519 == 34) goto <D.6520>; else goto <D.6515>;
  <D.6520>:
  iftmp.2 = 1;
  goto <D.6516>;
  <D.6515>:
  iftmp.2 = 0;
  <D.6516>:
  fail = iftmp.2;
  if (fail != 0) goto <D.6521>; else goto <D.6522>;
  <D.6521>:
  s = s << 1;
  <D.6522>:
  if (fail != 0) goto <D.6351>; else goto <D.6352>;
  <D.6352>:
  D.6523 = buffer;
  return D.6523;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
getcwd (char * __buf, size_t __size)
{
  long unsigned int D.6525;
  int D.6528;
  char * D.6531;
  long unsigned int D.6532;
  long unsigned int D.6533;
  long unsigned int D.6536;

  D.6525 = __builtin_object_size (__buf, 1);
  if (D.6525 != 18446744073709551615) goto <D.6526>; else goto <D.6527>;
  <D.6526>:
  D.6528 = __builtin_constant_p (__size);
  if (D.6528 == 0) goto <D.6529>; else goto <D.6530>;
  <D.6529>:
  D.6532 = __builtin_object_size (__buf, 1);
  D.6531 = __getcwd_chk (__buf, __size, D.6532);
  return D.6531;
  <D.6530>:
  D.6533 = __builtin_object_size (__buf, 1);
  if (D.6533 < __size) goto <D.6534>; else goto <D.6535>;
  <D.6534>:
  D.6536 = __builtin_object_size (__buf, 1);
  D.6531 = __getcwd_chk_warn (__buf, __size, D.6536);
  return D.6531;
  <D.6535>:
  <D.6527>:
  D.6531 = __getcwd_alias (__buf, __size);
  return D.6531;
}


