monoeg_g_file_get_contents (const gchar * filename, gchar * * contents, gsize * length, struct GError * * error)
{
  gboolean D.5903;
  struct GError * D.5908;
  int * D.5917;
  <unnamed type> D.5918;
  int D.5919;
  struct GError * D.5920;
  int D.5921;
  <unnamed type> D.5926;
  int D.5927;
  struct GError * D.5928;
  long int D.5929;
  long int D.5930;
  unsigned int D.5931;
  long int D.5932;
  unsigned int D.5933;
  sizetype offset.0;
  void * D.5935;
  int D.5941;
  sizetype D.5942;
  gchar * D.5943;
  unsigned int D.5946;
  gchar * str;
  int fd;
  struct stat st;
  long int offset;
  int nread;

  try
    {
      if (filename == 0B) goto <D.5901>; else goto <D.5902>;
      <D.5901>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 61, "filename != NULL");
      D.5903 = 0;
      return D.5903;
      <D.5902>:
      if (contents == 0B) goto <D.5904>; else goto <D.5905>;
      <D.5904>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 62, "contents != NULL");
      D.5903 = 0;
      return D.5903;
      <D.5905>:
      if (error != 0B) goto <D.5906>; else goto <D.5907>;
      <D.5906>:
      D.5908 = *error;
      if (D.5908 != 0B) goto <D.5909>; else goto <D.5910>;
      <D.5909>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 63, "error == NULL || *error == NULL");
      D.5903 = 0;
      return D.5903;
      <D.5910>:
      <D.5907>:
      *contents = 0B;
      if (length != 0B) goto <D.5911>; else goto <D.5912>;
      <D.5911>:
      *length = 0;
      <D.5912>:
      fd = open (filename, 32768);
      if (fd == -1) goto <D.5913>; else goto <D.5914>;
      <D.5913>:
      if (error != 0B) goto <D.5915>; else goto <D.5916>;
      <D.5915>:
      {
        int err;

        D.5917 = __errno_location ();
        err = *D.5917;
        D.5918 = monoeg_g_file_error_from_errno (err);
        D.5919 = (int) D.5918;
        D.5920 = monoeg_g_error_new (0B, D.5919, "Error opening file");
        *error = D.5920;
      }
      <D.5916>:
      D.5903 = 0;
      return D.5903;
      <D.5914>:
      D.5921 = fstat (fd, &st);
      if (D.5921 != 0) goto <D.5922>; else goto <D.5923>;
      <D.5922>:
      if (error != 0B) goto <D.5924>; else goto <D.5925>;
      <D.5924>:
      {
        int err;

        D.5917 = __errno_location ();
        err = *D.5917;
        D.5926 = monoeg_g_file_error_from_errno (err);
        D.5927 = (int) D.5926;
        D.5928 = monoeg_g_error_new (0B, D.5927, "Error in fstat()");
        *error = D.5928;
      }
      <D.5925>:
      close (fd);
      D.5903 = 0;
      return D.5903;
      <D.5923>:
      D.5929 = st.st_size;
      D.5930 = D.5929 + 1;
      D.5931 = (unsigned int) D.5930;
      str = monoeg_malloc (D.5931);
      offset = 0;
      <D.5870>:
      D.5929 = st.st_size;
      D.5932 = D.5929 - offset;
      D.5933 = (unsigned int) D.5932;
      offset.0 = (sizetype) offset;
      D.5935 = str + offset.0;
      nread = read (fd, D.5935, D.5933);
      if (nread > 0) goto <D.5936>; else goto <D.5937>;
      <D.5936>:
      offset = offset + nread;
      <D.5937>:
      if (nread > 0) goto <D.5939>; else goto <D.5938>;
      <D.5939>:
      D.5929 = st.st_size;
      if (D.5929 > offset) goto <D.5870>; else goto <D.5938>;
      <D.5938>:
      if (nread == -1) goto <D.5940>; else goto <D.5871>;
      <D.5940>:
      D.5917 = __errno_location ();
      D.5941 = *D.5917;
      if (D.5941 == 4) goto <D.5870>; else goto <D.5871>;
      <D.5871>:
      close (fd);
      D.5929 = st.st_size;
      D.5942 = (sizetype) D.5929;
      D.5943 = str + D.5942;
      *D.5943 = 0;
      if (length != 0B) goto <D.5944>; else goto <D.5945>;
      <D.5944>:
      D.5929 = st.st_size;
      D.5946 = (unsigned int) D.5929;
      *length = D.5946;
      <D.5945>:
      *contents = str;
      D.5903 = 1;
      return D.5903;
    }
  finally
    {
      st = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.5949;
  int D.5952;
  int D.5957;
  int D.5959;
  int D.5960;
  int D.5963;
  int D.5964;

  D.5949 = __builtin_va_arg_pack_len ();
  if (D.5949 > 1) goto <D.5950>; else goto <D.5951>;
  <D.5950>:
  __open_too_many_args ();
  <D.5951>:
  D.5952 = __builtin_constant_p (__oflag);
  if (D.5952 != 0) goto <D.5953>; else goto <D.5954>;
  <D.5953>:
  D.5957 = __oflag & 64;
  if (D.5957 != 0) goto <D.5955>; else goto <D.5958>;
  <D.5958>:
  D.5959 = __oflag & 4259840;
  if (D.5959 == 4259840) goto <D.5955>; else goto <D.5956>;
  <D.5955>:
  D.5960 = __builtin_va_arg_pack_len ();
  if (D.5960 <= 0) goto <D.5961>; else goto <D.5962>;
  <D.5961>:
  __open_missing_mode ();
  D.5963 = __open_2 (__path, __oflag);
  return D.5963;
  <D.5962>:
  <D.5956>:
  D.5963 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.5963;
  <D.5954>:
  D.5964 = __builtin_va_arg_pack_len ();
  if (D.5964 <= 0) goto <D.5965>; else goto <D.5966>;
  <D.5965>:
  D.5963 = __open_2 (__path, __oflag);
  return D.5963;
  <D.5966>:
  D.5963 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.5963;
}


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

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


read (int __fd, void * __buf, size_t __nbytes)
{
  unsigned int D.5970;
  int D.5973;
  ssize_t D.5976;
  unsigned int D.5977;
  unsigned int D.5978;
  unsigned int D.5981;

  D.5970 = __builtin_object_size (__buf, 0);
  if (D.5970 != 4294967295) goto <D.5971>; else goto <D.5972>;
  <D.5971>:
  D.5973 = __builtin_constant_p (__nbytes);
  if (D.5973 == 0) goto <D.5974>; else goto <D.5975>;
  <D.5974>:
  D.5977 = __builtin_object_size (__buf, 0);
  D.5976 = __read_chk (__fd, __buf, __nbytes, D.5977);
  return D.5976;
  <D.5975>:
  D.5978 = __builtin_object_size (__buf, 0);
  if (D.5978 < __nbytes) goto <D.5979>; else goto <D.5980>;
  <D.5979>:
  D.5981 = __builtin_object_size (__buf, 0);
  D.5976 = __read_chk_warn (__fd, __buf, __nbytes, D.5981);
  return D.5976;
  <D.5980>:
  <D.5972>:
  D.5976 = __read_alias (__fd, __buf, __nbytes);
  return D.5976;
}


monoeg_g_file_open_tmp (const gchar * tmpl, gchar * * name_used, struct GError * * error)
{
  struct GError * D.5985;
  gint D.5988;
  char * D.5991;
  struct GError * D.5996;
  int D.5889;
  int iftmp.1;
  int D.5888;
  sizetype D.6003;
  char[7] * D.6004;
  unsigned char D.6005;
  int D.6006;
  unsigned char D.6007;
  int D.6008;
  _Bool D.6009;
  _Bool D.6010;
  _Bool D.6011;
  const unsigned char * D.6014;
  unsigned char D.6015;
  int D.6016;
  const unsigned char * D.6017;
  unsigned char D.6018;
  int D.6019;
  _Bool D.6020;
  _Bool D.6021;
  const unsigned char * D.6024;
  unsigned char D.6025;
  int D.6026;
  const unsigned char * D.6027;
  unsigned char D.6028;
  int D.6029;
  _Bool D.6030;
  _Bool D.6031;
  const unsigned char * D.6034;
  unsigned char D.6035;
  int D.6036;
  const unsigned char * D.6037;
  unsigned char D.6038;
  int D.6039;
  const gchar * D.6041;
  struct GError * D.6044;
  const gchar * D.6045;
  int * D.6050;
  <unnamed type> D.6051;
  int D.6052;
  struct GError * D.6053;
  static const gchar * default_tmpl = (const gchar *) ".XXXXXX";
  gchar * t;
  gint fd;
  size_t len;

  if (error != 0B) goto <D.5983>; else goto <D.5984>;
  <D.5983>:
  D.5985 = *error;
  if (D.5985 != 0B) goto <D.5986>; else goto <D.5987>;
  <D.5986>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 113, "error == NULL || *error == NULL");
  D.5988 = -1;
  return D.5988;
  <D.5987>:
  <D.5984>:
  if (tmpl == 0B) goto <D.5989>; else goto <D.5990>;
  <D.5989>:
  tmpl = default_tmpl;
  <D.5990>:
  D.5991 = __builtin_strchr (tmpl, 47);
  if (D.5991 != 0B) goto <D.5992>; else goto <D.5993>;
  <D.5992>:
  if (error != 0B) goto <D.5994>; else goto <D.5995>;
  <D.5994>:
  D.5996 = monoeg_g_error_new (0B, 24, "Template should not have any /");
  *error = D.5996;
  <D.5995>:
  D.5988 = -1;
  return D.5988;
  <D.5993>:
  len = strlen (tmpl);
  if (len <= 5) goto <D.5997>; else goto <D.5999>;
  <D.5999>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      D.6003 = len + 4294967290;
      __s2 = tmpl + D.6003;
      D.6004 = "XXXXXX";
      D.6005 = MEM[(const unsigned char *)D.6004];
      D.6006 = (int) D.6005;
      D.6007 = *__s2;
      D.6008 = (int) D.6007;
      __result = D.6006 - D.6008;
      {
        D.6009 = __s2_len != 0;
        D.6010 = __result == 0;
        D.6011 = D.6009 & D.6010;
        if (D.6011 != 0) goto <D.6012>; else goto <D.6013>;
        <D.6012>:
        D.6014 = &MEM[(void *)"XXXXXX" + 1B];
        D.6015 = *D.6014;
        D.6016 = (int) D.6015;
        D.6017 = __s2 + 1;
        D.6018 = *D.6017;
        D.6019 = (int) D.6018;
        __result = D.6016 - D.6019;
        D.6020 = __s2_len > 1;
        D.6010 = __result == 0;
        D.6021 = D.6020 & D.6010;
        if (D.6021 != 0) goto <D.6022>; else goto <D.6023>;
        <D.6022>:
        D.6024 = &MEM[(void *)"XXXXXX" + 2B];
        D.6025 = *D.6024;
        D.6026 = (int) D.6025;
        D.6027 = __s2 + 2;
        D.6028 = *D.6027;
        D.6029 = (int) D.6028;
        __result = D.6026 - D.6029;
        D.6030 = __s2_len > 2;
        D.6010 = __result == 0;
        D.6031 = D.6030 & D.6010;
        if (D.6031 != 0) goto <D.6032>; else goto <D.6033>;
        <D.6032>:
        D.6034 = &MEM[(void *)"XXXXXX" + 3B];
        D.6035 = *D.6034;
        D.6036 = (int) D.6035;
        D.6037 = __s2 + 3;
        D.6038 = *D.6037;
        D.6039 = (int) D.6038;
        __result = D.6036 - D.6039;
        <D.6033>:
        <D.6023>:
        <D.6013>:
      }
      D.5888 = __result;
    }
    iftmp.1 = -D.5888;
    goto <D.6040>;
    <D.6002>:
    D.6003 = len + 4294967290;
    D.6041 = tmpl + D.6003;
    iftmp.1 = __builtin_strcmp (D.6041, "XXXXXX");
    <D.6040>:
    D.5889 = iftmp.1;
  }
  if (D.5889 != 0) goto <D.5997>; else goto <D.5998>;
  <D.5997>:
  if (error != 0B) goto <D.6042>; else goto <D.6043>;
  <D.6042>:
  D.6044 = monoeg_g_error_new (0B, 24, "Template should end with XXXXXX");
  *error = D.6044;
  <D.6043>:
  D.5988 = -1;
  return D.5988;
  <D.5998>:
  D.6045 = monoeg_g_get_tmp_dir ();
  t = monoeg_g_build_path ("/", D.6045, tmpl, 0B);
  fd = mkstemp (t);
  if (fd == -1) goto <D.6046>; else goto <D.6047>;
  <D.6046>:
  if (error != 0B) goto <D.6048>; else goto <D.6049>;
  <D.6048>:
  {
    int err;

    D.6050 = __errno_location ();
    err = *D.6050;
    D.6051 = monoeg_g_file_error_from_errno (err);
    D.6052 = (int) D.6051;
    D.6053 = monoeg_g_error_new (0B, D.6052, "Error in mkstemp()");
    *error = D.6053;
  }
  <D.6049>:
  monoeg_g_free (t);
  D.5988 = -1;
  return D.5988;
  <D.6047>:
  if (name_used != 0B) goto <D.6054>; else goto <D.6055>;
  <D.6054>:
  *name_used = t;
  goto <D.6056>;
  <D.6055>:
  monoeg_g_free (t);
  <D.6056>:
  D.5988 = fd;
  return D.5988;
}


monoeg_g_get_current_dir ()
{
  unsigned int s.2;
  unsigned int s.3;
  int iftmp.4;
  int * D.6064;
  int D.6065;
  gchar * D.6069;
  int s;
  char * buffer;
  char * r;
  gboolean fail;

  s = 32;
  buffer = 0B;
  <D.5898>:
  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.6063>; else goto <D.6061>;
  <D.6063>:
  D.6064 = __errno_location ();
  D.6065 = *D.6064;
  if (D.6065 == 34) goto <D.6066>; else goto <D.6061>;
  <D.6066>:
  iftmp.4 = 1;
  goto <D.6062>;
  <D.6061>:
  iftmp.4 = 0;
  <D.6062>:
  fail = iftmp.4;
  if (fail != 0) goto <D.6067>; else goto <D.6068>;
  <D.6067>:
  s = s << 1;
  <D.6068>:
  if (fail != 0) goto <D.5898>; else goto <D.5899>;
  <D.5899>:
  D.6069 = buffer;
  return D.6069;
}


getcwd (char * __buf, size_t __size)
{
  unsigned int D.6071;
  int D.6074;
  char * D.6077;
  unsigned int D.6078;
  unsigned int D.6079;
  unsigned int D.6082;

  D.6071 = __builtin_object_size (__buf, 1);
  if (D.6071 != 4294967295) goto <D.6072>; else goto <D.6073>;
  <D.6072>:
  D.6074 = __builtin_constant_p (__size);
  if (D.6074 == 0) goto <D.6075>; else goto <D.6076>;
  <D.6075>:
  D.6078 = __builtin_object_size (__buf, 1);
  D.6077 = __getcwd_chk (__buf, __size, D.6078);
  return D.6077;
  <D.6076>:
  D.6079 = __builtin_object_size (__buf, 1);
  if (D.6079 < __size) goto <D.6080>; else goto <D.6081>;
  <D.6080>:
  D.6082 = __builtin_object_size (__buf, 1);
  D.6077 = __getcwd_chk_warn (__buf, __size, D.6082);
  return D.6077;
  <D.6081>:
  <D.6073>:
  D.6077 = __getcwd_alias (__buf, __size);
  return D.6077;
}


