monoeg_g_file_get_contents (const gchar * filename, gchar * * contents, gsize * length, struct GError * * error)
{
  gboolean D.6250;
  struct GError * D.6255;
  int * D.6264;
  <unnamed type> D.6265;
  int D.6266;
  struct GError * D.6267;
  int D.6268;
  <unnamed type> D.6273;
  int D.6274;
  struct GError * D.6275;
  long int D.6276;
  long int D.6277;
  long unsigned int D.6278;
  long int D.6279;
  long unsigned int D.6280;
  sizetype offset.0;
  void * D.6282;
  long int D.6283;
  long int D.6286;
  int D.6290;
  sizetype D.6291;
  gchar * D.6292;
  long unsigned int D.6295;
  gchar * str;
  int fd;
  struct stat st;
  long int offset;
  int nread;

  try
    {
      if (filename == 0B) goto <D.6248>; else goto <D.6249>;
      <D.6248>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 61, "filename != NULL");
      D.6250 = 0;
      return D.6250;
      <D.6249>:
      if (contents == 0B) goto <D.6251>; else goto <D.6252>;
      <D.6251>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 62, "contents != NULL");
      D.6250 = 0;
      return D.6250;
      <D.6252>:
      if (error != 0B) goto <D.6253>; else goto <D.6254>;
      <D.6253>:
      D.6255 = *error;
      if (D.6255 != 0B) goto <D.6256>; else goto <D.6257>;
      <D.6256>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 63, "error == NULL || *error == NULL");
      D.6250 = 0;
      return D.6250;
      <D.6257>:
      <D.6254>:
      *contents = 0B;
      if (length != 0B) goto <D.6258>; else goto <D.6259>;
      <D.6258>:
      *length = 0;
      <D.6259>:
      fd = open (filename, 0);
      if (fd == -1) goto <D.6260>; else goto <D.6261>;
      <D.6260>:
      if (error != 0B) goto <D.6262>; else goto <D.6263>;
      <D.6262>:
      {
        int err;

        D.6264 = __errno_location ();
        err = *D.6264;
        D.6265 = monoeg_g_file_error_from_errno (err);
        D.6266 = (int) D.6265;
        D.6267 = monoeg_g_error_new (0B, D.6266, "Error opening file");
        *error = D.6267;
      }
      <D.6263>:
      D.6250 = 0;
      return D.6250;
      <D.6261>:
      D.6268 = fstat (fd, &st);
      if (D.6268 != 0) goto <D.6269>; else goto <D.6270>;
      <D.6269>:
      if (error != 0B) goto <D.6271>; else goto <D.6272>;
      <D.6271>:
      {
        int err;

        D.6264 = __errno_location ();
        err = *D.6264;
        D.6273 = monoeg_g_file_error_from_errno (err);
        D.6274 = (int) D.6273;
        D.6275 = monoeg_g_error_new (0B, D.6274, "Error in fstat()");
        *error = D.6275;
      }
      <D.6272>:
      close (fd);
      D.6250 = 0;
      return D.6250;
      <D.6270>:
      D.6276 = st.st_size;
      D.6277 = D.6276 + 1;
      D.6278 = (long unsigned int) D.6277;
      str = monoeg_malloc (D.6278);
      offset = 0;
      <D.6217>:
      D.6276 = st.st_size;
      D.6279 = D.6276 - offset;
      D.6280 = (long unsigned int) D.6279;
      offset.0 = (sizetype) offset;
      D.6282 = str + offset.0;
      D.6283 = read (fd, D.6282, D.6280);
      nread = (int) D.6283;
      if (nread > 0) goto <D.6284>; else goto <D.6285>;
      <D.6284>:
      D.6286 = (long int) nread;
      offset = D.6286 + offset;
      <D.6285>:
      if (nread > 0) goto <D.6288>; else goto <D.6287>;
      <D.6288>:
      D.6276 = st.st_size;
      if (D.6276 > offset) goto <D.6217>; else goto <D.6287>;
      <D.6287>:
      if (nread == -1) goto <D.6289>; else goto <D.6218>;
      <D.6289>:
      D.6264 = __errno_location ();
      D.6290 = *D.6264;
      if (D.6290 == 4) goto <D.6217>; else goto <D.6218>;
      <D.6218>:
      close (fd);
      D.6276 = st.st_size;
      D.6291 = (sizetype) D.6276;
      D.6292 = str + D.6291;
      *D.6292 = 0;
      if (length != 0B) goto <D.6293>; else goto <D.6294>;
      <D.6293>:
      D.6276 = st.st_size;
      D.6295 = (long unsigned int) D.6276;
      *length = D.6295;
      <D.6294>:
      *contents = str;
      D.6250 = 1;
      return D.6250;
    }
  finally
    {
      st = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.6298;
  int D.6301;
  int D.6306;
  int D.6308;
  int D.6309;
  int D.6312;
  int D.6313;

  D.6298 = __builtin_va_arg_pack_len ();
  if (D.6298 > 1) goto <D.6299>; else goto <D.6300>;
  <D.6299>:
  __open_too_many_args ();
  <D.6300>:
  D.6301 = __builtin_constant_p (__oflag);
  if (D.6301 != 0) goto <D.6302>; else goto <D.6303>;
  <D.6302>:
  D.6306 = __oflag & 64;
  if (D.6306 != 0) goto <D.6304>; else goto <D.6307>;
  <D.6307>:
  D.6308 = __oflag & 4259840;
  if (D.6308 == 4259840) goto <D.6304>; else goto <D.6305>;
  <D.6304>:
  D.6309 = __builtin_va_arg_pack_len ();
  if (D.6309 <= 0) goto <D.6310>; else goto <D.6311>;
  <D.6310>:
  __open_missing_mode ();
  D.6312 = __open_2 (__path, __oflag);
  return D.6312;
  <D.6311>:
  <D.6305>:
  D.6312 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.6312;
  <D.6303>:
  D.6313 = __builtin_va_arg_pack_len ();
  if (D.6313 <= 0) goto <D.6314>; else goto <D.6315>;
  <D.6314>:
  D.6312 = __open_2 (__path, __oflag);
  return D.6312;
  <D.6315>:
  D.6312 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.6312;
}


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

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


read (int __fd, void * __buf, size_t __nbytes)
{
  long unsigned int D.6319;
  int D.6322;
  ssize_t D.6325;
  long unsigned int D.6326;
  long unsigned int D.6327;
  long unsigned int D.6330;

  D.6319 = __builtin_object_size (__buf, 0);
  if (D.6319 != 18446744073709551615) goto <D.6320>; else goto <D.6321>;
  <D.6320>:
  D.6322 = __builtin_constant_p (__nbytes);
  if (D.6322 == 0) goto <D.6323>; else goto <D.6324>;
  <D.6323>:
  D.6326 = __builtin_object_size (__buf, 0);
  D.6325 = __read_chk (__fd, __buf, __nbytes, D.6326);
  return D.6325;
  <D.6324>:
  D.6327 = __builtin_object_size (__buf, 0);
  if (D.6327 < __nbytes) goto <D.6328>; else goto <D.6329>;
  <D.6328>:
  D.6330 = __builtin_object_size (__buf, 0);
  D.6325 = __read_chk_warn (__fd, __buf, __nbytes, D.6330);
  return D.6325;
  <D.6329>:
  <D.6321>:
  D.6325 = __read_alias (__fd, __buf, __nbytes);
  return D.6325;
}


monoeg_g_file_open_tmp (const gchar * tmpl, gchar * * name_used, struct GError * * error)
{
  struct GError * D.6334;
  gint D.6337;
  char * D.6340;
  struct GError * D.6345;
  int D.6236;
  int iftmp.1;
  int D.6235;
  sizetype D.6352;
  char[7] * D.6353;
  unsigned char D.6354;
  int D.6355;
  unsigned char D.6356;
  int D.6357;
  _Bool D.6358;
  _Bool D.6359;
  _Bool D.6360;
  const unsigned char * D.6363;
  unsigned char D.6364;
  int D.6365;
  const unsigned char * D.6366;
  unsigned char D.6367;
  int D.6368;
  _Bool D.6369;
  _Bool D.6370;
  const unsigned char * D.6373;
  unsigned char D.6374;
  int D.6375;
  const unsigned char * D.6376;
  unsigned char D.6377;
  int D.6378;
  _Bool D.6379;
  _Bool D.6380;
  const unsigned char * D.6383;
  unsigned char D.6384;
  int D.6385;
  const unsigned char * D.6386;
  unsigned char D.6387;
  int D.6388;
  const gchar * D.6390;
  struct GError * D.6393;
  const gchar * D.6394;
  int * D.6399;
  <unnamed type> D.6400;
  int D.6401;
  struct GError * D.6402;
  static const gchar * default_tmpl = (const gchar *) ".XXXXXX";
  gchar * t;
  gint fd;
  size_t len;

  if (error != 0B) goto <D.6332>; else goto <D.6333>;
  <D.6332>:
  D.6334 = *error;
  if (D.6334 != 0B) goto <D.6335>; else goto <D.6336>;
  <D.6335>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 113, "error == NULL || *error == NULL");
  D.6337 = -1;
  return D.6337;
  <D.6336>:
  <D.6333>:
  if (tmpl == 0B) goto <D.6338>; else goto <D.6339>;
  <D.6338>:
  tmpl = default_tmpl;
  <D.6339>:
  D.6340 = __builtin_strchr (tmpl, 47);
  if (D.6340 != 0B) goto <D.6341>; else goto <D.6342>;
  <D.6341>:
  if (error != 0B) goto <D.6343>; else goto <D.6344>;
  <D.6343>:
  D.6345 = monoeg_g_error_new (0B, 24, "Template should not have any /");
  *error = D.6345;
  <D.6344>:
  D.6337 = -1;
  return D.6337;
  <D.6342>:
  len = strlen (tmpl);
  if (len <= 5) goto <D.6346>; else goto <D.6348>;
  <D.6348>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      D.6352 = len + 18446744073709551610;
      __s2 = tmpl + D.6352;
      D.6353 = "XXXXXX";
      D.6354 = MEM[(const unsigned char *)D.6353];
      D.6355 = (int) D.6354;
      D.6356 = *__s2;
      D.6357 = (int) D.6356;
      __result = D.6355 - D.6357;
      {
        D.6358 = __s2_len != 0;
        D.6359 = __result == 0;
        D.6360 = D.6358 & D.6359;
        if (D.6360 != 0) goto <D.6361>; else goto <D.6362>;
        <D.6361>:
        D.6363 = &MEM[(void *)"XXXXXX" + 1B];
        D.6364 = *D.6363;
        D.6365 = (int) D.6364;
        D.6366 = __s2 + 1;
        D.6367 = *D.6366;
        D.6368 = (int) D.6367;
        __result = D.6365 - D.6368;
        D.6369 = __s2_len > 1;
        D.6359 = __result == 0;
        D.6370 = D.6369 & D.6359;
        if (D.6370 != 0) goto <D.6371>; else goto <D.6372>;
        <D.6371>:
        D.6373 = &MEM[(void *)"XXXXXX" + 2B];
        D.6374 = *D.6373;
        D.6375 = (int) D.6374;
        D.6376 = __s2 + 2;
        D.6377 = *D.6376;
        D.6378 = (int) D.6377;
        __result = D.6375 - D.6378;
        D.6379 = __s2_len > 2;
        D.6359 = __result == 0;
        D.6380 = D.6379 & D.6359;
        if (D.6380 != 0) goto <D.6381>; else goto <D.6382>;
        <D.6381>:
        D.6383 = &MEM[(void *)"XXXXXX" + 3B];
        D.6384 = *D.6383;
        D.6385 = (int) D.6384;
        D.6386 = __s2 + 3;
        D.6387 = *D.6386;
        D.6388 = (int) D.6387;
        __result = D.6385 - D.6388;
        <D.6382>:
        <D.6372>:
        <D.6362>:
      }
      D.6235 = __result;
    }
    iftmp.1 = -D.6235;
    goto <D.6389>;
    <D.6351>:
    D.6352 = len + 18446744073709551610;
    D.6390 = tmpl + D.6352;
    iftmp.1 = __builtin_strcmp (D.6390, "XXXXXX");
    <D.6389>:
    D.6236 = iftmp.1;
  }
  if (D.6236 != 0) goto <D.6346>; else goto <D.6347>;
  <D.6346>:
  if (error != 0B) goto <D.6391>; else goto <D.6392>;
  <D.6391>:
  D.6393 = monoeg_g_error_new (0B, 24, "Template should end with XXXXXX");
  *error = D.6393;
  <D.6392>:
  D.6337 = -1;
  return D.6337;
  <D.6347>:
  D.6394 = monoeg_g_get_tmp_dir ();
  t = monoeg_g_build_path ("/", D.6394, tmpl, 0B);
  fd = mkstemp (t);
  if (fd == -1) goto <D.6395>; else goto <D.6396>;
  <D.6395>:
  if (error != 0B) goto <D.6397>; else goto <D.6398>;
  <D.6397>:
  {
    int err;

    D.6399 = __errno_location ();
    err = *D.6399;
    D.6400 = monoeg_g_file_error_from_errno (err);
    D.6401 = (int) D.6400;
    D.6402 = monoeg_g_error_new (0B, D.6401, "Error in mkstemp()");
    *error = D.6402;
  }
  <D.6398>:
  monoeg_g_free (t);
  D.6337 = -1;
  return D.6337;
  <D.6396>:
  if (name_used != 0B) goto <D.6403>; else goto <D.6404>;
  <D.6403>:
  *name_used = t;
  goto <D.6405>;
  <D.6404>:
  monoeg_g_free (t);
  <D.6405>:
  D.6337 = fd;
  return D.6337;
}


monoeg_g_get_current_dir ()
{
  long unsigned int D.6407;
  long unsigned int D.6408;
  int iftmp.2;
  int * D.6413;
  int D.6414;
  gchar * D.6418;
  int s;
  char * buffer;
  char * r;
  gboolean fail;

  s = 32;
  buffer = 0B;
  <D.6245>:
  D.6407 = (long unsigned int) s;
  buffer = monoeg_realloc (buffer, D.6407);
  D.6408 = (long unsigned int) s;
  r = getcwd (buffer, D.6408);
  if (r == 0B) goto <D.6412>; else goto <D.6410>;
  <D.6412>:
  D.6413 = __errno_location ();
  D.6414 = *D.6413;
  if (D.6414 == 34) goto <D.6415>; else goto <D.6410>;
  <D.6415>:
  iftmp.2 = 1;
  goto <D.6411>;
  <D.6410>:
  iftmp.2 = 0;
  <D.6411>:
  fail = iftmp.2;
  if (fail != 0) goto <D.6416>; else goto <D.6417>;
  <D.6416>:
  s = s << 1;
  <D.6417>:
  if (fail != 0) goto <D.6245>; else goto <D.6246>;
  <D.6246>:
  D.6418 = buffer;
  return D.6418;
}


getcwd (char * __buf, size_t __size)
{
  long unsigned int D.6420;
  int D.6423;
  char * D.6426;
  long unsigned int D.6427;
  long unsigned int D.6428;
  long unsigned int D.6431;

  D.6420 = __builtin_object_size (__buf, 1);
  if (D.6420 != 18446744073709551615) goto <D.6421>; else goto <D.6422>;
  <D.6421>:
  D.6423 = __builtin_constant_p (__size);
  if (D.6423 == 0) goto <D.6424>; else goto <D.6425>;
  <D.6424>:
  D.6427 = __builtin_object_size (__buf, 1);
  D.6426 = __getcwd_chk (__buf, __size, D.6427);
  return D.6426;
  <D.6425>:
  D.6428 = __builtin_object_size (__buf, 1);
  if (D.6428 < __size) goto <D.6429>; else goto <D.6430>;
  <D.6429>:
  D.6431 = __builtin_object_size (__buf, 1);
  D.6426 = __getcwd_chk_warn (__buf, __size, D.6431);
  return D.6426;
  <D.6430>:
  <D.6422>:
  D.6426 = __getcwd_alias (__buf, __size);
  return D.6426;
}


