__attribute__((visibility ("hidden")))
mono_attach_parse_options (char * options)
{
  int D.18236;

  if (options == 0B) goto <D.18234>; else goto <D.18235>;
  <D.18234>:
  return;
  <D.18235>:
  D.18236 = strcmp (options, "disable");
  if (D.18236 == 0) goto <D.18237>; else goto <D.18238>;
  <D.18237>:
  config.enabled = 0;
  <D.18238>:
}


__attribute__((__gnu_inline__, nothrow, leaf, pure))
strcmp (const char * __s1, const char * __s2)
{
  int iftmp.0;
  int iftmp.1;
  int D.18248;
  char * __p1;
  char * __p2;
  int __ret;

  __p1 = __s1;
  __p2 = __s2;
  __asm__ __volatile__("   slr   0,0
0: clst  %1,%2
   jo    0b
   ipm   %0
   srl   %0,28" : "=d" __ret, "=&a" __p1, "=&a" __p2 : "1" __p1, "2" __p2 : "0", "memory", "cc");
  if (__ret != 0) goto <D.18241>; else goto <D.18242>;
  <D.18241>:
  if (__ret == 1) goto <D.18244>; else goto <D.18245>;
  <D.18244>:
  iftmp.1 = -1;
  goto <D.18246>;
  <D.18245>:
  iftmp.1 = 1;
  <D.18246>:
  iftmp.0 = iftmp.1;
  goto <D.18247>;
  <D.18242>:
  iftmp.0 = 0;
  <D.18247>:
  __ret = iftmp.0;
  D.18248 = __ret;
  return D.18248;
}


__attribute__((visibility ("hidden")))
mono_attach_init ()
{
  InitializeCriticalSection (&agent_mutex);
  config.enabled = 1;
}


__attribute__((visibility ("hidden")))
mono_attach_start ()
{
  int started.2;
  gboolean D.18253;
  int D.18254;
  int D.18257;
  char path[256];
  int fd;

  try
    {
      started.2 = started;
      if (started.2 != 0) goto <D.18251>; else goto <D.18252>;
      <D.18251>:
      D.18253 = 0;
      return D.18253;
      <D.18252>:
      D.18254 = getpid ();
      snprintf (&path, 256, "/tmp/.mono_attach_pid%d", D.18254);
      fd = open (&path, 0);
      if (fd == -1) goto <D.18255>; else goto <D.18256>;
      <D.18255>:
      D.18253 = 0;
      return D.18253;
      <D.18256>:
      close (fd);
      D.18257 = config.enabled;
      if (D.18257 == 0) goto <D.18258>; else goto <D.18259>;
      <D.18258>:
      D.18253 = 1;
      return D.18253;
      <D.18259>:
      started.2 = started;
      if (started.2 != 0) goto <D.18260>; else goto <D.18261>;
      <D.18260>:
      D.18253 = 0;
      return D.18253;
      <D.18261>:
      needs_to_start = 1;
      mono_gc_finalize_notify ();
      D.18253 = 1;
      return D.18253;
    }
  finally
    {
      path = {CLOBBER};
    }
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __leaf__, __nothrow__))
snprintf (char * restrict __s, size_t __n, const char * restrict __fmt)
{
  int D.18264;
  long unsigned int D.18265;

  D.18265 = __builtin_object_size (__s, 1);
  D.18264 = __builtin___snprintf_chk (__s, __n, 1, D.18265, __fmt, __builtin_va_arg_pack ());
  return D.18264;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
open (const char * __path, int __oflag)
{
  int D.18267;
  int D.18270;
  int D.18275;
  int D.18277;
  int D.18278;
  int D.18281;
  int D.18282;

  D.18267 = __builtin_va_arg_pack_len ();
  if (D.18267 > 1) goto <D.18268>; else goto <D.18269>;
  <D.18268>:
  __open_too_many_args ();
  <D.18269>:
  D.18270 = __builtin_constant_p (__oflag);
  if (D.18270 != 0) goto <D.18271>; else goto <D.18272>;
  <D.18271>:
  D.18275 = __oflag & 64;
  if (D.18275 != 0) goto <D.18273>; else goto <D.18276>;
  <D.18276>:
  D.18277 = __oflag & 4259840;
  if (D.18277 == 4259840) goto <D.18273>; else goto <D.18274>;
  <D.18273>:
  D.18278 = __builtin_va_arg_pack_len ();
  if (D.18278 <= 0) goto <D.18279>; else goto <D.18280>;
  <D.18279>:
  __open_missing_mode ();
  D.18281 = __open_2 (__path, __oflag);
  return D.18281;
  <D.18280>:
  <D.18274>:
  D.18281 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.18281;
  <D.18272>:
  D.18282 = __builtin_va_arg_pack_len ();
  if (D.18282 <= 0) goto <D.18283>; else goto <D.18284>;
  <D.18283>:
  D.18281 = __open_2 (__path, __oflag);
  return D.18281;
  <D.18284>:
  D.18281 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.18281;
}


__attribute__((visibility ("hidden")))
mono_attach_maybe_start ()
{
  int needs_to_start.3;
  int started.4;

  needs_to_start.3 = needs_to_start;
  if (needs_to_start.3 == 0) goto <D.18287>; else goto <D.18288>;
  <D.18287>:
  return;
  <D.18288>:
  needs_to_start = 0;
  started.4 = started;
  if (started.4 == 0) goto <D.18290>; else goto <D.18291>;
  <D.18290>:
  transport_start_receive ();
  started = 1;
  <D.18291>:
}


transport_start_receive ()
{
  int listen_fd.5;
  void * D.18296;
  void * receiver_thread_handle.6;
  _Bool D.18298;
  long int D.18299;
  long int D.18300;

  transport_connect ();
  listen_fd.5 = listen_fd;
  if (listen_fd.5 == 0) goto <D.18294>; else goto <D.18295>;
  <D.18294>:
  return;
  <D.18295>:
  D.18296 = mono_threads_create_thread (receiver_thread, 0B, 0, 0, 0B);
  receiver_thread_handle = D.18296;
  receiver_thread_handle.6 = receiver_thread_handle;
  D.18298 = receiver_thread_handle.6 == 0B;
  D.18299 = (long int) D.18298;
  D.18300 = __builtin_expect (D.18299, 0);
  if (D.18300 != 0) goto <D.18301>; else goto <D.18302>;
  <D.18301>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 482, "receiver_thread_handle");
  <D.18302>:
}


receiver_thread (void * arg)
{
  char * server_uri.7;
  int listen_fd.8;
  union 
{
  struct sockaddr * restrict __sockaddr__;
  struct sockaddr_at * restrict __sockaddr_at__;
  struct sockaddr_ax25 * restrict __sockaddr_ax25__;
  struct sockaddr_dl * restrict __sockaddr_dl__;
  struct sockaddr_eon * restrict __sockaddr_eon__;
  struct sockaddr_in * restrict __sockaddr_in__;
  struct sockaddr_in6 * restrict __sockaddr_in6__;
  struct sockaddr_inarp * restrict __sockaddr_inarp__;
  struct sockaddr_ipx * restrict __sockaddr_ipx__;
  struct sockaddr_iso * restrict __sockaddr_iso__;
  struct sockaddr_ns * restrict __sockaddr_ns__;
  struct sockaddr_un * restrict __sockaddr_un__;
  struct sockaddr_x25 * restrict __sockaddr_x25__;
} D.18306;
  int D.18307;
  int conn_fd.9;
  guint32 D.18311;
  struct MonoDomain * D.18312;
  struct MonoInternalThread * D.18313;
  unsigned int D.18314;
  unsigned int D.18315;
  long int D.18316;
  int * D.18319;
  int D.18320;
  int stop_receiver_thread.10;
  long unsigned int D.18329;
  int D.18332;
  int D.18335;
  unsigned char D.18337;
  unsigned char D.18339;
  struct _IO_FILE * stderr.11;
  long int D.18341;
  guint8 * p.12;
  long unsigned int D.18344;
  long unsigned int D.18345;
  long int D.18346;
  sizetype D.18347;
  int D.18349;
  _Bool D.18350;
  long int D.18351;
  long int D.18352;
  struct MonoDomain * D.18355;
  int res;
  int content_len;
  guint8 buffer[256];
  guint8 * p;
  guint8 * p_end;
  struct MonoObject * exc;

  try
    {
      server_uri.7 = server_uri;
      printf ("attach: Listening on \'%s\'...\n", server_uri.7);
      <D.18232>:
      listen_fd.8 = listen_fd;
      D.18306.__sockaddr__ = 0B;
      D.18307 = accept (listen_fd.8, D.18306, 0B);
      conn_fd = D.18307;
      conn_fd.9 = conn_fd;
      if (conn_fd.9 == -1) goto <D.18309>; else goto <D.18310>;
      <D.18309>:
      D.18311 = 0;
      return D.18311;
      <D.18310>:
      printf ("attach: Connected.\n");
      D.18312 = mono_get_root_domain ();
      mono_thread_attach (D.18312);
      D.18313 = mono_thread_internal_current ();
      D.18314 = D.18313->state;
      D.18315 = D.18314 | 4;
      D.18313->state = D.18315;
      <D.18230>:
      {
        char * cmd;
        char * agent_name;
        char * agent_args;
        guint8 * body;

        conn_fd.9 = conn_fd;
        D.18316 = read (conn_fd.9, &buffer, 6);
        res = (int) D.18316;
        if (res == -1) goto <D.18317>; else goto <D.18318>;
        <D.18317>:
        D.18319 = __errno_location ();
        D.18320 = *D.18319;
        if (D.18320 == 4) goto <D.18321>; else goto <D.18322>;
        <D.18321>:
        // predicted unlikely by continue predictor.
        goto <D.18228>;
        <D.18322>:
        <D.18318>:
        if (res == -1) goto <D.18229>; else goto <D.18323>;
        <D.18323>:
        stop_receiver_thread.10 = stop_receiver_thread;
        if (stop_receiver_thread.10 != 0) goto <D.18229>; else goto <D.18325>;
        <D.18325>:
        if (res != 6) goto <D.18229>; else goto <D.18326>;
        <D.18326>:
        D.18329 = __strlen_g ("MONO");
        if (D.18329 <= 3) goto <D.18330>; else goto <D.18331>;
        <D.18330>:
        D.18332 = strcmp (&buffer, "MONO");
        if (D.18332 != 0) goto <D.18327>; else goto <D.18333>;
        <D.18333>:
        goto <D.18334>;
        <D.18331>:
        D.18335 = strncmp (&buffer, "MONO", 4);
        if (D.18335 != 0) goto <D.18327>; else goto <D.18336>;
        <D.18336>:
        <D.18334>:
        D.18337 = buffer[4];
        if (D.18337 != 1) goto <D.18327>; else goto <D.18338>;
        <D.18338>:
        D.18339 = buffer[5];
        if (D.18339 != 0) goto <D.18327>; else goto <D.18328>;
        <D.18327>:
        stderr.11 = stderr;
        fprintf (stderr.11, "attach: message from server has unknown header.\n");
        goto <D.18229>;
        <D.18328>:
        conn_fd.9 = conn_fd;
        D.18341 = read (conn_fd.9, &buffer, 4);
        res = (int) D.18341;
        if (res != 4) goto <D.18229>; else goto <D.18342>;
        <D.18342>:
        p = &buffer;
        p.12 = p;
        p_end = p.12 + 8;
        p.12 = p;
        content_len = decode_int (p.12, &p, p_end);
        D.18344 = (long unsigned int) content_len;
        body = monoeg_malloc (D.18344);
        conn_fd.9 = conn_fd;
        D.18345 = (long unsigned int) content_len;
        D.18346 = read (conn_fd.9, body, D.18345);
        res = (int) D.18346;
        p = body;
        D.18347 = (sizetype) content_len;
        p_end = body + D.18347;
        p.12 = p;
        cmd = decode_string_value (p.12, &p, p_end);
        if (cmd == 0B) goto <D.18229>; else goto <D.18348>;
        <D.18348>:
        D.18349 = strcmp (cmd, "attach");
        D.18350 = D.18349 != 0;
        D.18351 = (long int) D.18350;
        D.18352 = __builtin_expect (D.18351, 0);
        if (D.18352 != 0) goto <D.18353>; else goto <D.18354>;
        <D.18353>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 550, "!strcmp (cmd, \"attach\")");
        <D.18354>:
        p.12 = p;
        agent_name = decode_string_value (p.12, &p, p_end);
        p.12 = p;
        agent_args = decode_string_value (p.12, &p, p_end);
        printf ("attach: Loading agent \'%s\'.\n", agent_name);
        D.18355 = mono_domain_get ();
        mono_attach_load_agent (D.18355, agent_name, agent_args, &exc);
        monoeg_g_free (body);
      }
      <D.18228>:
      goto <D.18230>;
      <D.18229>:
      conn_fd.9 = conn_fd;
      close (conn_fd.9);
      conn_fd = 0;
      printf ("attach: Disconnected.\n");
      stop_receiver_thread.10 = stop_receiver_thread;
      if (stop_receiver_thread.10 != 0) goto <D.18231>; else goto <D.18356>;
      <D.18356>:
      goto <D.18232>;
      <D.18231>:
      D.18311 = 0;
      return D.18311;
    }
  finally
    {
      buffer = {CLOBBER};
      p = {CLOBBER};
      exc = {CLOBBER};
    }
}


__attribute__((__gnu_inline__))
__strlen_g (const char * __str)
{
  size_t D.18359;
  long int __ptr.13;
  long int __str.14;
  long int D.18362;
  char * __ptr;
  char * __tmp;

  __ptr = 0B;
  __tmp = __str;
  __asm__ __volatile__("   la    0,0
0: srst  %0,%1
   jo    0b
" : "=&a" __ptr, "=&a" __tmp : "0" __ptr, "1" __tmp : "0", "memory", "cc");
  __ptr.13 = (long int) __ptr;
  __str.14 = (long int) __str;
  D.18362 = __ptr.13 - __str.14;
  D.18359 = (size_t) D.18362;
  return D.18359;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
fprintf (struct FILE * restrict __stream, const char * restrict __fmt)
{
  int D.18364;

  D.18364 = __fprintf_chk (__stream, 1, __fmt, __builtin_va_arg_pack ());
  return D.18364;
}


decode_int (guint8 * buf, guint8 * * endbuf, guint8 * limit)
{
  guint8 * D.18366;
  guint8 * D.18367;
  _Bool D.18368;
  long int D.18369;
  long int D.18370;
  int D.18373;
  unsigned char D.18374;
  int D.18375;
  guint8 * D.18376;
  unsigned char D.18377;
  int D.18378;
  int D.18379;
  int D.18380;
  guint8 * D.18381;
  unsigned char D.18382;
  int D.18383;
  int D.18384;
  int D.18385;
  guint8 * D.18386;
  unsigned char D.18387;
  int D.18388;
  int D.18389;

  D.18366 = buf + 4;
  *endbuf = D.18366;
  D.18367 = *endbuf;
  D.18368 = D.18367 > limit;
  D.18369 = (long int) D.18368;
  D.18370 = __builtin_expect (D.18369, 0);
  if (D.18370 != 0) goto <D.18371>; else goto <D.18372>;
  <D.18371>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 126, "*endbuf <= limit");
  <D.18372>:
  D.18374 = *buf;
  D.18375 = (int) D.18374;
  D.18376 = buf + 1;
  D.18377 = *D.18376;
  D.18378 = (int) D.18377;
  D.18379 = D.18378 << 8;
  D.18380 = D.18375 | D.18379;
  D.18381 = buf + 2;
  D.18382 = *D.18381;
  D.18383 = (int) D.18382;
  D.18384 = D.18383 << 16;
  D.18385 = D.18380 | D.18384;
  D.18386 = buf + 3;
  D.18387 = *D.18386;
  D.18388 = (int) D.18387;
  D.18389 = D.18388 << 24;
  D.18373 = D.18385 | D.18389;
  return D.18373;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
read (int __fd, void * __buf, size_t __nbytes)
{
  long unsigned int D.18391;
  int D.18394;
  ssize_t D.18397;
  long unsigned int D.18398;
  long unsigned int D.18399;
  long unsigned int D.18402;

  D.18391 = __builtin_object_size (__buf, 0);
  if (D.18391 != 18446744073709551615) goto <D.18392>; else goto <D.18393>;
  <D.18392>:
  D.18394 = __builtin_constant_p (__nbytes);
  if (D.18394 == 0) goto <D.18395>; else goto <D.18396>;
  <D.18395>:
  D.18398 = __builtin_object_size (__buf, 0);
  D.18397 = __read_chk (__fd, __buf, __nbytes, D.18398);
  return D.18397;
  <D.18396>:
  D.18399 = __builtin_object_size (__buf, 0);
  if (D.18399 < __nbytes) goto <D.18400>; else goto <D.18401>;
  <D.18400>:
  D.18402 = __builtin_object_size (__buf, 0);
  D.18397 = __read_chk_warn (__fd, __buf, __nbytes, D.18402);
  return D.18397;
  <D.18401>:
  <D.18393>:
  D.18397 = __read_alias (__fd, __buf, __nbytes);
  return D.18397;
}


decode_string_value (guint8 * buf, guint8 * * endbuf, guint8 * limit)
{
  guint8 * p.15;
  char * D.18407;
  _Bool D.18408;
  long int D.18409;
  long int D.18410;
  int D.18413;
  int D.18414;
  signed char b.16;
  _Bool D.18417;
  long int D.18418;
  long int D.18419;
  int D.18422;
  long unsigned int D.18423;
  sizetype D.18424;
  guint8 * p.17;
  _Bool D.18426;
  long int D.18427;
  long int D.18428;
  long unsigned int D.18431;
  char * D.18432;
  int type;
  gint32 length;
  guint8 * p;
  char * s;

  try
    {
      p = buf;
      p.15 = p;
      type = decode_byte (p.15, &p, limit);
      if (type == 17) goto <D.18405>; else goto <D.18406>;
      <D.18405>:
      p.15 = p;
      *endbuf = p.15;
      D.18407 = 0B;
      return D.18407;
      <D.18406>:
      D.18408 = type != 18;
      D.18409 = (long int) D.18408;
      D.18410 = __builtin_expect (D.18409, 0);
      if (D.18410 != 0) goto <D.18411>; else goto <D.18412>;
      <D.18411>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 153, "type == PRIM_TYPE_STRING");
      <D.18412>:
      length = 0;
      <D.18164>:
      {
        guint8 b;

        p.15 = p;
        D.18413 = decode_byte (p.15, &p, limit);
        b = (guint8) D.18413;
        length = length << 8;
        D.18414 = (int) b;
        length = D.18414 + length;
        b.16 = (signed char) b;
        if (b.16 >= 0) goto <D.18163>; else goto <D.18416>;
        <D.18416>:
      }
      goto <D.18164>;
      <D.18163>:
      D.18417 = length > 65535;
      D.18418 = (long int) D.18417;
      D.18419 = __builtin_expect (D.18418, 0);
      if (D.18419 != 0) goto <D.18420>; else goto <D.18421>;
      <D.18420>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 165, "length < (1 << 16)");
      <D.18421>:
      D.18422 = length + 1;
      D.18423 = (long unsigned int) D.18422;
      s = monoeg_malloc (D.18423);
      p.15 = p;
      D.18424 = (sizetype) length;
      p.17 = p.15 + D.18424;
      D.18426 = p.17 > limit;
      D.18427 = (long int) D.18426;
      D.18428 = __builtin_expect (D.18427, 0);
      if (D.18428 != 0) goto <D.18429>; else goto <D.18430>;
      <D.18429>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 169, "p + length <= limit");
      <D.18430>:
      p.15 = p;
      D.18431 = (long unsigned int) length;
      memcpy (s, p.15, D.18431);
      D.18424 = (sizetype) length;
      D.18432 = s + D.18424;
      *D.18432 = 0;
      p.15 = p;
      D.18424 = (sizetype) length;
      p.17 = p.15 + D.18424;
      p = p.17;
      p.15 = p;
      *endbuf = p.15;
      D.18407 = s;
      return D.18407;
    }
  finally
    {
      p = {CLOBBER};
    }
}


decode_byte (guint8 * buf, guint8 * * endbuf, guint8 * limit)
{
  guint8 * D.18435;
  guint8 * D.18436;
  _Bool D.18437;
  long int D.18438;
  long int D.18439;
  int D.18442;
  unsigned char D.18443;

  D.18435 = buf + 1;
  *endbuf = D.18435;
  D.18436 = *endbuf;
  D.18437 = D.18436 > limit;
  D.18438 = (long int) D.18437;
  D.18439 = __builtin_expect (D.18438, 0);
  if (D.18439 != 0) goto <D.18440>; else goto <D.18441>;
  <D.18440>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 118, "*endbuf <= limit");
  <D.18441>:
  D.18443 = *buf;
  D.18442 = (int) D.18443;
  return D.18442;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.18445;
  long unsigned int D.18446;

  D.18446 = __builtin_object_size (__dest, 0);
  D.18445 = __builtin___memcpy_chk (__dest, __src, __len, D.18446);
  return D.18445;
}


mono_attach_load_agent (struct MonoDomain * domain, char * agent, char * args, struct MonoObject * * exc)
{
  struct _IO_FILE * stderr.18;
  <unnamed type> open_status.19;
  const char * D.18452;
  int D.18453;
  const char * D.18456;
  struct MonoClass * D.18461;
  struct MonoString * D.18462;
  struct MonoAssembly * agent_assembly;
  struct MonoImage * image;
  struct MonoMethod * method;
  guint32 entry;
  struct MonoArray * main_args;
  void * pa[1];
  MonoImageOpenStatus open_status;

  try
    {
      agent_assembly = mono_assembly_open (agent, &open_status);
      if (agent_assembly == 0B) goto <D.18448>; else goto <D.18449>;
      <D.18448>:
      stderr.18 = stderr;
      open_status.19 = open_status;
      D.18452 = mono_image_strerror (open_status.19);
      fprintf (stderr.18, "Cannot open agent assembly \'%s\': %s.\n", agent, D.18452);
      monoeg_g_free (agent);
      D.18453 = 2;
      return D.18453;
      <D.18449>:
      image = mono_assembly_get_image (agent_assembly);
      entry = mono_image_get_entry_point (image);
      if (entry == 0) goto <D.18454>; else goto <D.18455>;
      <D.18454>:
      D.18456 = mono_image_get_filename (image);
      monoeg_g_print ("Assembly \'%s\' doesn\'t have an entry point.\n", D.18456);
      monoeg_g_free (agent);
      D.18453 = 1;
      return D.18453;
      <D.18455>:
      method = mono_get_method (image, entry, 0B);
      if (method == 0B) goto <D.18457>; else goto <D.18458>;
      <D.18457>:
      monoeg_g_print ("The entry point method of assembly \'%s\' could not be loaded\n", agent);
      monoeg_g_free (agent);
      D.18453 = 1;
      return D.18453;
      <D.18458>:
      if (args != 0B) goto <D.18459>; else goto <D.18460>;
      <D.18459>:
      D.18461 = mono_defaults.string_class;
      main_args = mono_array_new (domain, D.18461, 1);
      {
        struct MonoString * * __p;

        __p = mono_array_addr_with_size (main_args, 8, 0);
        D.18462 = mono_string_new (domain, args);
        *__p = D.18462;
      }
      goto <D.18463>;
      <D.18460>:
      D.18461 = mono_defaults.string_class;
      main_args = mono_array_new (domain, D.18461, 0);
      <D.18463>:
      monoeg_g_free (agent);
      pa[0] = main_args;
      mono_runtime_invoke (method, 0B, &pa, exc);
      D.18453 = 0;
      return D.18453;
    }
  finally
    {
      pa = {CLOBBER};
      open_status = {CLOBBER};
    }
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
printf (const char * restrict __fmt)
{
  int D.18466;

  D.18466 = __printf_chk (1, __fmt, __builtin_va_arg_pack ());
  return D.18466;
}


transport_connect ()
{
  ipc_connect ();
}


ipc_connect ()
{
  unsigned int D.18468;
  unsigned int D.18469;
  struct _IO_FILE * stderr.20;
  unsigned int D.18475;
  struct passwd * pw.21;
  _Bool D.18479;
  long int D.18480;
  long int D.18481;
  char * D.18484;
  int * D.18487;
  int D.18488;
  unsigned int D.18493;
  unsigned int D.18494;
  unsigned int D.18497;
  unsigned int D.18498;
  long unsigned int D.18501;
  long unsigned int D.18502;
  int D.18506;
  long unsigned int D.18507;
  union 
{
  const struct sockaddr * restrict __sockaddr__;
  const struct sockaddr_at * restrict __sockaddr_at__;
  const struct sockaddr_ax25 * restrict __sockaddr_ax25__;
  const struct sockaddr_dl * restrict __sockaddr_dl__;
  const struct sockaddr_eon * restrict __sockaddr_eon__;
  const struct sockaddr_in * restrict __sockaddr_in__;
  const struct sockaddr_in6 * restrict __sockaddr_in6__;
  const struct sockaddr_inarp * restrict __sockaddr_inarp__;
  const struct sockaddr_ipx * restrict __sockaddr_ipx__;
  const struct sockaddr_iso * restrict __sockaddr_iso__;
  const struct sockaddr_ns * restrict __sockaddr_ns__;
  const struct sockaddr_un * restrict __sockaddr_un__;
  const struct sockaddr_x25 * restrict __sockaddr_x25__;
} D.18508;
  unsigned int D.18509;
  int D.18510;
  char * D.18513;
  char * D.18518;
  gchar * D.18519;
  int D.18520;
  gchar * D.18521;
  struct sockaddr_un name;
  int sock;
  int res;
  size_t size;
  char * filename;
  char * directory;
  struct stat stat;
  struct passwd pwbuf;
  char buf[1024];
  struct passwd * pw;

  try
    {
      D.18468 = getuid ();
      D.18469 = geteuid ();
      if (D.18468 != D.18469) goto <D.18470>; else goto <D.18471>;
      <D.18470>:
      stderr.20 = stderr;
      fprintf (stderr.20, "attach: disabled listening on an IPC socket when running in setuid mode.\n");
      return;
      <D.18471>:
      sock = socket (1, 1, 0);
      if (sock < 0) goto <D.18473>; else goto <D.18474>;
      <D.18473>:
      perror ("attach: failed to create IPC socket");
      return;
      <D.18474>:
      pw = 0B;
      D.18475 = getuid ();
      res = getpwuid_r (D.18475, &pwbuf, &buf, 1024, &pw);
      if (res != 0) goto <D.18476>; else goto <D.18477>;
      <D.18476>:
      stderr.20 = stderr;
      fprintf (stderr.20, "attach: getpwuid_r () failed.\n");
      return;
      <D.18477>:
      pw.21 = pw;
      D.18479 = pw.21 == 0B;
      D.18480 = (long int) D.18479;
      D.18481 = __builtin_expect (D.18480, 0);
      if (D.18481 != 0) goto <D.18482>; else goto <D.18483>;
      <D.18482>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "attach.c", 379, "pw");
      <D.18483>:
      pw.21 = pw;
      D.18484 = pw.21->pw_name;
      directory = monoeg_g_strdup_printf ("/tmp/mono-%s", D.18484);
      res = mkdir (directory, 448);
      if (res != 0) goto <D.18485>; else goto <D.18486>;
      <D.18485>:
      D.18487 = __errno_location ();
      D.18488 = *D.18487;
      if (D.18488 == 17) goto <D.18489>; else goto <D.18490>;
      <D.18489>:
      res = lstat (directory, &stat);
      if (res != 0) goto <D.18491>; else goto <D.18492>;
      <D.18491>:
      perror ("attach: lstat () failed");
      return;
      <D.18492>:
      D.18493 = stat.st_mode;
      D.18494 = D.18493 & 61440;
      if (D.18494 != 16384) goto <D.18495>; else goto <D.18496>;
      <D.18495>:
      stderr.20 = stderr;
      fprintf (stderr.20, "attach: path \'%s\' is not a directory.\n", directory);
      return;
      <D.18496>:
      D.18497 = stat.st_uid;
      D.18498 = getuid ();
      if (D.18497 != D.18498) goto <D.18499>; else goto <D.18500>;
      <D.18499>:
      stderr.20 = stderr;
      fprintf (stderr.20, "attach: directory \'%s\' is not owned by the current user.\n", directory);
      return;
      <D.18500>:
      D.18501 = BIT_FIELD_REF <stat, 64, 192>;
      D.18502 = D.18501 & 2194728288256;
      if (D.18502 != 1924145348608) goto <D.18503>; else goto <D.18504>;
      <D.18503>:
      stderr.20 = stderr;
      fprintf (stderr.20, "attach: directory \'%s\' should have protection 0700.\n", directory);
      return;
      <D.18504>:
      goto <D.18505>;
      <D.18490>:
      perror ("attach: mkdir () failed");
      return;
      <D.18505>:
      <D.18486>:
      D.18506 = getpid ();
      filename = monoeg_g_strdup_printf ("%s/.mono-%d", directory, D.18506);
      unlink (filename);
      name.sun_family = 1;
      strcpy (&name.sun_path, filename);
      D.18507 = __strlen_g (&name.sun_path);
      size = D.18507 + 3;
      D.18508.__sockaddr__ = &name;
      D.18509 = (unsigned int) size;
      D.18510 = bind (sock, D.18508, D.18509);
      if (D.18510 < 0) goto <D.18511>; else goto <D.18512>;
      <D.18511>:
      stderr.20 = stderr;
      D.18487 = __errno_location ();
      D.18488 = *D.18487;
      D.18513 = strerror (D.18488);
      fprintf (stderr.20, "attach: failed to bind IPC socket \'%s\': %s\n", filename, D.18513);
      close (sock);
      return;
      <D.18512>:
      res = chmod (filename, 384);
      if (res != 0) goto <D.18514>; else goto <D.18515>;
      <D.18514>:
      perror ("attach: failed to set permissions on IPC socket");
      close (sock);
      unlink (filename);
      return;
      <D.18515>:
      res = listen (sock, 16);
      if (res != 0) goto <D.18516>; else goto <D.18517>;
      <D.18516>:
      stderr.20 = stderr;
      D.18487 = __errno_location ();
      D.18488 = *D.18487;
      D.18518 = strerror (D.18488);
      fprintf (stderr.20, "attach: listen () failed: %s\n", D.18518);
      exit (1);
      <D.18517>:
      listen_fd = sock;
      D.18519 = monoeg_strdup (filename);
      ipc_filename = D.18519;
      D.18520 = getpid ();
      D.18521 = monoeg_g_strdup_printf ("unix://%s/.mono-%d?/vm", directory, D.18520);
      server_uri = D.18521;
      monoeg_g_free (filename);
      monoeg_g_free (directory);
    }
  finally
    {
      name = {CLOBBER};
      stat = {CLOBBER};
      pwbuf = {CLOBBER};
      buf = {CLOBBER};
      pw = {CLOBBER};
    }
}


__attribute__((__gnu_inline__, __leaf__, __nothrow__))
lstat (const char * __path, struct stat * __statbuf)
{
  int D.18525;

  D.18525 = __lxstat (1, __path, __statbuf);
  return D.18525;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
strcpy (char * restrict __dest, const char * restrict __src)
{
  char * D.18527;
  long unsigned int D.18528;

  D.18528 = __builtin_object_size (__dest, 1);
  D.18527 = __builtin___strcpy_chk (__dest, __src, D.18528);
  return D.18527;
}


monoeg_strdup (const gchar * str)
{
  gchar * D.18532;

  if (str != 0B) goto <D.18530>; else goto <D.18531>;
  <D.18530>:
  D.18532 = __strdup (str);
  return D.18532;
  <D.18531>:
  D.18532 = 0B;
  return D.18532;
}


__attribute__((visibility ("hidden")))
mono_attach_cleanup ()
{
  int listen_fd.22;
  char * ipc_filename.23;
  int conn_fd.24;
  void * receiver_thread_handle.25;

  listen_fd.22 = listen_fd;
  if (listen_fd.22 != 0) goto <D.18535>; else goto <D.18536>;
  <D.18535>:
  listen_fd.22 = listen_fd;
  close (listen_fd.22);
  <D.18536>:
  ipc_filename.23 = ipc_filename;
  if (ipc_filename.23 != 0B) goto <D.18538>; else goto <D.18539>;
  <D.18538>:
  ipc_filename.23 = ipc_filename;
  unlink (ipc_filename.23);
  <D.18539>:
  stop_receiver_thread = 1;
  conn_fd.24 = conn_fd;
  if (conn_fd.24 != 0) goto <D.18541>; else goto <D.18542>;
  <D.18541>:
  conn_fd.24 = conn_fd;
  close (conn_fd.24);
  <D.18542>:
  receiver_thread_handle.25 = receiver_thread_handle;
  if (receiver_thread_handle.25 != 0B) goto <D.18544>; else goto <D.18545>;
  <D.18544>:
  receiver_thread_handle.25 = receiver_thread_handle;
  WaitForSingleObjectEx (receiver_thread_handle.25, 0, 0);
  <D.18545>:
}


