__attribute__((visibility ("hidden")))
ves_icall_System_IO_FSW_SupportsFSW ()
{
  gint D.17210;
  int (*<T2c82>) (void *, void *) FAMNextEvent.0;
  struct MonoDl * fam_module;
  int lib_used;
  int inotify_instance;
  void * iter;
  char * err;

  lib_used = 4;
  inotify_instance = ves_icall_System_IO_InotifyWatcher_GetInotifyInstance ();
  if (inotify_instance != -1) goto <D.17208>; else goto <D.17209>;
  <D.17208>:
  close (inotify_instance);
  D.17210 = 5;
  return D.17210;
  <D.17209>:
  iter = 0B;
  fam_module = mono_dl_open ("libgamin-1.so", 1, 0B);
  if (fam_module == 0B) goto <D.17211>; else goto <D.17212>;
  <D.17211>:
  lib_used = 2;
  iter = 0B;
  fam_module = mono_dl_open ("libfam.so", 1, 0B);
  <D.17212>:
  if (fam_module == 0B) goto <D.17213>; else goto <D.17214>;
  <D.17213>:
  D.17210 = 0;
  return D.17210;
  <D.17214>:
  err = mono_dl_symbol (fam_module, "FAMNextEvent", &FAMNextEvent);
  monoeg_g_free (err);
  FAMNextEvent.0 = FAMNextEvent;
  if (FAMNextEvent.0 == 0B) goto <D.17216>; else goto <D.17217>;
  <D.17216>:
  D.17210 = 0;
  return D.17210;
  <D.17217>:
  D.17210 = lib_used;
  return D.17210;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_FAMW_InternalFAMNextEvent (void * conn, struct MonoString * * filename, gint * code, gint * reqnum)
{
  int (*<T2c82>) (void *, void *) FAMNextEvent.1;
  int D.17220;
  struct MonoDomain * D.17223;
  struct MonoString * D.17224;
  int D.17225;
  int D.17226;
  gboolean D.17227;
  struct FAMEvent ev;

  try
    {
      FAMNextEvent.1 = FAMNextEvent;
      D.17220 = FAMNextEvent.1 (conn, &ev);
      if (D.17220 == 1) goto <D.17221>; else goto <D.17222>;
      <D.17221>:
      D.17223 = mono_domain_get ();
      D.17224 = mono_string_new (D.17223, &ev.filename);
      *filename = D.17224;
      D.17225 = ev.code;
      *code = D.17225;
      D.17226 = ev.fr.reqnum;
      *reqnum = D.17226;
      D.17227 = 1;
      return D.17227;
      <D.17222>:
      D.17227 = 0;
      return D.17227;
    }
  finally
    {
      ev = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_InotifyWatcher_GetInotifyInstance ()
{
  int D.17230;

  D.17230 = inotify_init ();
  return D.17230;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, struct MonoString * name, gint32 mask)
{
  int D.17234;
  unsigned int mask.2;
  int * D.17240;
  int D.17241;
  char * str;
  char * path;
  int retval;

  if (name == 0B) goto <D.17232>; else goto <D.17233>;
  <D.17232>:
  D.17234 = -1;
  return D.17234;
  <D.17233>:
  str = mono_string_to_utf8 (name);
  path = mono_portability_find_file (str, 1);
  if (path == 0B) goto <D.17235>; else goto <D.17236>;
  <D.17235>:
  path = str;
  <D.17236>:
  mask.2 = (unsigned int) mask;
  retval = inotify_add_watch (fd, path, mask.2);
  if (retval < 0) goto <D.17238>; else goto <D.17239>;
  <D.17238>:
  D.17240 = __errno_location ();
  D.17241 = *D.17240;
  switch (D.17241) <default: <D.17202>, case 9: <D.17197>, case 12: <D.17200>, case 13: <D.17195>, case 14: <D.17198>, case 22: <D.17199>, case 28: <D.17201>>
  <D.17195>:
  D.17240 = __errno_location ();
  *D.17240 = 5;
  goto <D.17196>;
  <D.17197>:
  D.17240 = __errno_location ();
  *D.17240 = 6;
  goto <D.17196>;
  <D.17198>:
  D.17240 = __errno_location ();
  *D.17240 = 12;
  goto <D.17196>;
  <D.17199>:
  D.17240 = __errno_location ();
  *D.17240 = 13;
  goto <D.17196>;
  <D.17200>:
  D.17240 = __errno_location ();
  *D.17240 = 8;
  goto <D.17196>;
  <D.17201>:
  D.17240 = __errno_location ();
  *D.17240 = 4;
  goto <D.17196>;
  <D.17202>:
  D.17240 = __errno_location ();
  *D.17240 = 31;
  goto <D.17196>;
  <D.17196>:
  mono_marshal_set_last_error ();
  <D.17239>:
  if (path != str) goto <D.17242>; else goto <D.17243>;
  <D.17242>:
  monoeg_g_free (path);
  <D.17243>:
  monoeg_g_free (str);
  D.17234 = retval;
  return D.17234;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor)
{
  int D.17245;

  D.17245 = inotify_rm_watch (fd, watch_descriptor);
  return D.17245;
}


