mono_profiler_startup (const char * desc)
{
  struct GHashTable * D.7426;
  struct MonoProfiler * prof;

  prof = monoeg_malloc0 (4);
  D.7426 = monoeg_g_hash_table_new (0B, 0B);
  prof->images = D.7426;
  mono_profiler_install (prof, prof_shutdown);
  mono_profiler_install_jit_compile (prof_jit_enter, prof_jit_leave);
  mono_profiler_set_events (16);
}


prof_jit_leave (struct MonoProfiler * prof, struct MonoMethod * method, int result)
{
  struct MonoClass * D.7429;
  struct GHashTable * D.7430;
  struct GList * D.7433;
  struct GList * D.7434;
  struct MonoImage * image;
  struct PerImageData * data;

  D.7429 = mono_method_get_class (method);
  image = mono_class_get_image (D.7429);
  D.7430 = prof->images;
  data = monoeg_g_hash_table_lookup (D.7430, image);
  if (data == 0B) goto <D.7431>; else goto <D.7432>;
  <D.7431>:
  data = monoeg_malloc0 (4);
  D.7430 = prof->images;
  monoeg_g_hash_table_insert_replace (D.7430, image, data, 0);
  <D.7432>:
  D.7433 = data->methods;
  D.7434 = monoeg_g_list_append (D.7433, method);
  data->methods = D.7434;
}


prof_jit_enter (struct MonoProfiler * prof, struct MonoMethod * method)
{

}


prof_shutdown (struct MonoProfiler * prof)
{
  struct GHashTable * D.7440;

  D.7440 = prof->images;
  monoeg_g_hash_table_foreach (D.7440, output_image, prof);
}


output_image (void * key, void * value, void * user_data)
{
  const gchar * D.7441;
  int D.7442;
  struct _IO_FILE * stderr.0;
  int * D.7448;
  int D.7449;
  const gchar * D.7450;
  const char * D.7451;
  int D.7452;
  _Bool D.7454;
  long int D.7455;
  long int D.7456;
  struct GList * D.7459;
  struct MonoImage * image;
  struct PerImageData * image_data;
  struct MonoProfiler * prof;
  char * tmp;
  char * outfile_name;
  struct FILE * outfile;
  int i;
  int err;
  struct ForeachData data;

  try
    {
      image = key;
      image_data = value;
      prof = user_data;
      D.7441 = monoeg_g_get_home_dir ();
      tmp = monoeg_g_strdup_printf ("%s/.mono/aot-profile-data", D.7441);
      D.7442 = monoeg_g_file_test (tmp, 4);
      if (D.7442 == 0) goto <D.7443>; else goto <D.7444>;
      <D.7443>:
      err = mkdir (tmp, 511);
      if (err != 0) goto <D.7445>; else goto <D.7446>;
      <D.7445>:
      stderr.0 = stderr;
      D.7448 = __errno_location ();
      D.7449 = *D.7448;
      D.7450 = monoeg_g_strerror (D.7449);
      fprintf (stderr.0, "mono-profiler-aot: Unable to create output directory \'%s\': %s\n", tmp, D.7450);
      exit (1);
      <D.7446>:
      <D.7444>:
      i = 0;
      <D.7404>:
      D.7451 = mono_image_get_name (image);
      outfile_name = monoeg_g_strdup_printf ("%s/%s-%d", tmp, D.7451, i);
      D.7452 = monoeg_g_file_test (outfile_name, 1);
      if (D.7452 == 0) goto <D.7403>; else goto <D.7453>;
      <D.7453>:
      i = i + 1;
      goto <D.7404>;
      <D.7403>:
      printf ("Creating output file: %s\n", outfile_name);
      outfile = fopen (outfile_name, "w+");
      D.7454 = outfile == 0B;
      D.7455 = (long int) D.7454;
      D.7456 = __builtin_expect (D.7455, 0);
      if (D.7456 != 0) goto <D.7457>; else goto <D.7458>;
      <D.7457>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-profiler-aot.c", 98, "outfile");
      <D.7458>:
      fprintf (outfile, "#VER:%d\n", 2);
      data.prof = prof;
      data.outfile = outfile;
      data.image = image;
      D.7459 = image_data->methods;
      monoeg_g_list_foreach (D.7459, foreach_method, &data);
    }
  finally
    {
      data = {CLOBBER};
    }
}


foreach_method (void * data, void * user_data)
{
  unsigned int D.7472;
  struct MonoClass * D.7474;
  struct MonoImage * D.7475;
  struct MonoImage * D.7476;
  struct FILE * D.7477;
  struct ForeachData * udata;
  struct MonoMethod * method;
  char * name;

  udata = user_data;
  method = data;
  D.7472 = mono_method_get_token (method);
  if (D.7472 == 0) goto <D.7470>; else goto <D.7473>;
  <D.7473>:
  D.7474 = mono_method_get_class (method);
  D.7475 = mono_class_get_image (D.7474);
  D.7476 = udata->image;
  if (D.7475 != D.7476) goto <D.7470>; else goto <D.7471>;
  <D.7470>:
  return;
  <D.7471>:
  name = mono_method_full_name (method, 1);
  D.7477 = udata->outfile;
  fprintf (D.7477, "%s\n", name);
  monoeg_g_free (name);
}


printf (const char * restrict __fmt)
{
  int D.7483;

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


fprintf (struct FILE * restrict __stream, const char * restrict __fmt)
{
  int D.7486;

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


