monoeg_g_file_get_contents (const gchar * filename, gchar * * contents, gsize * length, struct GError * * error)
{
  gboolean D.5927;
  struct GError * D.5932;
  int * D.5941;
  <unnamed type> D.5942;
  int D.5943;
  struct GError * D.5944;
  int D.5945;
  <unnamed type> D.5950;
  int D.5951;
  struct GError * D.5952;
  long int D.5953;
  long int D.5954;
  unsigned int D.5955;
  sizetype offset.0;
  void * D.5957;
  long int D.5958;
  unsigned int D.5959;
  int D.5965;
  sizetype D.5966;
  gchar * D.5967;
  unsigned int D.5970;
  gchar * str;
  int fd;
  struct stat st;
  long int offset;
  int nread;

  try
    {
      if (filename == 0B) goto <D.5925>; else goto <D.5926>;
      <D.5925>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 61, "filename != NULL");
      D.5927 = 0;
      return D.5927;
      <D.5926>:
      if (contents == 0B) goto <D.5928>; else goto <D.5929>;
      <D.5928>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 62, "contents != NULL");
      D.5927 = 0;
      return D.5927;
      <D.5929>:
      if (error != 0B) goto <D.5930>; else goto <D.5931>;
      <D.5930>:
      D.5932 = *error;
      if (D.5932 != 0B) goto <D.5933>; else goto <D.5934>;
      <D.5933>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 63, "error == NULL || *error == NULL");
      D.5927 = 0;
      return D.5927;
      <D.5934>:
      <D.5931>:
      *contents = 0B;
      if (length != 0B) goto <D.5935>; else goto <D.5936>;
      <D.5935>:
      *length = 0;
      <D.5936>:
      fd = open (filename, 8192);
      if (fd == -1) goto <D.5937>; else goto <D.5938>;
      <D.5937>:
      if (error != 0B) goto <D.5939>; else goto <D.5940>;
      <D.5939>:
      {
        int err;

        D.5941 = __errno_location ();
        err = *D.5941;
        D.5942 = monoeg_g_file_error_from_errno (err);
        D.5943 = (int) D.5942;
        D.5944 = monoeg_g_error_new (0B, D.5943, "Error opening file");
        *error = D.5944;
      }
      <D.5940>:
      D.5927 = 0;
      return D.5927;
      <D.5938>:
      D.5945 = fstat (fd, &st);
      if (D.5945 != 0) goto <D.5946>; else goto <D.5947>;
      <D.5946>:
      if (error != 0B) goto <D.5948>; else goto <D.5949>;
      <D.5948>:
      {
        int err;

        D.5941 = __errno_location ();
        err = *D.5941;
        D.5950 = monoeg_g_file_error_from_errno (err);
        D.5951 = (int) D.5950;
        D.5952 = monoeg_g_error_new (0B, D.5951, "Error in fstat()");
        *error = D.5952;
      }
      <D.5949>:
      close (fd);
      D.5927 = 0;
      return D.5927;
      <D.5947>:
      D.5953 = st.st_size;
      D.5954 = D.5953 + 1;
      D.5955 = (unsigned int) D.5954;
      str = monoeg_malloc (D.5955);
      offset = 0;
      <D.5894>:
      offset.0 = (sizetype) offset;
      D.5957 = str + offset.0;
      D.5953 = st.st_size;
      D.5958 = D.5953 - offset;
      D.5959 = (unsigned int) D.5958;
      nread = read (fd, D.5957, D.5959);
      if (nread > 0) goto <D.5960>; else goto <D.5961>;
      <D.5960>:
      offset = offset + nread;
      <D.5961>:
      if (nread > 0) goto <D.5963>; else goto <D.5962>;
      <D.5963>:
      D.5953 = st.st_size;
      if (D.5953 > offset) goto <D.5894>; else goto <D.5962>;
      <D.5962>:
      if (nread == -1) goto <D.5964>; else goto <D.5895>;
      <D.5964>:
      D.5941 = __errno_location ();
      D.5965 = *D.5941;
      if (D.5965 == 4) goto <D.5894>; else goto <D.5895>;
      <D.5895>:
      close (fd);
      D.5953 = st.st_size;
      D.5966 = (sizetype) D.5953;
      D.5967 = str + D.5966;
      *D.5967 = 0;
      if (length != 0B) goto <D.5968>; else goto <D.5969>;
      <D.5968>:
      D.5953 = st.st_size;
      D.5970 = (unsigned int) D.5953;
      *length = D.5970;
      <D.5969>:
      *contents = str;
      D.5927 = 1;
      return D.5927;
    }
  finally
    {
      st = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.5973;
  int D.5976;
  int D.5981;
  int D.5983;
  int D.5984;
  int D.5987;
  int D.5988;

  D.5973 = __builtin_va_arg_pack_len ();
  if (D.5973 > 1) goto <D.5974>; else goto <D.5975>;
  <D.5974>:
  __open_too_many_args ();
  <D.5975>:
  D.5976 = __builtin_constant_p (__oflag);
  if (D.5976 != 0) goto <D.5977>; else goto <D.5978>;
  <D.5977>:
  D.5981 = __oflag & 256;
  if (D.5981 != 0) goto <D.5979>; else goto <D.5982>;
  <D.5982>:
  D.5983 = __oflag & 4259840;
  if (D.5983 == 4259840) goto <D.5979>; else goto <D.5980>;
  <D.5979>:
  D.5984 = __builtin_va_arg_pack_len ();
  if (D.5984 <= 0) goto <D.5985>; else goto <D.5986>;
  <D.5985>:
  __open_missing_mode ();
  D.5987 = __open_2 (__path, __oflag);
  return D.5987;
  <D.5986>:
  <D.5980>:
  D.5987 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.5987;
  <D.5978>:
  D.5988 = __builtin_va_arg_pack_len ();
  if (D.5988 <= 0) goto <D.5989>; else goto <D.5990>;
  <D.5989>:
  D.5987 = __open_2 (__path, __oflag);
  return D.5987;
  <D.5990>:
  D.5987 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.5987;
}


fstat (int __fd, struct stat * __statbuf)
{
  int D.5992;

  D.5992 = __fxstat (3, __fd, __statbuf);
  return D.5992;
}


read (int __fd, void * __buf, size_t __nbytes)
{
  unsigned int D.5994;
  int D.5997;
  ssize_t D.6000;
  unsigned int D.6001;
  unsigned int D.6002;
  unsigned int D.6005;

  D.5994 = __builtin_object_size (__buf, 0);
  if (D.5994 != 4294967295) goto <D.5995>; else goto <D.5996>;
  <D.5995>:
  D.5997 = __builtin_constant_p (__nbytes);
  if (D.5997 == 0) goto <D.5998>; else goto <D.5999>;
  <D.5998>:
  D.6001 = __builtin_object_size (__buf, 0);
  D.6000 = __read_chk (__fd, __buf, __nbytes, D.6001);
  return D.6000;
  <D.5999>:
  D.6002 = __builtin_object_size (__buf, 0);
  if (D.6002 < __nbytes) goto <D.6003>; else goto <D.6004>;
  <D.6003>:
  D.6005 = __builtin_object_size (__buf, 0);
  D.6000 = __read_chk_warn (__fd, __buf, __nbytes, D.6005);
  return D.6000;
  <D.6004>:
  <D.5996>:
  D.6000 = __read_alias (__fd, __buf, __nbytes);
  return D.6000;
}


monoeg_g_file_open_tmp (const gchar * tmpl, gchar * * name_used, struct GError * * error)
{
  struct GError * D.6009;
  gint D.6012;
  char * D.6015;
  struct GError * D.6020;
  int D.5913;
  int iftmp.1;
  int D.5912;
  sizetype D.6027;
  char[7] * D.6028;
  unsigned char D.6029;
  int D.6030;
  unsigned char D.6031;
  int D.6032;
  const unsigned char * D.6037;
  unsigned char D.6038;
  int D.6039;
  const unsigned char * D.6040;
  unsigned char D.6041;
  int D.6042;
  const unsigned char * D.6047;
  unsigned char D.6048;
  int D.6049;
  const unsigned char * D.6050;
  unsigned char D.6051;
  int D.6052;
  const unsigned char * D.6057;
  unsigned char D.6058;
  int D.6059;
  const unsigned char * D.6060;
  unsigned char D.6061;
  int D.6062;
  const gchar * D.6064;
  struct GError * D.6067;
  const gchar * D.6068;
  int * D.6073;
  <unnamed type> D.6074;
  int D.6075;
  struct GError * D.6076;
  static const gchar * default_tmpl = (const gchar *) ".XXXXXX";
  gchar * t;
  gint fd;
  size_t len;

  if (error != 0B) goto <D.6007>; else goto <D.6008>;
  <D.6007>:
  D.6009 = *error;
  if (D.6009 != 0B) goto <D.6010>; else goto <D.6011>;
  <D.6010>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 113, "error == NULL || *error == NULL");
  D.6012 = -1;
  return D.6012;
  <D.6011>:
  <D.6008>:
  if (tmpl == 0B) goto <D.6013>; else goto <D.6014>;
  <D.6013>:
  tmpl = default_tmpl;
  <D.6014>:
  D.6015 = __builtin_strchr (tmpl, 47);
  if (D.6015 != 0B) goto <D.6016>; else goto <D.6017>;
  <D.6016>:
  if (error != 0B) goto <D.6018>; else goto <D.6019>;
  <D.6018>:
  D.6020 = monoeg_g_error_new (0B, 24, "Template should not have any /");
  *error = D.6020;
  <D.6019>:
  D.6012 = -1;
  return D.6012;
  <D.6017>:
  len = strlen (tmpl);
  if (len <= 5) goto <D.6021>; else goto <D.6023>;
  <D.6023>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      D.6027 = len + 4294967290;
      __s2 = tmpl + D.6027;
      D.6028 = "XXXXXX";
      D.6029 = MEM[(const unsigned char *)D.6028];
      D.6030 = (int) D.6029;
      D.6031 = *__s2;
      D.6032 = (int) D.6031;
      __result = D.6030 - D.6032;
      {
        if (__s2_len != 0) goto <D.6033>; else goto <D.6034>;
        <D.6033>:
        if (__result == 0) goto <D.6035>; else goto <D.6036>;
        <D.6035>:
        D.6037 = &MEM[(void *)"XXXXXX" + 1B];
        D.6038 = *D.6037;
        D.6039 = (int) D.6038;
        D.6040 = __s2 + 1;
        D.6041 = *D.6040;
        D.6042 = (int) D.6041;
        __result = D.6039 - D.6042;
        if (__s2_len > 1) goto <D.6043>; else goto <D.6044>;
        <D.6043>:
        if (__result == 0) goto <D.6045>; else goto <D.6046>;
        <D.6045>:
        D.6047 = &MEM[(void *)"XXXXXX" + 2B];
        D.6048 = *D.6047;
        D.6049 = (int) D.6048;
        D.6050 = __s2 + 2;
        D.6051 = *D.6050;
        D.6052 = (int) D.6051;
        __result = D.6049 - D.6052;
        if (__s2_len > 2) goto <D.6053>; else goto <D.6054>;
        <D.6053>:
        if (__result == 0) goto <D.6055>; else goto <D.6056>;
        <D.6055>:
        D.6057 = &MEM[(void *)"XXXXXX" + 3B];
        D.6058 = *D.6057;
        D.6059 = (int) D.6058;
        D.6060 = __s2 + 3;
        D.6061 = *D.6060;
        D.6062 = (int) D.6061;
        __result = D.6059 - D.6062;
        <D.6056>:
        <D.6054>:
        <D.6046>:
        <D.6044>:
        <D.6036>:
        <D.6034>:
      }
      D.5912 = __result;
    }
    iftmp.1 = -D.5912;
    goto <D.6063>;
    <D.6026>:
    D.6027 = len + 4294967290;
    D.6064 = tmpl + D.6027;
    iftmp.1 = __builtin_strcmp (D.6064, "XXXXXX");
    <D.6063>:
    D.5913 = iftmp.1;
  }
  if (D.5913 != 0) goto <D.6021>; else goto <D.6022>;
  <D.6021>:
  if (error != 0B) goto <D.6065>; else goto <D.6066>;
  <D.6065>:
  D.6067 = monoeg_g_error_new (0B, 24, "Template should end with XXXXXX");
  *error = D.6067;
  <D.6066>:
  D.6012 = -1;
  return D.6012;
  <D.6022>:
  D.6068 = monoeg_g_get_tmp_dir ();
  t = monoeg_g_build_path ("/", D.6068, tmpl, 0B);
  fd = mkstemp (t);
  if (fd == -1) goto <D.6069>; else goto <D.6070>;
  <D.6069>:
  if (error != 0B) goto <D.6071>; else goto <D.6072>;
  <D.6071>:
  {
    int err;

    D.6073 = __errno_location ();
    err = *D.6073;
    D.6074 = monoeg_g_file_error_from_errno (err);
    D.6075 = (int) D.6074;
    D.6076 = monoeg_g_error_new (0B, D.6075, "Error in mkstemp()");
    *error = D.6076;
  }
  <D.6072>:
  monoeg_g_free (t);
  D.6012 = -1;
  return D.6012;
  <D.6070>:
  if (name_used != 0B) goto <D.6077>; else goto <D.6078>;
  <D.6077>:
  *name_used = t;
  goto <D.6079>;
  <D.6078>:
  monoeg_g_free (t);
  <D.6079>:
  D.6012 = fd;
  return D.6012;
}


monoeg_g_get_current_dir ()
{
  unsigned int s.2;
  unsigned int s.3;
  int iftmp.4;
  int * D.6087;
  int D.6088;
  gchar * D.6092;
  int s;
  char * buffer;
  char * r;
  gboolean fail;

  s = 32;
  buffer = 0B;
  <D.5922>:
  s.2 = (unsigned int) s;
  buffer = monoeg_realloc (buffer, s.2);
  s.3 = (unsigned int) s;
  r = getcwd (buffer, s.3);
  if (r == 0B) goto <D.6086>; else goto <D.6084>;
  <D.6086>:
  D.6087 = __errno_location ();
  D.6088 = *D.6087;
  if (D.6088 == 34) goto <D.6089>; else goto <D.6084>;
  <D.6089>:
  iftmp.4 = 1;
  goto <D.6085>;
  <D.6084>:
  iftmp.4 = 0;
  <D.6085>:
  fail = iftmp.4;
  if (fail != 0) goto <D.6090>; else goto <D.6091>;
  <D.6090>:
  s = s << 1;
  <D.6091>:
  if (fail != 0) goto <D.5922>; else goto <D.5923>;
  <D.5923>:
  D.6092 = buffer;
  return D.6092;
}


getcwd (char * __buf, size_t __size)
{
  unsigned int D.6094;
  int D.6097;
  char * D.6100;
  unsigned int D.6101;
  unsigned int D.6102;
  unsigned int D.6105;

  D.6094 = __builtin_object_size (__buf, 1);
  if (D.6094 != 4294967295) goto <D.6095>; else goto <D.6096>;
  <D.6095>:
  D.6097 = __builtin_constant_p (__size);
  if (D.6097 == 0) goto <D.6098>; else goto <D.6099>;
  <D.6098>:
  D.6101 = __builtin_object_size (__buf, 1);
  D.6100 = __getcwd_chk (__buf, __size, D.6101);
  return D.6100;
  <D.6099>:
  D.6102 = __builtin_object_size (__buf, 1);
  if (D.6102 < __size) goto <D.6103>; else goto <D.6104>;
  <D.6103>:
  D.6105 = __builtin_object_size (__buf, 1);
  D.6100 = __getcwd_chk_warn (__buf, __size, D.6105);
  return D.6100;
  <D.6104>:
  <D.6096>:
  D.6100 = __getcwd_alias (__buf, __size);
  return D.6100;
}


