monoeg_g_file_get_contents (const gchar * filename, gchar * * contents, gsize * length, struct GError * * error)
{
  gboolean D.8515;
  struct GError * D.8520;
  int * D.8529;
  <unnamed type> D.8530;
  int D.8531;
  struct GError * D.8532;
  int D.8533;
  <unnamed type> D.8538;
  int D.8539;
  struct GError * D.8540;
  long int D.8541;
  long int D.8542;
  unsigned int D.8543;
  sizetype offset.0;
  void * D.8545;
  long int D.8546;
  unsigned int D.8547;
  int D.8553;
  sizetype D.8554;
  gchar * D.8555;
  unsigned int D.8558;
  gchar * str;
  int fd;
  struct stat st;
  long int offset;
  int nread;

  try
    {
      if (filename == 0B) goto <D.8513>; else goto <D.8514>;
      <D.8513>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 61, "filename != NULL");
      D.8515 = 0;
      return D.8515;
      <D.8514>:
      if (contents == 0B) goto <D.8516>; else goto <D.8517>;
      <D.8516>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 62, "contents != NULL");
      D.8515 = 0;
      return D.8515;
      <D.8517>:
      if (error != 0B) goto <D.8518>; else goto <D.8519>;
      <D.8518>:
      D.8520 = *error;
      if (D.8520 != 0B) goto <D.8521>; else goto <D.8522>;
      <D.8521>:
      monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 63, "error == NULL || *error == NULL");
      D.8515 = 0;
      return D.8515;
      <D.8522>:
      <D.8519>:
      *contents = 0B;
      if (length != 0B) goto <D.8523>; else goto <D.8524>;
      <D.8523>:
      *length = 0;
      <D.8524>:
      fd = open (filename, 131072);
      if (fd == -1) goto <D.8525>; else goto <D.8526>;
      <D.8525>:
      if (error != 0B) goto <D.8527>; else goto <D.8528>;
      <D.8527>:
      {
        int err;

        D.8529 = __errno_location ();
        err = *D.8529;
        D.8530 = monoeg_g_file_error_from_errno (err);
        D.8531 = (int) D.8530;
        D.8532 = monoeg_g_error_new (0B, D.8531, "Error opening file");
        *error = D.8532;
      }
      <D.8528>:
      D.8515 = 0;
      return D.8515;
      <D.8526>:
      D.8533 = fstat (fd, &st);
      if (D.8533 != 0) goto <D.8534>; else goto <D.8535>;
      <D.8534>:
      if (error != 0B) goto <D.8536>; else goto <D.8537>;
      <D.8536>:
      {
        int err;

        D.8529 = __errno_location ();
        err = *D.8529;
        D.8538 = monoeg_g_file_error_from_errno (err);
        D.8539 = (int) D.8538;
        D.8540 = monoeg_g_error_new (0B, D.8539, "Error in fstat()");
        *error = D.8540;
      }
      <D.8537>:
      close (fd);
      D.8515 = 0;
      return D.8515;
      <D.8535>:
      D.8541 = st.st_size;
      D.8542 = D.8541 + 1;
      D.8543 = (unsigned int) D.8542;
      str = monoeg_malloc (D.8543);
      offset = 0;
      <D.8480>:
      offset.0 = (sizetype) offset;
      D.8545 = str + offset.0;
      D.8541 = st.st_size;
      D.8546 = D.8541 - offset;
      D.8547 = (unsigned int) D.8546;
      nread = read (fd, D.8545, D.8547);
      if (nread > 0) goto <D.8548>; else goto <D.8549>;
      <D.8548>:
      offset = offset + nread;
      <D.8549>:
      if (nread > 0) goto <D.8551>; else goto <D.8550>;
      <D.8551>:
      D.8541 = st.st_size;
      if (D.8541 > offset) goto <D.8480>; else goto <D.8550>;
      <D.8550>:
      if (nread == -1) goto <D.8552>; else goto <D.8481>;
      <D.8552>:
      D.8529 = __errno_location ();
      D.8553 = *D.8529;
      if (D.8553 == 4) goto <D.8480>; else goto <D.8481>;
      <D.8481>:
      close (fd);
      D.8541 = st.st_size;
      D.8554 = (sizetype) D.8541;
      D.8555 = str + D.8554;
      *D.8555 = 0;
      if (length != 0B) goto <D.8556>; else goto <D.8557>;
      <D.8556>:
      D.8541 = st.st_size;
      D.8558 = (unsigned int) D.8541;
      *length = D.8558;
      <D.8557>:
      *contents = str;
      D.8515 = 1;
      return D.8515;
    }
  finally
    {
      st = {CLOBBER};
    }
}


open (const char * __path, int __oflag)
{
  int D.8561;
  int D.8564;
  int D.8569;
  int D.8571;
  int D.8572;
  int D.8575;
  int D.8576;

  D.8561 = __builtin_va_arg_pack_len ();
  if (D.8561 > 1) goto <D.8562>; else goto <D.8563>;
  <D.8562>:
  __open_too_many_args ();
  <D.8563>:
  D.8564 = __builtin_constant_p (__oflag);
  if (D.8564 != 0) goto <D.8565>; else goto <D.8566>;
  <D.8565>:
  D.8569 = __oflag & 64;
  if (D.8569 != 0) goto <D.8567>; else goto <D.8570>;
  <D.8570>:
  D.8571 = __oflag & 4210688;
  if (D.8571 == 4210688) goto <D.8567>; else goto <D.8568>;
  <D.8567>:
  D.8572 = __builtin_va_arg_pack_len ();
  if (D.8572 <= 0) goto <D.8573>; else goto <D.8574>;
  <D.8573>:
  __open_missing_mode ();
  D.8575 = __open_2 (__path, __oflag);
  return D.8575;
  <D.8574>:
  <D.8568>:
  D.8575 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.8575;
  <D.8566>:
  D.8576 = __builtin_va_arg_pack_len ();
  if (D.8576 <= 0) goto <D.8577>; else goto <D.8578>;
  <D.8577>:
  D.8575 = __open_2 (__path, __oflag);
  return D.8575;
  <D.8578>:
  D.8575 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.8575;
}


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

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


read (int __fd, void * __buf, size_t __nbytes)
{
  unsigned int D.8582;
  int D.8585;
  ssize_t D.8588;
  unsigned int D.8589;
  unsigned int D.8590;
  unsigned int D.8593;

  D.8582 = __builtin_object_size (__buf, 0);
  if (D.8582 != 4294967295) goto <D.8583>; else goto <D.8584>;
  <D.8583>:
  D.8585 = __builtin_constant_p (__nbytes);
  if (D.8585 == 0) goto <D.8586>; else goto <D.8587>;
  <D.8586>:
  D.8589 = __builtin_object_size (__buf, 0);
  D.8588 = __read_chk (__fd, __buf, __nbytes, D.8589);
  return D.8588;
  <D.8587>:
  D.8590 = __builtin_object_size (__buf, 0);
  if (D.8590 < __nbytes) goto <D.8591>; else goto <D.8592>;
  <D.8591>:
  D.8593 = __builtin_object_size (__buf, 0);
  D.8588 = __read_chk_warn (__fd, __buf, __nbytes, D.8593);
  return D.8588;
  <D.8592>:
  <D.8584>:
  D.8588 = __read_alias (__fd, __buf, __nbytes);
  return D.8588;
}


monoeg_g_file_open_tmp (const gchar * tmpl, gchar * * name_used, struct GError * * error)
{
  struct GError * D.8597;
  gint D.8600;
  char * D.8603;
  struct GError * D.8608;
  int D.8499;
  int iftmp.1;
  int D.8498;
  sizetype D.8615;
  char[7] * D.8616;
  unsigned char D.8617;
  int D.8618;
  unsigned char D.8619;
  int D.8620;
  _Bool D.8621;
  _Bool D.8622;
  _Bool D.8623;
  const unsigned char * D.8626;
  unsigned char D.8627;
  int D.8628;
  const unsigned char * D.8629;
  unsigned char D.8630;
  int D.8631;
  _Bool D.8632;
  _Bool D.8633;
  const unsigned char * D.8636;
  unsigned char D.8637;
  int D.8638;
  const unsigned char * D.8639;
  unsigned char D.8640;
  int D.8641;
  _Bool D.8642;
  _Bool D.8643;
  const unsigned char * D.8646;
  unsigned char D.8647;
  int D.8648;
  const unsigned char * D.8649;
  unsigned char D.8650;
  int D.8651;
  const gchar * D.8653;
  struct GError * D.8656;
  const gchar * D.8657;
  int * D.8662;
  <unnamed type> D.8663;
  int D.8664;
  struct GError * D.8665;
  static const gchar * default_tmpl = (const gchar *) ".XXXXXX";
  gchar * t;
  gint fd;
  size_t len;

  if (error != 0B) goto <D.8595>; else goto <D.8596>;
  <D.8595>:
  D.8597 = *error;
  if (D.8597 != 0B) goto <D.8598>; else goto <D.8599>;
  <D.8598>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "gfile-posix.c", 113, "error == NULL || *error == NULL");
  D.8600 = -1;
  return D.8600;
  <D.8599>:
  <D.8596>:
  if (tmpl == 0B) goto <D.8601>; else goto <D.8602>;
  <D.8601>:
  tmpl = default_tmpl;
  <D.8602>:
  D.8603 = __builtin_strchr (tmpl, 47);
  if (D.8603 != 0B) goto <D.8604>; else goto <D.8605>;
  <D.8604>:
  if (error != 0B) goto <D.8606>; else goto <D.8607>;
  <D.8606>:
  D.8608 = monoeg_g_error_new (0B, 24, "Template should not have any /");
  *error = D.8608;
  <D.8607>:
  D.8600 = -1;
  return D.8600;
  <D.8605>:
  len = strlen (tmpl);
  if (len <= 5) goto <D.8609>; else goto <D.8611>;
  <D.8611>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      D.8615 = len + 4294967290;
      __s2 = tmpl + D.8615;
      D.8616 = "XXXXXX";
      D.8617 = MEM[(const unsigned char *)D.8616];
      D.8618 = (int) D.8617;
      D.8619 = *__s2;
      D.8620 = (int) D.8619;
      __result = D.8618 - D.8620;
      {
        D.8621 = __s2_len != 0;
        D.8622 = __result == 0;
        D.8623 = D.8621 & D.8622;
        if (D.8623 != 0) goto <D.8624>; else goto <D.8625>;
        <D.8624>:
        D.8626 = &MEM[(void *)"XXXXXX" + 1B];
        D.8627 = *D.8626;
        D.8628 = (int) D.8627;
        D.8629 = __s2 + 1;
        D.8630 = *D.8629;
        D.8631 = (int) D.8630;
        __result = D.8628 - D.8631;
        D.8632 = __s2_len > 1;
        D.8622 = __result == 0;
        D.8633 = D.8632 & D.8622;
        if (D.8633 != 0) goto <D.8634>; else goto <D.8635>;
        <D.8634>:
        D.8636 = &MEM[(void *)"XXXXXX" + 2B];
        D.8637 = *D.8636;
        D.8638 = (int) D.8637;
        D.8639 = __s2 + 2;
        D.8640 = *D.8639;
        D.8641 = (int) D.8640;
        __result = D.8638 - D.8641;
        D.8642 = __s2_len > 2;
        D.8622 = __result == 0;
        D.8643 = D.8642 & D.8622;
        if (D.8643 != 0) goto <D.8644>; else goto <D.8645>;
        <D.8644>:
        D.8646 = &MEM[(void *)"XXXXXX" + 3B];
        D.8647 = *D.8646;
        D.8648 = (int) D.8647;
        D.8649 = __s2 + 3;
        D.8650 = *D.8649;
        D.8651 = (int) D.8650;
        __result = D.8648 - D.8651;
        <D.8645>:
        <D.8635>:
        <D.8625>:
      }
      D.8498 = __result;
    }
    iftmp.1 = -D.8498;
    goto <D.8652>;
    <D.8614>:
    D.8615 = len + 4294967290;
    D.8653 = tmpl + D.8615;
    iftmp.1 = __builtin_strcmp (D.8653, "XXXXXX");
    <D.8652>:
    D.8499 = iftmp.1;
  }
  if (D.8499 != 0) goto <D.8609>; else goto <D.8610>;
  <D.8609>:
  if (error != 0B) goto <D.8654>; else goto <D.8655>;
  <D.8654>:
  D.8656 = monoeg_g_error_new (0B, 24, "Template should end with XXXXXX");
  *error = D.8656;
  <D.8655>:
  D.8600 = -1;
  return D.8600;
  <D.8610>:
  D.8657 = monoeg_g_get_tmp_dir ();
  t = monoeg_g_build_path ("/", D.8657, tmpl, 0B);
  fd = mkstemp (t);
  if (fd == -1) goto <D.8658>; else goto <D.8659>;
  <D.8658>:
  if (error != 0B) goto <D.8660>; else goto <D.8661>;
  <D.8660>:
  {
    int err;

    D.8662 = __errno_location ();
    err = *D.8662;
    D.8663 = monoeg_g_file_error_from_errno (err);
    D.8664 = (int) D.8663;
    D.8665 = monoeg_g_error_new (0B, D.8664, "Error in mkstemp()");
    *error = D.8665;
  }
  <D.8661>:
  monoeg_g_free (t);
  D.8600 = -1;
  return D.8600;
  <D.8659>:
  if (name_used != 0B) goto <D.8666>; else goto <D.8667>;
  <D.8666>:
  *name_used = t;
  goto <D.8668>;
  <D.8667>:
  monoeg_g_free (t);
  <D.8668>:
  D.8600 = fd;
  return D.8600;
}


monoeg_g_get_current_dir ()
{
  unsigned int s.2;
  unsigned int s.3;
  int iftmp.4;
  int * D.8676;
  int D.8677;
  gchar * D.8681;
  int s;
  char * buffer;
  char * r;
  gboolean fail;

  s = 32;
  buffer = 0B;
  <D.8508>:
  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.8675>; else goto <D.8673>;
  <D.8675>:
  D.8676 = __errno_location ();
  D.8677 = *D.8676;
  if (D.8677 == 34) goto <D.8678>; else goto <D.8673>;
  <D.8678>:
  iftmp.4 = 1;
  goto <D.8674>;
  <D.8673>:
  iftmp.4 = 0;
  <D.8674>:
  fail = iftmp.4;
  if (fail != 0) goto <D.8679>; else goto <D.8680>;
  <D.8679>:
  s = s << 1;
  <D.8680>:
  if (fail != 0) goto <D.8508>; else goto <D.8509>;
  <D.8509>:
  D.8681 = buffer;
  return D.8681;
}


getcwd (char * __buf, size_t __size)
{
  unsigned int D.8683;
  int D.8686;
  char * D.8689;
  unsigned int D.8690;
  unsigned int D.8691;
  unsigned int D.8694;

  D.8683 = __builtin_object_size (__buf, 1);
  if (D.8683 != 4294967295) goto <D.8684>; else goto <D.8685>;
  <D.8684>:
  D.8686 = __builtin_constant_p (__size);
  if (D.8686 == 0) goto <D.8687>; else goto <D.8688>;
  <D.8687>:
  D.8690 = __builtin_object_size (__buf, 1);
  D.8689 = __getcwd_chk (__buf, __size, D.8690);
  return D.8689;
  <D.8688>:
  D.8691 = __builtin_object_size (__buf, 1);
  if (D.8691 < __size) goto <D.8692>; else goto <D.8693>;
  <D.8692>:
  D.8694 = __builtin_object_size (__buf, 1);
  D.8689 = __getcwd_chk_warn (__buf, __size, D.8694);
  return D.8689;
  <D.8693>:
  <D.8685>:
  D.8689 = __getcwd_alias (__buf, __size);
  return D.8689;
}


