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

  prof = monoeg_malloc0 (8);
  D.7752 = monoeg_g_hash_table_new (0B, 0B);
  prof->images = D.7752;
  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.7755;
  struct GHashTable * D.7756;
  struct GList * D.7759;
  struct GList * D.7760;
  struct MonoImage * image;
  struct PerImageData * data;

  D.7755 = mono_method_get_class (method);
  image = mono_class_get_image (D.7755);
  D.7756 = prof->images;
  data = monoeg_g_hash_table_lookup (D.7756, image);
  if (data == 0B) goto <D.7757>; else goto <D.7758>;
  <D.7757>:
  data = monoeg_malloc0 (8);
  D.7756 = prof->images;
  monoeg_g_hash_table_insert_replace (D.7756, image, data, 0);
  <D.7758>:
  D.7759 = data->methods;
  D.7760 = monoeg_g_list_append (D.7759, method);
  data->methods = D.7760;
}


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

}


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

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


output_image (void * key, void * value, void * user_data)
{
  const gchar * D.7767;
  int D.7768;
  int * D.7773;
  int D.7774;
  const gchar * D.7775;
  struct _IO_FILE * stderr.0;
  const char * D.7777;
  int D.7778;
  _Bool D.7780;
  long int D.7781;
  long int D.7782;
  struct GList * D.7785;
  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.7767 = monoeg_g_get_home_dir ();
      tmp = monoeg_g_strdup_printf ("%s/.mono/aot-profile-data", D.7767);
      D.7768 = monoeg_g_file_test (tmp, 4);
      if (D.7768 == 0) goto <D.7769>; else goto <D.7770>;
      <D.7769>:
      err = mkdir (tmp, 511);
      if (err != 0) goto <D.7771>; else goto <D.7772>;
      <D.7771>:
      D.7773 = __errno_location ();
      D.7774 = *D.7773;
      D.7775 = monoeg_g_strerror (D.7774);
      stderr.0 = stderr;
      fprintf (stderr.0, "mono-profiler-aot: Unable to create output directory \'%s\': %s\n", tmp, D.7775);
      exit (1);
      <D.7772>:
      <D.7770>:
      i = 0;
      <D.7730>:
      D.7777 = mono_image_get_name (image);
      outfile_name = monoeg_g_strdup_printf ("%s/%s-%d", tmp, D.7777, i);
      D.7778 = monoeg_g_file_test (outfile_name, 1);
      if (D.7778 == 0) goto <D.7729>; else goto <D.7779>;
      <D.7779>:
      i = i + 1;
      goto <D.7730>;
      <D.7729>:
      printf ("Creating output file: %s\n", outfile_name);
      outfile = fopen (outfile_name, "w+");
      D.7780 = outfile == 0B;
      D.7781 = (long int) D.7780;
      D.7782 = __builtin_expect (D.7781, 0);
      if (D.7782 != 0) goto <D.7783>; else goto <D.7784>;
      <D.7783>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-profiler-aot.c", 98, "outfile");
      <D.7784>:
      fprintf (outfile, "#VER:%d\n", 2);
      data.prof = prof;
      data.outfile = outfile;
      data.image = image;
      D.7785 = image_data->methods;
      monoeg_g_list_foreach (D.7785, foreach_method, &data);
    }
  finally
    {
      data = {CLOBBER};
    }
}


foreach_method (void * data, void * user_data)
{
  unsigned int D.7798;
  struct MonoClass * D.7800;
  struct MonoImage * D.7801;
  struct MonoImage * D.7802;
  struct FILE * D.7803;
  struct ForeachData * udata;
  struct MonoMethod * method;
  char * name;

  udata = user_data;
  method = data;
  D.7798 = mono_method_get_token (method);
  if (D.7798 == 0) goto <D.7796>; else goto <D.7799>;
  <D.7799>:
  D.7800 = mono_method_get_class (method);
  D.7801 = mono_class_get_image (D.7800);
  D.7802 = udata->image;
  if (D.7801 != D.7802) goto <D.7796>; else goto <D.7797>;
  <D.7796>:
  return;
  <D.7797>:
  name = mono_method_full_name (method, 1);
  D.7803 = udata->outfile;
  fprintf (D.7803, "%s\n", name);
  monoeg_g_free (name);
}


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

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


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

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


