mono_class_get_interop_proxy_class ()
{
  struct MonoImage * D.19656;
  _Bool D.19657;
  long int D.19658;
  long int D.19659;
  struct MonoClass * D.19662;
  static struct MonoClass * tmp_class;
  struct MonoClass * class;

  class = tmp_class;
  if (class == 0B) goto <D.19654>; else goto <D.19655>;
  <D.19654>:
  D.19656 = mono_defaults.corlib;
  class = mono_class_from_name (D.19656, "Mono.Interop", "ComInteropProxy");
  D.19657 = class == 0B;
  D.19658 = (long int) D.19657;
  D.19659 = __builtin_expect (D.19658, 0);
  if (D.19659 != 0) goto <D.19660>; else goto <D.19661>;
  <D.19660>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 88, "class");
  <D.19661>:
  mono_memory_barrier ();
  tmp_class = class;
  <D.19655>:
  D.19662 = class;
  return D.19662;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


mono_class_get_idispatch_class ()
{
  struct MonoImage * D.19666;
  _Bool D.19667;
  long int D.19668;
  long int D.19669;
  struct MonoClass * D.19672;
  static struct MonoClass * tmp_class;
  struct MonoClass * class;

  class = tmp_class;
  if (class == 0B) goto <D.19664>; else goto <D.19665>;
  <D.19664>:
  D.19666 = mono_defaults.corlib;
  class = mono_class_from_name (D.19666, "Mono.Interop", "IDispatch");
  D.19667 = class == 0B;
  D.19668 = (long int) D.19667;
  D.19669 = __builtin_expect (D.19668, 0);
  if (D.19669 != 0) goto <D.19670>; else goto <D.19671>;
  <D.19670>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 89, "class");
  <D.19671>:
  mono_memory_barrier ();
  tmp_class = class;
  <D.19665>:
  D.19672 = class;
  return D.19672;
}


mono_class_get_iunknown_class ()
{
  struct MonoImage * D.19676;
  _Bool D.19677;
  long int D.19678;
  long int D.19679;
  struct MonoClass * D.19682;
  static struct MonoClass * tmp_class;
  struct MonoClass * class;

  class = tmp_class;
  if (class == 0B) goto <D.19674>; else goto <D.19675>;
  <D.19674>:
  D.19676 = mono_defaults.corlib;
  class = mono_class_from_name (D.19676, "Mono.Interop", "IUnknown");
  D.19677 = class == 0B;
  D.19678 = (long int) D.19677;
  D.19679 = __builtin_expect (D.19678, 0);
  if (D.19679 != 0) goto <D.19680>; else goto <D.19681>;
  <D.19680>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 90, "class");
  <D.19681>:
  mono_memory_barrier ();
  tmp_class = class;
  <D.19675>:
  D.19682 = class;
  return D.19682;
}


mono_class_get_com_object_class ()
{
  struct MonoImage * D.19686;
  _Bool D.19687;
  long int D.19688;
  long int D.19689;
  struct MonoClass * D.19692;
  static struct MonoClass * tmp_class;
  struct MonoClass * class;

  class = tmp_class;
  if (class == 0B) goto <D.19684>; else goto <D.19685>;
  <D.19684>:
  D.19686 = mono_defaults.corlib;
  class = mono_class_from_name (D.19686, "System", "__ComObject");
  D.19687 = class == 0B;
  D.19688 = (long int) D.19687;
  D.19689 = __builtin_expect (D.19688, 0);
  if (D.19689 != 0) goto <D.19690>; else goto <D.19691>;
  <D.19690>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 92, "class");
  <D.19691>:
  mono_memory_barrier ();
  tmp_class = class;
  <D.19685>:
  D.19692 = class;
  return D.19692;
}


mono_class_get_variant_class ()
{
  struct MonoImage * D.19696;
  _Bool D.19697;
  long int D.19698;
  long int D.19699;
  struct MonoClass * D.19702;
  static struct MonoClass * tmp_class;
  struct MonoClass * class;

  class = tmp_class;
  if (class == 0B) goto <D.19694>; else goto <D.19695>;
  <D.19694>:
  D.19696 = mono_defaults.corlib;
  class = mono_class_from_name (D.19696, "System", "Variant");
  D.19697 = class == 0B;
  D.19698 = (long int) D.19697;
  D.19699 = __builtin_expect (D.19698, 0);
  if (D.19699 != 0) goto <D.19700>; else goto <D.19701>;
  <D.19700>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 93, "class");
  <D.19701>:
  mono_memory_barrier ();
  tmp_class = class;
  <D.19695>:
  D.19702 = class;
  return D.19702;
}


__attribute__((visibility ("hidden")))
mono_cominterop_init ()
{
  int D.19706;
  const char * com_provider_env;

  InitializeCriticalSection (&cominterop_mutex);
  com_provider_env = monoeg_g_getenv ("MONO_COM");
  if (com_provider_env != 0B) goto <D.19704>; else goto <D.19705>;
  <D.19704>:
  D.19706 = strcmp (com_provider_env, "MS");
  if (D.19706 == 0) goto <D.19707>; else goto <D.19708>;
  <D.19707>:
  com_provider = 1;
  <D.19708>:
  <D.19705>:
  register_icall (cominterop_get_method_interface, "cominterop_get_method_interface", "ptr ptr", 0);
  register_icall (cominterop_get_function_pointer, "cominterop_get_function_pointer", "ptr ptr int32", 0);
  register_icall (cominterop_object_is_rcw, "cominterop_object_is_rcw", "int32 object", 0);
  register_icall (cominterop_get_ccw, "cominterop_get_ccw", "ptr object ptr", 0);
  register_icall (cominterop_get_ccw_object, "cominterop_get_ccw_object", "object ptr int32", 0);
  register_icall (cominterop_get_hresult_for_exception, "cominterop_get_hresult_for_exception", "int32 object", 0);
  register_icall (cominterop_get_interface, "cominterop_get_interface", "ptr object ptr int32", 0);
  register_icall (mono_string_to_bstr, "mono_string_to_bstr", "ptr obj", 0);
  register_icall (mono_string_from_bstr, "mono_string_from_bstr", "obj ptr", 0);
  register_icall (mono_free_bstr, "mono_free_bstr", "void ptr", 0);
  register_icall (cominterop_type_from_handle, "cominterop_type_from_handle", "object ptr", 0);
  register_icall (mono_marshal_safearray_begin, "mono_marshal_safearray_begin", "int32 ptr ptr ptr ptr ptr int32", 0);
  register_icall (mono_marshal_safearray_get_value, "mono_marshal_safearray_get_value", "ptr ptr ptr", 0);
  register_icall (mono_marshal_safearray_next, "mono_marshal_safearray_next", "int32 ptr ptr", 0);
  register_icall (mono_marshal_safearray_end, "mono_marshal_safearray_end", "void ptr ptr", 0);
  register_icall (mono_marshal_safearray_create, "mono_marshal_safearray_create", "int32 object ptr ptr ptr", 0);
  register_icall (mono_marshal_safearray_set_value, "mono_marshal_safearray_set_value", "void ptr ptr ptr", 0);
  register_icall (mono_marshal_safearray_free_indices, "mono_marshal_safearray_free_indices", "void ptr", 0);
}


mono_marshal_safearray_free_indices (void * indices)
{
  monoeg_g_free (indices);
}


mono_marshal_safearray_set_value (void * safearray, void * indices, void * value)
{
  <unnamed type> com_provider.0;
  int D.19713;
  int (*<T34b6>) (void *, glong *, void * *) safe_array_put_element_ms.1;

  com_provider.0 = com_provider;
  if (com_provider.0 == 1) goto <D.19712>; else goto <D.19709>;
  <D.19712>:
  D.19713 = init_com_provider_ms ();
  if (D.19713 != 0) goto <D.19714>; else goto <D.19709>;
  <D.19714>:
  {
    int hr;

    safe_array_put_element_ms.1 = safe_array_put_element_ms;
    hr = safe_array_put_element_ms.1 (safearray, indices, value);
    if (hr < 0) goto <D.19716>; else goto <D.19717>;
    <D.19716>:
    cominterop_raise_hr_exception (hr);
    <D.19717>:
  }
  goto <D.19710>;
  <D.19709>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 3154);
  <D.19710>:
}


init_com_provider_ms ()
{
  int initialized.2;
  gboolean D.19721;
  char * error_msg.3;
  char * error_msg.4;
  char * error_msg.5;
  char * error_msg.6;
  char * error_msg.7;
  char * error_msg.8;
  char * error_msg.9;
  char * error_msg.10;
  char * error_msg.11;
  char * error_msg.12;
  char * error_msg.13;
  static gboolean initialized = 0;
  char * error_msg;
  struct MonoDl * module;
  const char * scope;

  try
    {
      module = 0B;
      scope = "liboleaut32.so";
      initialized.2 = initialized;
      if (initialized.2 != 0) goto <D.19719>; else goto <D.19720>;
      <D.19719>:
      D.19721 = 1;
      return D.19721;
      <D.19720>:
      module = mono_dl_open (scope, 1, &error_msg);
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19723>; else goto <D.19724>;
      <D.19723>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading COM support library \'%s\': %s", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2497);
      D.19721 = 0;
      return D.19721;
      <D.19724>:
      error_msg.4 = mono_dl_symbol (module, "SysAllocStringLen", &sys_alloc_string_len_ms);
      error_msg = error_msg.4;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19726>; else goto <D.19727>;
      <D.19726>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SysAllocStringLen", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2503);
      D.19721 = 0;
      return D.19721;
      <D.19727>:
      error_msg.5 = mono_dl_symbol (module, "SysStringLen", &sys_string_len_ms);
      error_msg = error_msg.5;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19729>; else goto <D.19730>;
      <D.19729>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SysStringLen", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2510);
      D.19721 = 0;
      return D.19721;
      <D.19730>:
      error_msg.6 = mono_dl_symbol (module, "SysFreeString", &sys_free_string_ms);
      error_msg = error_msg.6;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19732>; else goto <D.19733>;
      <D.19732>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SysFreeString", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2517);
      D.19721 = 0;
      return D.19721;
      <D.19733>:
      error_msg.7 = mono_dl_symbol (module, "SafeArrayGetDim", &safe_array_get_dim_ms);
      error_msg = error_msg.7;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19735>; else goto <D.19736>;
      <D.19735>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SafeArrayGetDim", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2524);
      D.19721 = 0;
      return D.19721;
      <D.19736>:
      error_msg.8 = mono_dl_symbol (module, "SafeArrayGetLBound", &safe_array_get_lbound_ms);
      error_msg = error_msg.8;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19738>; else goto <D.19739>;
      <D.19738>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SafeArrayGetLBound", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2531);
      D.19721 = 0;
      return D.19721;
      <D.19739>:
      error_msg.9 = mono_dl_symbol (module, "SafeArrayGetUBound", &safe_array_get_ubound_ms);
      error_msg = error_msg.9;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19741>; else goto <D.19742>;
      <D.19741>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SafeArrayGetUBound", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2538);
      D.19721 = 0;
      return D.19721;
      <D.19742>:
      error_msg.10 = mono_dl_symbol (module, "SafeArrayPtrOfIndex", &safe_array_ptr_of_index_ms);
      error_msg = error_msg.10;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19744>; else goto <D.19745>;
      <D.19744>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SafeArrayPtrOfIndex", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2545);
      D.19721 = 0;
      return D.19721;
      <D.19745>:
      error_msg.11 = mono_dl_symbol (module, "SafeArrayDestroy", &safe_array_destroy_ms);
      error_msg = error_msg.11;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19747>; else goto <D.19748>;
      <D.19747>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SafeArrayDestroy", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2552);
      D.19721 = 0;
      return D.19721;
      <D.19748>:
      error_msg.12 = mono_dl_symbol (module, "SafeArrayPutElement", &safe_array_put_element_ms);
      error_msg = error_msg.12;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19750>; else goto <D.19751>;
      <D.19750>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SafeArrayPutElement", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2559);
      D.19721 = 0;
      return D.19721;
      <D.19751>:
      error_msg.13 = mono_dl_symbol (module, "SafeArrayCreate", &safe_array_create_ms);
      error_msg = error_msg.13;
      error_msg.3 = error_msg;
      if (error_msg.3 != 0B) goto <D.19753>; else goto <D.19754>;
      <D.19753>:
      error_msg.3 = error_msg;
      monoeg_g_log (0B, 16, "Error loading entry point \'%s\' in COM support library \'%s\': %s", "SafeArrayCreate", scope, error_msg.3);
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2566);
      D.19721 = 0;
      return D.19721;
      <D.19754>:
      initialized = 1;
      D.19721 = 1;
      return D.19721;
    }
  finally
    {
      error_msg = {CLOBBER};
    }
}


cominterop_raise_hr_exception (int hr)
{
  struct MonoMethod * throw_exception_for_hr.14;
  struct MonoClass * D.19760;
  struct MonoMethod * throw_exception_for_hr.15;
  static struct MonoMethod * throw_exception_for_hr = 0B;
  struct MonoException * ex;
  void * params[1];

  try
    {
      params[0] = &hr;
      throw_exception_for_hr.14 = throw_exception_for_hr;
      if (throw_exception_for_hr.14 == 0B) goto <D.19758>; else goto <D.19759>;
      <D.19758>:
      D.19760 = mono_defaults.marshal_class;
      throw_exception_for_hr.15 = mono_class_get_method_from_name (D.19760, "GetExceptionForHR", 1);
      throw_exception_for_hr = throw_exception_for_hr.15;
      <D.19759>:
      throw_exception_for_hr.14 = throw_exception_for_hr;
      ex = mono_runtime_invoke (throw_exception_for_hr.14, 0B, &params, 0B);
      mono_raise_exception (ex);
    }
  finally
    {
      params = {CLOBBER};
    }
}


mono_marshal_safearray_create (struct MonoArray * input, void * * newsafearray, void * * indices, void * empty)
{
  <unnamed type> com_provider.16;
  int D.19766;
  gboolean D.19767;
  long unsigned int D.19768;
  struct MonoVTable * D.19769;
  struct MonoClass * D.19770;
  unsigned char D.19771;
  long unsigned int D.19772;
  long unsigned int D.19773;
  void * D.19774;
  long unsigned int D.19775;
  _Bool D.19776;
  int D.19777;
  void * D.19780;
  long unsigned int D.19781;
  long unsigned int D.19782;
  int * D.19783;
  long unsigned int D.19784;
  struct SAFEARRAYBOUND * D.19785;
  struct MonoArrayBounds * D.19786;
  struct MonoArrayBounds * D.19787;
  int D.19788;
  int D.19789;
  unsigned int D.19790;
  unsigned int max_array_length.17;
  void * (*<T34c2>) (int, guint32, struct SAFEARRAYBOUND *) safe_array_create_ms.18;
  unsigned int dim.19;
  void * D.19795;
  int dim;
  struct SAFEARRAYBOUND * bounds;
  int i;
  int max_array_length;

  com_provider.16 = com_provider;
  if (com_provider.16 != 1) goto <D.19762>; else goto <D.19765>;
  <D.19765>:
  D.19766 = init_com_provider_ms ();
  if (D.19766 == 0) goto <D.19762>; else goto <D.19763>;
  <D.19762>:
  D.19767 = 0;
  return D.19767;
  <D.19763>:
  D.19768 = mono_array_length (input);
  max_array_length = (int) D.19768;
  D.19769 = MEM[(struct MonoObject *)input].vtable;
  D.19770 = D.19769->klass;
  D.19771 = D.19770->rank;
  dim = (int) D.19771;
  D.19772 = (long unsigned int) dim;
  D.19773 = D.19772 * 4;
  D.19774 = monoeg_malloc (D.19773);
  *indices = D.19774;
  D.19772 = (long unsigned int) dim;
  D.19775 = D.19772 * 8;
  bounds = __builtin_alloca (D.19775);
  D.19776 = max_array_length == 0;
  D.19777 = (int) D.19776;
  MEM[(int *)empty] = D.19777;
  if (dim > 1) goto <D.19778>; else goto <D.19779>;
  <D.19778>:
  i = 0;
  goto <D.19633>;
  <D.19632>:
  D.19780 = *indices;
  D.19781 = (long unsigned int) i;
  D.19782 = D.19781 * 4;
  D.19783 = D.19780 + D.19782;
  D.19781 = (long unsigned int) i;
  D.19784 = D.19781 * 8;
  D.19785 = bounds + D.19784;
  D.19786 = input->bounds;
  D.19781 = (long unsigned int) i;
  D.19784 = D.19781 * 8;
  D.19787 = D.19786 + D.19784;
  D.19788 = D.19787->lower_bound;
  D.19785->lLbound = D.19788;
  D.19789 = D.19785->lLbound;
  *D.19783 = D.19789;
  D.19781 = (long unsigned int) i;
  D.19784 = D.19781 * 8;
  D.19785 = bounds + D.19784;
  D.19786 = input->bounds;
  D.19781 = (long unsigned int) i;
  D.19784 = D.19781 * 8;
  D.19787 = D.19786 + D.19784;
  D.19790 = D.19787->length;
  D.19785->cElements = D.19790;
  i = i + 1;
  <D.19633>:
  if (i < dim) goto <D.19632>; else goto <D.19634>;
  <D.19634>:
  goto <D.19791>;
  <D.19779>:
  D.19780 = *indices;
  MEM[(int *)D.19780] = 0;
  max_array_length.17 = (unsigned int) max_array_length;
  bounds->cElements = max_array_length.17;
  bounds->lLbound = 0;
  <D.19791>:
  safe_array_create_ms.18 = safe_array_create_ms;
  dim.19 = (unsigned int) dim;
  D.19795 = safe_array_create_ms.18 (12, dim.19, bounds);
  *newsafearray = D.19795;
  D.19767 = 1;
  return D.19767;
}


mono_marshal_safearray_end (void * safearray, void * indices)
{
  <unnamed type> com_provider.20;
  int D.19801;
  int (*<T32a0>) (void *) safe_array_destroy_ms.21;

  monoeg_g_free (indices);
  com_provider.20 = com_provider;
  if (com_provider.20 == 1) goto <D.19800>; else goto <D.19797>;
  <D.19800>:
  D.19801 = init_com_provider_ms ();
  if (D.19801 != 0) goto <D.19802>; else goto <D.19797>;
  <D.19802>:
  safe_array_destroy_ms.21 = safe_array_destroy_ms;
  safe_array_destroy_ms.21 (safearray);
  goto <D.19798>;
  <D.19797>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 3089);
  <D.19798>:
}


mono_marshal_safearray_next (void * safearray, void * indices)
{
  unsigned int D.19804;
  int D.19805;
  unsigned int D.19806;
  long unsigned int D.19809;
  long unsigned int D.19810;
  int * D.19811;
  int D.19812;
  int D.19813;
  long int D.19814;
  long int ubound.22;
  long int lbound.23;
  int D.19820;
  gboolean D.19823;
  int i;
  int dim;
  gboolean ret;
  int * pIndices;
  int hr;

  D.19804 = mono_marshal_safearray_get_dim (safearray);
  dim = (int) D.19804;
  ret = 1;
  pIndices = indices;
  i = dim + -1;
  goto <D.19617>;
  <D.19616>:
  {
    glong lbound;
    glong ubound;

    try
      {
        D.19805 = i + 1;
        D.19806 = (unsigned int) D.19805;
        hr = mono_marshal_safe_array_get_ubound (safearray, D.19806, &ubound);
        if (hr < 0) goto <D.19807>; else goto <D.19808>;
        <D.19807>:
        cominterop_raise_hr_exception (hr);
        <D.19808>:
        D.19809 = (long unsigned int) i;
        D.19810 = D.19809 * 4;
        D.19811 = pIndices + D.19810;
        D.19812 = *D.19811;
        D.19813 = D.19812 + 1;
        *D.19811 = D.19813;
        D.19812 = *D.19811;
        D.19814 = (long int) D.19812;
        ubound.22 = ubound;
        if (D.19814 <= ubound.22) goto <D.19615>; else goto <D.19816>;
        <D.19816>:
        D.19805 = i + 1;
        D.19806 = (unsigned int) D.19805;
        hr = mono_marshal_safe_array_get_lbound (safearray, D.19806, &lbound);
        if (hr < 0) goto <D.19817>; else goto <D.19818>;
        <D.19817>:
        cominterop_raise_hr_exception (hr);
        <D.19818>:
        D.19809 = (long unsigned int) i;
        D.19810 = D.19809 * 4;
        D.19811 = pIndices + D.19810;
        lbound.23 = lbound;
        D.19820 = (int) lbound.23;
        *D.19811 = D.19820;
        if (i == 0) goto <D.19821>; else goto <D.19822>;
        <D.19821>:
        ret = 0;
        <D.19822>:
      }
    finally
      {
        lbound = {CLOBBER};
        ubound = {CLOBBER};
      }
  }
  i = i + -1;
  <D.19617>:
  if (i >= 0) goto <D.19616>; else goto <D.19615>;
  <D.19615>:
  D.19823 = ret;
  return D.19823;
}


mono_marshal_safearray_get_dim (void * safearray)
{
  <unnamed type> com_provider.24;
  int D.19831;
  guint32 (*<T1928>) (void *) safe_array_get_dim_ms.25;
  guint32 D.19834;
  guint32 result;

  result = 0;
  com_provider.24 = com_provider;
  if (com_provider.24 == 1) goto <D.19830>; else goto <D.19827>;
  <D.19830>:
  D.19831 = init_com_provider_ms ();
  if (D.19831 != 0) goto <D.19832>; else goto <D.19827>;
  <D.19832>:
  safe_array_get_dim_ms.25 = safe_array_get_dim_ms;
  result = safe_array_get_dim_ms.25 (safearray);
  goto <D.19828>;
  <D.19827>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2914);
  <D.19828>:
  D.19834 = result;
  return D.19834;
}


mono_marshal_safe_array_get_ubound (void * psa, guint nDim, glong * plUbound)
{
  <unnamed type> com_provider.26;
  int D.19840;
  int (*<T34ae>) (void *, guint32, glong *) safe_array_get_ubound_ms.27;
  int D.19843;
  int result;

  result = 0;
  com_provider.26 = com_provider;
  if (com_provider.26 == 1) goto <D.19839>; else goto <D.19836>;
  <D.19839>:
  D.19840 = init_com_provider_ms ();
  if (D.19840 != 0) goto <D.19841>; else goto <D.19836>;
  <D.19841>:
  safe_array_get_ubound_ms.27 = safe_array_get_ubound_ms;
  result = safe_array_get_ubound_ms.27 (psa, nDim, plUbound);
  goto <D.19837>;
  <D.19836>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2946);
  <D.19837>:
  D.19843 = result;
  return D.19843;
}


mono_marshal_safe_array_get_lbound (void * psa, guint nDim, glong * plLbound)
{
  <unnamed type> com_provider.28;
  int D.19849;
  int (*<T34ae>) (void *, guint32, glong *) safe_array_get_lbound_ms.29;
  int D.19852;
  int result;

  result = 0;
  com_provider.28 = com_provider;
  if (com_provider.28 == 1) goto <D.19848>; else goto <D.19845>;
  <D.19848>:
  D.19849 = init_com_provider_ms ();
  if (D.19849 != 0) goto <D.19850>; else goto <D.19845>;
  <D.19850>:
  safe_array_get_lbound_ms.29 = safe_array_get_lbound_ms;
  result = safe_array_get_lbound_ms.29 (psa, nDim, plLbound);
  goto <D.19846>;
  <D.19845>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2930);
  <D.19846>:
  D.19852 = result;
  return D.19852;
}


mono_marshal_safearray_get_value (void * safearray, void * indices)
{
  <unnamed type> com_provider.30;
  int D.19858;
  int (*<T34b6>) (void *, glong *, void * *) safe_array_ptr_of_index_ms.31;
  void * D.19863;
  void * result;

  try
    {
      com_provider.30 = com_provider;
      if (com_provider.30 == 1) goto <D.19857>; else goto <D.19854>;
      <D.19857>:
      D.19858 = init_com_provider_ms ();
      if (D.19858 != 0) goto <D.19859>; else goto <D.19854>;
      <D.19859>:
      {
        int hr;

        safe_array_ptr_of_index_ms.31 = safe_array_ptr_of_index_ms;
        hr = safe_array_ptr_of_index_ms.31 (safearray, indices, &result);
        if (hr < 0) goto <D.19861>; else goto <D.19862>;
        <D.19861>:
        cominterop_raise_hr_exception (hr);
        <D.19862>:
      }
      goto <D.19855>;
      <D.19854>:
      monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 3038);
      <D.19855>:
      D.19863 = result;
      return D.19863;
    }
  finally
    {
      result = {CLOBBER};
    }
}


mono_marshal_safearray_begin (void * safearray, struct MonoArray * * result, void * * indices, void * empty, void * parameter, gboolean allocateNewArray)
{
  <unnamed type> com_provider.32;
  int D.19870;
  gboolean D.19871;
  unsigned int D.19874;
  long unsigned int D.19877;
  long unsigned int D.19878;
  void * D.19879;
  long unsigned int D.19880;
  int D.19881;
  unsigned int D.19882;
  long int lbound.33;
  long int ubound.34;
  unsigned int D.19891;
  unsigned int D.19892;
  unsigned int D.19893;
  unsigned int D.19894;
  long unsigned int D.19895;
  long unsigned int D.19896;
  uintptr_t * D.19897;
  long unsigned int D.19898;
  intptr_t * D.19899;
  void * D.19900;
  long unsigned int D.19901;
  int * D.19902;
  int D.19903;
  struct MonoClass * D.19908;
  unsigned int dim.35;
  struct MonoDomain * D.19910;
  struct MonoArray * D.19911;
  int dim;
  uintptr_t * sizes;
  intptr_t * bounds;
  struct MonoClass * aklass;
  int i;
  gboolean bounded;

  bounded = 0;
  com_provider.32 = com_provider;
  if (com_provider.32 != 1) goto <D.19866>; else goto <D.19869>;
  <D.19869>:
  D.19870 = init_com_provider_ms ();
  if (D.19870 == 0) goto <D.19866>; else goto <D.19867>;
  <D.19866>:
  D.19871 = 0;
  return D.19871;
  <D.19867>:
  MEM[(int *)empty] = 1;
  if (safearray != 0B) goto <D.19872>; else goto <D.19873>;
  <D.19872>:
  D.19874 = mono_marshal_safearray_get_dim (safearray);
  dim = (int) D.19874;
  if (dim > 0) goto <D.19875>; else goto <D.19876>;
  <D.19875>:
  D.19877 = (long unsigned int) dim;
  D.19878 = D.19877 * 4;
  D.19879 = monoeg_malloc (D.19878);
  *indices = D.19879;
  D.19877 = (long unsigned int) dim;
  D.19880 = D.19877 * 8;
  sizes = __builtin_alloca (D.19880);
  D.19877 = (long unsigned int) dim;
  D.19880 = D.19877 * 8;
  bounds = __builtin_alloca (D.19880);
  i = 0;
  goto <D.19596>;
  <D.19595>:
  {
    glong lbound;
    glong ubound;
    int cursize;
    int hr;

    try
      {
        D.19881 = i + 1;
        D.19882 = (unsigned int) D.19881;
        hr = mono_marshal_safe_array_get_lbound (safearray, D.19882, &lbound);
        if (hr < 0) goto <D.19883>; else goto <D.19884>;
        <D.19883>:
        cominterop_raise_hr_exception (hr);
        <D.19884>:
        lbound.33 = lbound;
        if (lbound.33 != 0) goto <D.19886>; else goto <D.19887>;
        <D.19886>:
        bounded = 1;
        <D.19887>:
        D.19881 = i + 1;
        D.19882 = (unsigned int) D.19881;
        hr = mono_marshal_safe_array_get_ubound (safearray, D.19882, &ubound);
        if (hr < 0) goto <D.19888>; else goto <D.19889>;
        <D.19888>:
        cominterop_raise_hr_exception (hr);
        <D.19889>:
        ubound.34 = ubound;
        D.19891 = (unsigned int) ubound.34;
        lbound.33 = lbound;
        D.19892 = (unsigned int) lbound.33;
        D.19893 = D.19891 - D.19892;
        D.19894 = D.19893 + 1;
        cursize = (int) D.19894;
        D.19895 = (long unsigned int) i;
        D.19896 = D.19895 * 8;
        D.19897 = sizes + D.19896;
        D.19898 = (long unsigned int) cursize;
        *D.19897 = D.19898;
        D.19895 = (long unsigned int) i;
        D.19896 = D.19895 * 8;
        D.19899 = bounds + D.19896;
        lbound.33 = lbound;
        *D.19899 = lbound.33;
        D.19900 = *indices;
        D.19895 = (long unsigned int) i;
        D.19901 = D.19895 * 4;
        D.19902 = D.19900 + D.19901;
        lbound.33 = lbound;
        D.19903 = (int) lbound.33;
        *D.19902 = D.19903;
        if (cursize != 0) goto <D.19904>; else goto <D.19905>;
        <D.19904>:
        MEM[(int *)empty] = 0;
        <D.19905>:
      }
    finally
      {
        lbound = {CLOBBER};
        ubound = {CLOBBER};
      }
  }
  i = i + 1;
  <D.19596>:
  if (i < dim) goto <D.19595>; else goto <D.19597>;
  <D.19597>:
  if (allocateNewArray != 0) goto <D.19906>; else goto <D.19907>;
  <D.19906>:
  D.19908 = mono_defaults.object_class;
  dim.35 = (unsigned int) dim;
  aklass = mono_bounded_array_class_get (D.19908, dim.35, bounded);
  D.19910 = mono_domain_get ();
  D.19911 = mono_array_new_full (D.19910, aklass, sizes, bounds);
  *result = D.19911;
  goto <D.19912>;
  <D.19907>:
  *result = parameter;
  <D.19912>:
  <D.19876>:
  <D.19873>:
  D.19871 = 1;
  return D.19871;
}


cominterop_type_from_handle (struct MonoType * handle)
{
  struct MonoReflectionType * D.19914;
  struct MonoDomain * domain;
  struct MonoClass * klass;

  domain = mono_domain_get ();
  klass = mono_class_from_mono_type (handle);
  mono_class_init (klass);
  D.19914 = mono_type_get_object (domain, handle);
  return D.19914;
}


cominterop_get_interface (struct MonoComObject * obj, struct MonoClass * ic, gboolean throw_exception)
{
  _Bool D.19916;
  long int D.19917;
  long int D.19918;
  int iftmp.36;
  unsigned int D.19924;
  unsigned int D.19925;
  unsigned char D.19927;
  _Bool D.19930;
  long int D.19931;
  long int D.19932;
  _Bool D.19937;
  long int D.19938;
  long int D.19939;
  struct GHashTable * D.19942;
  short unsigned int D.19945;
  long unsigned int D.19946;
  const void * D.19947;
  void * itf.37;
  _Bool D.19951;
  long int D.19952;
  long int D.19953;
  void * itf.38;
  _Bool D.19959;
  long int D.19960;
  long int D.19961;
  void * D.19964;
  _Bool D.19975;
  long int D.19976;
  long int D.19977;
  struct GHashTable * D.19982;
  void * D.19983;
  _Bool D.19986;
  long int D.19987;
  long int D.19988;
  _Bool D.19993;
  long int D.19994;
  long int D.19995;
  void * D.19998;
  void * itf;

  try
    {
      itf = 0B;
      D.19916 = ic == 0B;
      D.19917 = (long int) D.19916;
      D.19918 = __builtin_expect (D.19917, 0);
      if (D.19918 != 0) goto <D.19919>; else goto <D.19920>;
      <D.19919>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 473, "ic");
      <D.19920>:
      D.19924 = ic->flags;
      D.19925 = D.19924 & 32;
      if (D.19925 == 0) goto <D.19926>; else goto <D.19922>;
      <D.19926>:
      D.19927 = ic->byval_arg.type;
      if (D.19927 != 19) goto <D.19928>; else goto <D.19922>;
      <D.19928>:
      D.19927 = ic->byval_arg.type;
      if (D.19927 != 30) goto <D.19929>; else goto <D.19922>;
      <D.19929>:
      iftmp.36 = 1;
      goto <D.19923>;
      <D.19922>:
      iftmp.36 = 0;
      <D.19923>:
      D.19930 = iftmp.36 != 0;
      D.19931 = (long int) D.19930;
      D.19932 = __builtin_expect (D.19931, 0);
      if (D.19932 != 0) goto <D.19933>; else goto <D.19934>;
      <D.19933>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 474, "MONO_CLASS_IS_INTERFACE (ic)");
      <D.19934>:
      {
        int ret;

        ret = pthread_mutex_lock (&cominterop_mutex.mutex);
        if (ret != 0) goto <D.19935>; else goto <D.19936>;
        <D.19935>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.19936>:
        D.19937 = ret != 0;
        D.19938 = (long int) D.19937;
        D.19939 = __builtin_expect (D.19938, 0);
        if (D.19939 != 0) goto <D.19940>; else goto <D.19941>;
        <D.19940>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 476, "ret == 0");
        <D.19941>:
      }
      D.19942 = obj->itf_hash;
      if (D.19942 != 0B) goto <D.19943>; else goto <D.19944>;
      <D.19943>:
      D.19942 = obj->itf_hash;
      D.19945 = ic->interface_id;
      D.19946 = (long unsigned int) D.19945;
      D.19947 = (const void *) D.19946;
      itf.37 = monoeg_g_hash_table_lookup (D.19942, D.19947);
      itf = itf.37;
      <D.19944>:
      {
        int ret;

        ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
        if (ret != 0) goto <D.19949>; else goto <D.19950>;
        <D.19949>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19950>:
        D.19951 = ret != 0;
        D.19952 = (long int) D.19951;
        D.19953 = __builtin_expect (D.19952, 0);
        if (D.19953 != 0) goto <D.19954>; else goto <D.19955>;
        <D.19954>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 479, "ret == 0");
        <D.19955>:
      }
      itf.38 = itf;
      if (itf.38 == 0B) goto <D.19957>; else goto <D.19958>;
      <D.19957>:
      {
        guint8 iid[16];
        int found;
        int hr;

        try
          {
            found = cominterop_class_guid (ic, &iid);
            D.19959 = found == 0;
            D.19960 = (long int) D.19959;
            D.19961 = __builtin_expect (D.19960, 0);
            if (D.19961 != 0) goto <D.19962>; else goto <D.19963>;
            <D.19962>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 485, "found");
            <D.19963>:
            D.19964 = obj->iunknown;
            hr = ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (D.19964, &iid, &itf);
            if (hr < 0) goto <D.19965>; else goto <D.19966>;
            <D.19965>:
            if (throw_exception != 0) goto <D.19967>; else goto <D.19968>;
            <D.19967>:
            cominterop_raise_hr_exception (hr);
            <D.19968>:
            <D.19966>:
            if (hr >= 0) goto <D.19969>; else goto <D.19970>;
            <D.19969>:
            itf.38 = itf;
            if (itf.38 != 0B) goto <D.19971>; else goto <D.19972>;
            <D.19971>:
            {
              int ret;

              ret = pthread_mutex_lock (&cominterop_mutex.mutex);
              if (ret != 0) goto <D.19973>; else goto <D.19974>;
              <D.19973>:
              monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
              <D.19974>:
              D.19975 = ret != 0;
              D.19976 = (long int) D.19975;
              D.19977 = __builtin_expect (D.19976, 0);
              if (D.19977 != 0) goto <D.19978>; else goto <D.19979>;
              <D.19978>:
              monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 492, "ret == 0");
              <D.19979>:
            }
            D.19942 = obj->itf_hash;
            if (D.19942 == 0B) goto <D.19980>; else goto <D.19981>;
            <D.19980>:
            D.19982 = monoeg_g_hash_table_new (mono_aligned_addr_hash, 0B);
            obj->itf_hash = D.19982;
            <D.19981>:
            D.19942 = obj->itf_hash;
            D.19945 = ic->interface_id;
            D.19946 = (long unsigned int) D.19945;
            D.19983 = (void *) D.19946;
            itf.38 = itf;
            monoeg_g_hash_table_insert_replace (D.19942, D.19983, itf.38, 0);
            {
              int ret;

              ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
              if (ret != 0) goto <D.19984>; else goto <D.19985>;
              <D.19984>:
              monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
              <D.19985>:
              D.19986 = ret != 0;
              D.19987 = (long int) D.19986;
              D.19988 = __builtin_expect (D.19987, 0);
              if (D.19988 != 0) goto <D.19989>; else goto <D.19990>;
              <D.19989>:
              monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 496, "ret == 0");
              <D.19990>:
            }
            <D.19972>:
            <D.19970>:
          }
        finally
          {
            iid = {CLOBBER};
          }
      }
      <D.19958>:
      if (throw_exception != 0) goto <D.19991>; else goto <D.19992>;
      <D.19991>:
      itf.38 = itf;
      D.19993 = itf.38 == 0B;
      D.19994 = (long int) D.19993;
      D.19995 = __builtin_expect (D.19994, 0);
      if (D.19995 != 0) goto <D.19996>; else goto <D.19997>;
      <D.19996>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 501, "itf");
      <D.19997>:
      <D.19992>:
      D.19998 = itf;
      return D.19998;
    }
  finally
    {
      itf = {CLOBBER};
    }
}


cominterop_class_guid (struct MonoClass * klass, guint8 * guid)
{
  struct MonoClass * GuidAttribute.39;
  struct MonoImage * D.20004;
  struct MonoClass * GuidAttribute.40;
  gboolean D.20010;
  int D.20011;
  struct MonoString * D.20014;
  static struct MonoClass * GuidAttribute = 0B;
  struct MonoCustomAttrInfo * cinfo;

  GuidAttribute.39 = GuidAttribute;
  if (GuidAttribute.39 == 0B) goto <D.20002>; else goto <D.20003>;
  <D.20002>:
  D.20004 = mono_defaults.corlib;
  GuidAttribute.40 = mono_class_from_name (D.20004, "System.Runtime.InteropServices", "GuidAttribute");
  GuidAttribute = GuidAttribute.40;
  <D.20003>:
  cinfo = mono_custom_attrs_from_class (klass);
  if (cinfo != 0B) goto <D.20006>; else goto <D.20007>;
  <D.20006>:
  {
    struct MonoReflectionGuidAttribute * attr;

    GuidAttribute.39 = GuidAttribute;
    attr = mono_custom_attrs_get_attr (cinfo, GuidAttribute.39);
    if (attr == 0B) goto <D.20008>; else goto <D.20009>;
    <D.20008>:
    D.20010 = 0;
    return D.20010;
    <D.20009>:
    D.20011 = cinfo->cached;
    if (D.20011 == 0) goto <D.20012>; else goto <D.20013>;
    <D.20012>:
    mono_custom_attrs_free (cinfo);
    <D.20013>:
    D.20014 = attr->guid;
    cominterop_mono_string_to_guid (D.20014, guid);
    D.20010 = 1;
    return D.20010;
  }
  <D.20007>:
  D.20010 = 0;
  return D.20010;
}


cominterop_mono_string_to_guid (struct MonoString * string, guint8 * guid)
{
  sizetype D.20016;
  guint8 * D.20017;
  unsigned char D.20018;
  long unsigned int D.20019;
  long unsigned int D.20020;
  gunichar2 * D.20021;
  short unsigned int D.20022;
  unsigned int D.20023;
  int D.20024;
  unsigned char D.20025;
  sizetype D.20026;
  gunichar2 * D.20027;
  short unsigned int D.20028;
  unsigned int D.20029;
  int D.20030;
  unsigned char D.20031;
  unsigned char D.20032;
  unsigned char D.20033;
  unsigned int i.41;
  gunichar2 * chars;
  int i;
  static guint8 indexes[16] = {7, 5, 3, 1, 12, 10, 17, 15, 20, 22, 25, 27, 29, 31, 33, 35};

  chars = mono_string_chars (string);
  i = 0;
  i = 0;
  goto <D.19375>;
  <D.19374>:
  D.20016 = (sizetype) i;
  D.20017 = guid + D.20016;
  D.20018 = indexes[i];
  D.20019 = (long unsigned int) D.20018;
  D.20020 = D.20019 * 2;
  D.20021 = chars + D.20020;
  D.20022 = *D.20021;
  D.20023 = (unsigned int) D.20022;
  D.20024 = monoeg_g_unichar_xdigit_value (D.20023);
  D.20025 = (unsigned char) D.20024;
  D.20018 = indexes[i];
  D.20019 = (long unsigned int) D.20018;
  D.20020 = D.20019 * 2;
  D.20026 = D.20020 + 18446744073709551614;
  D.20027 = chars + D.20026;
  D.20028 = *D.20027;
  D.20029 = (unsigned int) D.20028;
  D.20030 = monoeg_g_unichar_xdigit_value (D.20029);
  D.20031 = (unsigned char) D.20030;
  D.20032 = D.20031 << 4;
  D.20033 = D.20025 + D.20032;
  *D.20017 = D.20033;
  i = i + 1;
  <D.19375>:
  i.41 = (unsigned int) i;
  if (i.41 <= 15) goto <D.19374>; else goto <D.19376>;
  <D.19376>:
}


cominterop_get_hresult_for_exception (struct MonoException * exc)
{
  int D.20035;
  int hr;

  hr = 0;
  D.20035 = hr;
  return D.20035;
}


cominterop_get_ccw_object (struct MonoCCWInterface * ccw_entry, gboolean verify)
{
  struct GHashTable * ccw_interface_hash.42;
  struct MonoObject * D.20040;
  _Bool D.20044;
  long int D.20045;
  long int D.20046;
  unsigned int D.20051;
  struct MonoCCW * ccw;

  ccw = 0B;
  ccw_interface_hash.42 = ccw_interface_hash;
  if (ccw_interface_hash.42 == 0B) goto <D.20038>; else goto <D.20039>;
  <D.20038>:
  D.20040 = 0B;
  return D.20040;
  <D.20039>:
  if (verify != 0) goto <D.20041>; else goto <D.20042>;
  <D.20041>:
  ccw_interface_hash.42 = ccw_interface_hash;
  ccw = monoeg_g_hash_table_lookup (ccw_interface_hash.42, ccw_entry);
  goto <D.20043>;
  <D.20042>:
  ccw = ccw_entry->ccw;
  D.20044 = ccw == 0B;
  D.20045 = (long int) D.20044;
  D.20046 = __builtin_expect (D.20045, 0);
  if (D.20046 != 0) goto <D.20047>; else goto <D.20048>;
  <D.20047>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1764, "ccw");
  <D.20048>:
  <D.20043>:
  if (ccw != 0B) goto <D.20049>; else goto <D.20050>;
  <D.20049>:
  D.20051 = ccw->gc_handle;
  D.20040 = mono_gchandle_get_target (D.20051);
  return D.20040;
  <D.20050>:
  D.20040 = 0B;
  return D.20040;
}


cominterop_get_ccw (struct MonoObject * object, struct MonoClass * itf)
{
  void * D.20055;
  _Bool D.20058;
  long int D.20059;
  long int D.20060;
  struct GHashTable * ccw_hash.43;
  struct GHashTable * D.20066;
  struct GHashTable * ccw_interface_hash.44;
  struct GHashTable * D.20070;
  int D.20071;
  long int D.20072;
  const void * D.20073;
  _Bool D.20076;
  long int D.20077;
  long int D.20078;
  unsigned int D.20081;
  struct MonoObject * D.20082;
  struct GList * iftmp.45;
  void * D.20089;
  void * D.20092;
  struct GHashTable * D.20097;
  unsigned int D.20098;
  _Bool D.20104;
  long int D.20105;
  long int D.20106;
  int D.20109;
  long int D.20110;
  void * D.20111;
  _Bool D.20114;
  long int D.20115;
  long int D.20116;
  struct MonoClass * coclass_attribute.46;
  struct MonoImage * D.20124;
  struct MonoClass * coclass_attribute.47;
  int D.20126;
  int iftmp.48;
  short unsigned int D.20133;
  struct MonoClass * * D.20135;
  struct MonoClass * D.20136;
  _Bool D.20137;
  long int D.20138;
  long int D.20139;
  int D.20142;
  struct MonoClass * D.20145;
  struct MonoClass * D.20149;
  unsigned int D.20153;
  unsigned int method_count.49;
  unsigned int D.20155;
  struct GHashTable * D.20156;
  int D.20159;
  struct MonoImage * D.20160;
  int D.20161;
  long unsigned int D.20162;
  unsigned int D.20163;
  unsigned int D.20164;
  void * * D.20167;
  unsigned int D.20168;
  struct MonoMethod * * D.20169;
  long unsigned int D.20170;
  long unsigned int D.20171;
  struct MonoMethod * * D.20172;
  short unsigned int D.20173;
  int D.20174;
  const char * D.20175;
  short unsigned int D.20176;
  int D.20177;
  int D.20178;
  long unsigned int D.20179;
  long unsigned int D.20180;
  short unsigned int D.20181;
  long unsigned int D.20182;
  long unsigned int D.20183;
  struct MonoMarshalSpec * * D.20184;
  long unsigned int D.20185;
  long unsigned int D.20186;
  struct MonoMarshalSpec * * D.20187;
  struct MonoMarshalSpec * D.20188;
  struct MonoMarshalSpec * D.20189;
  struct MonoType * D.20192;
  unsigned char D.20193;
  void * D.20196;
  void * D.20200;
  void * D.20204;
  void * D.20208;
  short int D.20213;
  short int D.20216;
  unsigned short D.20217;
  unsigned short D.20218;
  short int D.20219;
  struct MonoMarshalSpec * * D.20220;
  struct MonoType * D.20223;
  int D.20224;
  struct MonoMarshalSpec * D.20227;
  int D.20230;
  struct MonoType * D.20231;
  unsigned char D.20232;
  void * D.20235;
  void * D.20239;
  void * D.20243;
  void * D.20247;
  long unsigned int D.20248;
  long unsigned int D.20249;
  struct MonoMarshalSpec * * D.20250;
  _Bool D.20253;
  long int D.20254;
  long int D.20255;
  struct MonoMethodSignature * D.20258;
  short unsigned int D.20259;
  int D.20260;
  int D.20261;
  _Bool D.20264;
  long int D.20265;
  long int D.20266;
  int vtable_index.50;
  long unsigned int D.20270;
  long unsigned int D.20271;
  void * * D.20272;
  void * D.20273;
  int i;
  struct MonoCCW * ccw;
  struct MonoCCWInterface * ccw_entry;
  void * * vtable;
  static void * iunknown[3] = {0B, 0B, 0B};
  static void * idispatch[4] = {0B, 0B, 0B, 0B};
  struct MonoClass * iface;
  struct MonoClass * klass;
  struct EmitMarshalContext m;
  int start_slot;
  int method_count;
  struct GList * ccw_list;
  struct GList * ccw_list_item;
  struct MonoCustomAttrInfo * cinfo;

  try
    {
      ccw = 0B;
      ccw_entry = 0B;
      vtable = 0B;
      iface = 0B;
      klass = 0B;
      start_slot = 3;
      method_count = 0;
      cinfo = 0B;
      if (object == 0B) goto <D.20053>; else goto <D.20054>;
      <D.20053>:
      D.20055 = 0B;
      return D.20055;
      <D.20054>:
      klass = mono_object_get_class (object);
      {
        int ret;

        ret = pthread_mutex_lock (&cominterop_mutex.mutex);
        if (ret != 0) goto <D.20056>; else goto <D.20057>;
        <D.20056>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20057>:
        D.20058 = ret != 0;
        D.20059 = (long int) D.20058;
        D.20060 = __builtin_expect (D.20059, 0);
        if (D.20060 != 0) goto <D.20061>; else goto <D.20062>;
        <D.20061>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1828, "ret == 0");
        <D.20062>:
      }
      ccw_hash.43 = ccw_hash;
      if (ccw_hash.43 == 0B) goto <D.20064>; else goto <D.20065>;
      <D.20064>:
      D.20066 = monoeg_g_hash_table_new (mono_aligned_addr_hash, 0B);
      ccw_hash = D.20066;
      <D.20065>:
      ccw_interface_hash.44 = ccw_interface_hash;
      if (ccw_interface_hash.44 == 0B) goto <D.20068>; else goto <D.20069>;
      <D.20068>:
      D.20070 = monoeg_g_hash_table_new (mono_aligned_addr_hash, 0B);
      ccw_interface_hash = D.20070;
      <D.20069>:
      ccw_hash.43 = ccw_hash;
      D.20071 = mono_object_hash (object);
      D.20072 = (long int) D.20071;
      D.20073 = (const void *) D.20072;
      ccw_list = monoeg_g_hash_table_lookup (ccw_hash.43, D.20073);
      {
        int ret;

        ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
        if (ret != 0) goto <D.20074>; else goto <D.20075>;
        <D.20074>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20075>:
        D.20076 = ret != 0;
        D.20077 = (long int) D.20076;
        D.20078 = __builtin_expect (D.20077, 0);
        if (D.20078 != 0) goto <D.20079>; else goto <D.20080>;
        <D.20079>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1835, "ret == 0");
        <D.20080>:
      }
      ccw_list_item = ccw_list;
      goto <D.19297>;
      <D.19296>:
      {
        struct MonoCCW * ccw_iter;

        ccw_iter = ccw_list_item->data;
        D.20081 = ccw_iter->gc_handle;
        D.20082 = mono_gchandle_get_target (D.20081);
        if (D.20082 == object) goto <D.20083>; else goto <D.20084>;
        <D.20083>:
        ccw = ccw_iter;
        goto <D.19295>;
        <D.20084>:
        if (ccw_list_item != 0B) goto <D.20086>; else goto <D.20087>;
        <D.20086>:
        iftmp.45 = ccw_list_item->next;
        goto <D.20088>;
        <D.20087>:
        iftmp.45 = 0B;
        <D.20088>:
        ccw_list_item = iftmp.45;
      }
      <D.19297>:
      if (ccw_list_item != 0B) goto <D.19296>; else goto <D.19295>;
      <D.19295>:
      D.20089 = iunknown[0];
      if (D.20089 == 0B) goto <D.20090>; else goto <D.20091>;
      <D.20090>:
      iunknown[0] = cominterop_ccw_queryinterface;
      iunknown[1] = cominterop_ccw_addref;
      iunknown[2] = cominterop_ccw_release;
      <D.20091>:
      D.20092 = idispatch[0];
      if (D.20092 == 0B) goto <D.20093>; else goto <D.20094>;
      <D.20093>:
      idispatch[0] = cominterop_ccw_get_type_info_count;
      idispatch[1] = cominterop_ccw_get_type_info;
      idispatch[2] = cominterop_ccw_get_ids_of_names;
      idispatch[3] = cominterop_ccw_invoke;
      <D.20094>:
      if (ccw == 0B) goto <D.20095>; else goto <D.20096>;
      <D.20095>:
      ccw = monoeg_malloc0 (16);
      D.20097 = monoeg_g_hash_table_new (mono_aligned_addr_hash, 0B);
      ccw->vtable_hash = D.20097;
      ccw->ref_count = 0;
      D.20098 = mono_gchandle_new_weakref (object, 0);
      ccw->gc_handle = D.20098;
      if (ccw_list == 0B) goto <D.20099>; else goto <D.20100>;
      <D.20099>:
      ccw_list = monoeg_g_list_alloc ();
      ccw_list->data = ccw;
      goto <D.20101>;
      <D.20100>:
      ccw_list = monoeg_g_list_append (ccw_list, ccw);
      <D.20101>:
      {
        int ret;

        ret = pthread_mutex_lock (&cominterop_mutex.mutex);
        if (ret != 0) goto <D.20102>; else goto <D.20103>;
        <D.20102>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20103>:
        D.20104 = ret != 0;
        D.20105 = (long int) D.20104;
        D.20106 = __builtin_expect (D.20105, 0);
        if (D.20106 != 0) goto <D.20107>; else goto <D.20108>;
        <D.20107>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1876, "ret == 0");
        <D.20108>:
      }
      ccw_hash.43 = ccw_hash;
      D.20109 = mono_object_hash (object);
      D.20110 = (long int) D.20109;
      D.20111 = (void *) D.20110;
      monoeg_g_hash_table_insert_replace (ccw_hash.43, D.20111, ccw_list, 0);
      {
        int ret;

        ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
        if (ret != 0) goto <D.20112>; else goto <D.20113>;
        <D.20112>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20113>:
        D.20114 = ret != 0;
        D.20115 = (long int) D.20114;
        D.20116 = __builtin_expect (D.20115, 0);
        if (D.20116 != 0) goto <D.20117>; else goto <D.20118>;
        <D.20117>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1878, "ret == 0");
        <D.20118>:
      }
      mono_object_register_finalizer (object);
      <D.20096>:
      cinfo = mono_custom_attrs_from_class (itf);
      if (cinfo != 0B) goto <D.20119>; else goto <D.20120>;
      <D.20119>:
      {
        static struct MonoClass * coclass_attribute = 0B;

        coclass_attribute.46 = coclass_attribute;
        if (coclass_attribute.46 == 0B) goto <D.20122>; else goto <D.20123>;
        <D.20122>:
        D.20124 = mono_defaults.corlib;
        coclass_attribute.47 = mono_class_from_name (D.20124, "System.Runtime.InteropServices", "CoClassAttribute");
        coclass_attribute = coclass_attribute.47;
        <D.20123>:
        coclass_attribute.46 = coclass_attribute;
        D.20126 = mono_custom_attrs_has_attr (cinfo, coclass_attribute.46);
        if (D.20126 != 0) goto <D.20127>; else goto <D.20128>;
        <D.20127>:
        D.20133 = itf->interface_count;
        if (D.20133 == 0) goto <D.20130>; else goto <D.20134>;
        <D.20134>:
        D.20135 = itf->interfaces;
        D.20136 = *D.20135;
        if (D.20136 == 0B) goto <D.20130>; else goto <D.20131>;
        <D.20130>:
        iftmp.48 = 1;
        goto <D.20132>;
        <D.20131>:
        iftmp.48 = 0;
        <D.20132>:
        D.20137 = iftmp.48 != 0;
        D.20138 = (long int) D.20137;
        D.20139 = __builtin_expect (D.20138, 0);
        if (D.20139 != 0) goto <D.20140>; else goto <D.20141>;
        <D.20140>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1889, "itf->interface_count && itf->interfaces[0]");
        <D.20141>:
        D.20135 = itf->interfaces;
        itf = *D.20135;
        <D.20128>:
        D.20142 = cinfo->cached;
        if (D.20142 == 0) goto <D.20143>; else goto <D.20144>;
        <D.20143>:
        mono_custom_attrs_free (cinfo);
        <D.20144>:
      }
      <D.20120>:
      iface = itf;
      D.20145 = mono_class_get_iunknown_class ();
      if (D.20145 == iface) goto <D.20146>; else goto <D.20147>;
      <D.20146>:
      start_slot = 3;
      goto <D.20148>;
      <D.20147>:
      D.20149 = mono_class_get_idispatch_class ();
      if (D.20149 == iface) goto <D.20150>; else goto <D.20151>;
      <D.20150>:
      start_slot = 7;
      goto <D.20152>;
      <D.20151>:
      D.20153 = iface->method.count;
      method_count.49 = (unsigned int) method_count;
      D.20155 = D.20153 + method_count.49;
      method_count = (int) D.20155;
      start_slot = cominterop_get_com_slot_begin (iface);
      iface = 0B;
      <D.20152>:
      <D.20148>:
      D.20156 = ccw->vtable_hash;
      ccw_entry = monoeg_g_hash_table_lookup (D.20156, itf);
      if (ccw_entry == 0B) goto <D.20157>; else goto <D.20158>;
      <D.20157>:
      {
        int vtable_index;

        D.20159 = method_count + -1;
        vtable_index = D.20159 + start_slot;
        D.20160 = klass->image;
        D.20161 = method_count + start_slot;
        D.20162 = (long unsigned int) D.20161;
        D.20163 = (unsigned int) D.20162;
        D.20164 = D.20163 * 8;
        vtable = mono_image_alloc0 (D.20160, D.20164);
        memcpy (vtable, &iunknown, 24);
        if (start_slot == 7) goto <D.20165>; else goto <D.20166>;
        <D.20165>:
        D.20167 = vtable + 24;
        memcpy (D.20167, &idispatch, 32);
        <D.20166>:
        iface = itf;
        D.20153 = iface->method.count;
        D.20168 = D.20153 + 4294967295;
        i = (int) D.20168;
        goto <D.19321>;
        <D.19320>:
        {
          int param_index;
          struct MonoMethodBuilder * mb;
          struct MonoMarshalSpec * * mspecs;
          struct MonoMethod * wrapper_method;
          struct MonoMethod * adjust_method;
          struct MonoMethod * method;
          struct MonoMethodSignature * sig_adjusted;
          struct MonoMethodSignature * sig;
          gboolean preserve_sig;

          param_index = 0;
          D.20169 = iface->methods;
          D.20170 = (long unsigned int) i;
          D.20171 = D.20170 * 8;
          D.20172 = D.20169 + D.20171;
          method = *D.20172;
          sig = mono_method_signature (method);
          D.20173 = method->iflags;
          D.20174 = (int) D.20173;
          preserve_sig = D.20174 & 128;
          D.20175 = method->name;
          mb = mono_mb_new (iface, D.20175, 5);
          adjust_method = cominterop_get_managed_wrapper_adjusted (method);
          sig_adjusted = mono_method_signature (adjust_method);
          D.20176 = sig_adjusted->param_count;
          D.20177 = (int) D.20176;
          D.20178 = D.20177 + 1;
          D.20179 = (long unsigned int) D.20178;
          D.20180 = D.20179 * 8;
          mspecs = monoeg_malloc (D.20180);
          mono_method_get_marshal_info (method, mspecs);
          D.20181 = sig->param_count;
          param_index = (int) D.20181;
          goto <D.19313>;
          <D.19312>:
          {
            int mspec_index;

            mspec_index = param_index + 1;
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20185 = (long unsigned int) param_index;
            D.20186 = D.20185 * 8;
            D.20187 = mspecs + D.20186;
            D.20188 = *D.20187;
            *D.20184 = D.20188;
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20189 = *D.20184;
            if (D.20189 == 0B) goto <D.20190>; else goto <D.20191>;
            <D.20190>:
            D.20192 = sig_adjusted->params[param_index];
            D.20193 = D.20192->type;
            if (D.20193 == 28) goto <D.20194>; else goto <D.20195>;
            <D.20194>:
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20196 = monoeg_malloc0 (24);
            *D.20184 = D.20196;
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20189 = *D.20184;
            D.20189->native = 27;
            goto <D.20197>;
            <D.20195>:
            D.20192 = sig_adjusted->params[param_index];
            D.20193 = D.20192->type;
            if (D.20193 == 14) goto <D.20198>; else goto <D.20199>;
            <D.20198>:
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20200 = monoeg_malloc0 (24);
            *D.20184 = D.20200;
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20189 = *D.20184;
            D.20189->native = 19;
            goto <D.20201>;
            <D.20199>:
            D.20192 = sig_adjusted->params[param_index];
            D.20193 = D.20192->type;
            if (D.20193 == 18) goto <D.20202>; else goto <D.20203>;
            <D.20202>:
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20204 = monoeg_malloc0 (24);
            *D.20184 = D.20204;
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20189 = *D.20184;
            D.20189->native = 28;
            goto <D.20205>;
            <D.20203>:
            D.20192 = sig_adjusted->params[param_index];
            D.20193 = D.20192->type;
            if (D.20193 == 2) goto <D.20206>; else goto <D.20207>;
            <D.20206>:
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20208 = monoeg_malloc0 (24);
            *D.20184 = D.20208;
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20189 = *D.20184;
            D.20189->native = 37;
            <D.20207>:
            <D.20205>:
            <D.20201>:
            <D.20197>:
            goto <D.20209>;
            <D.20191>:
            D.20192 = sig_adjusted->params[param_index];
            D.20193 = D.20192->type;
            if (D.20193 == 20) goto <D.20210>; else goto <D.20212>;
            <D.20212>:
            D.20192 = sig_adjusted->params[param_index];
            D.20193 = D.20192->type;
            if (D.20193 == 29) goto <D.20210>; else goto <D.20211>;
            <D.20210>:
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20189 = *D.20184;
            D.20213 = D.20189->data.array_data.param_num;
            if (D.20213 != -1) goto <D.20214>; else goto <D.20215>;
            <D.20214>:
            D.20182 = (long unsigned int) mspec_index;
            D.20183 = D.20182 * 8;
            D.20184 = mspecs + D.20183;
            D.20189 = *D.20184;
            D.20213 = D.20189->data.array_data.param_num;
            D.20216 = D.20213;
            D.20217 = (unsigned short) D.20216;
            D.20218 = D.20217 + 1;
            D.20219 = (short int) D.20218;
            D.20189->data.array_data.param_num = D.20219;
            <D.20215>:
            <D.20211>:
            <D.20209>:
          }
          param_index = param_index + -1;
          <D.19313>:
          if (param_index > 0) goto <D.19312>; else goto <D.19314>;
          <D.19314>:
          D.20220 = mspecs + 8;
          *D.20220 = 0B;
          if (preserve_sig == 0) goto <D.20221>; else goto <D.20222>;
          <D.20221>:
          D.20223 = sig->ret;
          D.20224 = mono_type_is_void (D.20223);
          if (D.20224 == 0) goto <D.20225>; else goto <D.20226>;
          <D.20225>:
          D.20227 = *mspecs;
          if (D.20227 == 0B) goto <D.20228>; else goto <D.20229>;
          <D.20228>:
          D.20176 = sig_adjusted->param_count;
          D.20177 = (int) D.20176;
          D.20230 = D.20177 + -1;
          D.20231 = sig_adjusted->params[D.20230];
          D.20232 = D.20231->type;
          if (D.20232 == 28) goto <D.20233>; else goto <D.20234>;
          <D.20233>:
          D.20235 = monoeg_malloc0 (24);
          *mspecs = D.20235;
          D.20227 = *mspecs;
          D.20227->native = 27;
          goto <D.20236>;
          <D.20234>:
          D.20176 = sig_adjusted->param_count;
          D.20177 = (int) D.20176;
          D.20230 = D.20177 + -1;
          D.20231 = sig_adjusted->params[D.20230];
          D.20232 = D.20231->type;
          if (D.20232 == 14) goto <D.20237>; else goto <D.20238>;
          <D.20237>:
          D.20239 = monoeg_malloc0 (24);
          *mspecs = D.20239;
          D.20227 = *mspecs;
          D.20227->native = 19;
          goto <D.20240>;
          <D.20238>:
          D.20176 = sig_adjusted->param_count;
          D.20177 = (int) D.20176;
          D.20230 = D.20177 + -1;
          D.20231 = sig_adjusted->params[D.20230];
          D.20232 = D.20231->type;
          if (D.20232 == 18) goto <D.20241>; else goto <D.20242>;
          <D.20241>:
          D.20243 = monoeg_malloc0 (24);
          *mspecs = D.20243;
          D.20227 = *mspecs;
          D.20227->native = 28;
          goto <D.20244>;
          <D.20242>:
          D.20176 = sig_adjusted->param_count;
          D.20177 = (int) D.20176;
          D.20230 = D.20177 + -1;
          D.20231 = sig_adjusted->params[D.20230];
          D.20232 = D.20231->type;
          if (D.20232 == 2) goto <D.20245>; else goto <D.20246>;
          <D.20245>:
          D.20247 = monoeg_malloc0 (24);
          *mspecs = D.20247;
          D.20227 = *mspecs;
          D.20227->native = 37;
          <D.20246>:
          <D.20244>:
          <D.20240>:
          <D.20236>:
          <D.20229>:
          D.20176 = sig_adjusted->param_count;
          D.20248 = (long unsigned int) D.20176;
          D.20249 = D.20248 * 8;
          D.20250 = mspecs + D.20249;
          D.20227 = *mspecs;
          *D.20250 = D.20227;
          *mspecs = 0B;
          <D.20226>:
          <D.20222>:
          mb->skip_visibility = 1;
          cominterop_setup_marshal_context (&m, adjust_method);
          m.mb = mb;
          mono_marshal_emit_managed_wrapper (mb, sig_adjusted, mspecs, &m, adjust_method, 0);
          {
            int ret;

            ret = pthread_mutex_lock (&cominterop_mutex.mutex);
            if (ret != 0) goto <D.20251>; else goto <D.20252>;
            <D.20251>:
            monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
            <D.20252>:
            D.20253 = ret != 0;
            D.20254 = (long int) D.20253;
            D.20255 = __builtin_expect (D.20254, 0);
            if (D.20255 != 0) goto <D.20256>; else goto <D.20257>;
            <D.20256>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2003, "ret == 0");
            <D.20257>:
          }
          D.20258 = m.csig;
          D.20258 = m.csig;
          D.20259 = D.20258->param_count;
          D.20260 = (int) D.20259;
          D.20261 = D.20260 + 16;
          wrapper_method = mono_mb_create_method (mb, D.20258, D.20261);
          {
            int ret;

            ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
            if (ret != 0) goto <D.20262>; else goto <D.20263>;
            <D.20262>:
            monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
            <D.20263>:
            D.20264 = ret != 0;
            D.20265 = (long int) D.20264;
            D.20266 = __builtin_expect (D.20265, 0);
            if (D.20266 != 0) goto <D.20267>; else goto <D.20268>;
            <D.20267>:
            monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2005, "ret == 0");
            <D.20268>:
          }
          vtable_index.50 = vtable_index;
          vtable_index = vtable_index.50 + -1;
          D.20270 = (long unsigned int) vtable_index.50;
          D.20271 = D.20270 * 8;
          D.20272 = vtable + D.20271;
          D.20273 = mono_compile_method (wrapper_method);
          *D.20272 = D.20273;
          D.20176 = sig_adjusted->param_count;
          param_index = (int) D.20176;
          goto <D.19318>;
          <D.19317>:
          D.20185 = (long unsigned int) param_index;
          D.20186 = D.20185 * 8;
          D.20187 = mspecs + D.20186;
          D.20188 = *D.20187;
          if (D.20188 != 0B) goto <D.20274>; else goto <D.20275>;
          <D.20274>:
          D.20185 = (long unsigned int) param_index;
          D.20186 = D.20185 * 8;
          D.20187 = mspecs + D.20186;
          D.20188 = *D.20187;
          mono_metadata_free_marshal_spec (D.20188);
          <D.20275>:
          param_index = param_index + -1;
          <D.19318>:
          if (param_index >= 0) goto <D.19317>; else goto <D.19319>;
          <D.19319>:
          monoeg_g_free (mspecs);
        }
        i = i + -1;
        <D.19321>:
        if (i >= 0) goto <D.19320>; else goto <D.19322>;
        <D.19322>:
        ccw_entry = monoeg_malloc0 (16);
        ccw_entry->ccw = ccw;
        ccw_entry->vtable = vtable;
        D.20156 = ccw->vtable_hash;
        monoeg_g_hash_table_insert_replace (D.20156, itf, ccw_entry, 0);
        ccw_interface_hash.44 = ccw_interface_hash;
        monoeg_g_hash_table_insert_replace (ccw_interface_hash.44, ccw_entry, ccw, 0);
      }
      <D.20158>:
      D.20055 = ccw_entry;
      return D.20055;
    }
  finally
    {
      m = {CLOBBER};
    }
}


cominterop_ccw_invoke (struct MonoCCWInterface * ccwe, guint32 dispIdMember, void * riid, guint32 lcid, guint16 wFlags, void * pDispParams, void * pVarResult, void * pExcepInfo, guint32 * puArgErr)
{
  int D.20278;

  D.20278 = -2147467263;
  return D.20278;
}


cominterop_ccw_get_ids_of_names (struct MonoCCWInterface * ccwe, void * riid, gunichar2 * * rgszNames, guint32 cNames, guint32 lcid, gint32 * rgDispId)
{
  unsigned int D.20280;
  _Bool D.20281;
  long int D.20282;
  long int D.20283;
  struct MonoVTable * D.20286;
  struct MonoDomain * D.20287;
  struct MonoDomain * D.20290;
  long unsigned int D.20291;
  long unsigned int D.20292;
  gunichar2 * * D.20293;
  gunichar2 * D.20294;
  long unsigned int D.20297;
  gint32 * D.20298;
  unsigned int D.20299;
  int D.20300;
  unsigned int i.51;
  int D.20303;
  int i;
  int ret;
  struct MonoMethod * method;
  gchar * methodname;
  struct MonoClass * klass;
  struct MonoCCW * ccw;
  struct MonoObject * object;

  ret = 0;
  klass = 0B;
  ccw = ccwe->ccw;
  D.20280 = ccw->gc_handle;
  object = mono_gchandle_get_target (D.20280);
  D.20281 = object == 0B;
  D.20282 = (long int) D.20281;
  D.20283 = __builtin_expect (D.20282, 0);
  if (D.20283 != 0) goto <D.20284>; else goto <D.20285>;
  <D.20284>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2418, "object");
  <D.20285>:
  D.20286 = object->vtable;
  klass = D.20286->klass;
  D.20287 = mono_domain_get ();
  if (D.20287 == 0B) goto <D.20288>; else goto <D.20289>;
  <D.20288>:
  D.20290 = mono_get_root_domain ();
  mono_thread_attach (D.20290);
  <D.20289>:
  i = 0;
  goto <D.19440>;
  <D.19439>:
  D.20291 = (long unsigned int) i;
  D.20292 = D.20291 * 8;
  D.20293 = rgszNames + D.20292;
  D.20294 = *D.20293;
  methodname = mono_unicode_to_external (D.20294);
  method = mono_class_get_method_from_name (klass, methodname, -1);
  if (method != 0B) goto <D.20295>; else goto <D.20296>;
  <D.20295>:
  D.20291 = (long unsigned int) i;
  D.20297 = D.20291 * 4;
  D.20298 = rgDispId + D.20297;
  D.20299 = method->token;
  D.20300 = (int) D.20299;
  *D.20298 = D.20300;
  goto <D.20301>;
  <D.20296>:
  D.20291 = (long unsigned int) i;
  D.20297 = D.20291 * 4;
  D.20298 = rgDispId + D.20297;
  *D.20298 = -1;
  ret = -2147352570;
  <D.20301>:
  i = i + 1;
  <D.19440>:
  i.51 = (unsigned int) i;
  if (i.51 < cNames) goto <D.19439>; else goto <D.19441>;
  <D.19441>:
  D.20303 = ret;
  return D.20303;
}


cominterop_ccw_get_type_info (struct MonoCCWInterface * ccwe, guint32 iTInfo, guint32 lcid, void * * ppTInfo)
{
  int D.20305;

  D.20305 = -2147467263;
  return D.20305;
}


cominterop_ccw_get_type_info_count (struct MonoCCWInterface * ccwe, guint32 * pctinfo)
{
  int D.20309;

  if (pctinfo == 0B) goto <D.20307>; else goto <D.20308>;
  <D.20307>:
  D.20309 = -2147024809;
  return D.20309;
  <D.20308>:
  *pctinfo = 1;
  D.20309 = 0;
  return D.20309;
}


cominterop_ccw_release (struct MonoCCWInterface * ccwe)
{
  _Bool D.20311;
  long int D.20312;
  long int D.20313;
  unsigned int D.20316;
  _Bool D.20317;
  long int D.20318;
  long int D.20319;
  guint32 * D.20322;
  _Bool D.20325;
  long int D.20326;
  long int D.20327;
  struct MonoObject * D.20330;
  unsigned int D.20331;
  int D.20332;
  gint32 ref_count;
  struct MonoCCW * ccw;

  ref_count = 0;
  ccw = ccwe->ccw;
  D.20311 = ccw == 0B;
  D.20312 = (long int) D.20311;
  D.20313 = __builtin_expect (D.20312, 0);
  if (D.20313 != 0) goto <D.20314>; else goto <D.20315>;
  <D.20314>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2272, "ccw");
  <D.20315>:
  D.20316 = ccw->ref_count;
  D.20317 = D.20316 == 0;
  D.20318 = (long int) D.20317;
  D.20319 = __builtin_expect (D.20318, 0);
  if (D.20319 != 0) goto <D.20320>; else goto <D.20321>;
  <D.20320>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2273, "ccw->ref_count > 0");
  <D.20321>:
  D.20322 = &ccw->ref_count;
  ref_count = InterlockedDecrement (D.20322);
  if (ref_count == 0) goto <D.20323>; else goto <D.20324>;
  <D.20323>:
  {
    guint32 oldhandle;

    oldhandle = ccw->gc_handle;
    D.20325 = oldhandle == 0;
    D.20326 = (long int) D.20325;
    D.20327 = __builtin_expect (D.20326, 0);
    if (D.20327 != 0) goto <D.20328>; else goto <D.20329>;
    <D.20328>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2278, "oldhandle");
    <D.20329>:
    D.20330 = mono_gchandle_get_target (oldhandle);
    D.20331 = mono_gchandle_new_weakref (D.20330, 0);
    ccw->gc_handle = D.20331;
    mono_gchandle_free (oldhandle);
  }
  <D.20324>:
  D.20332 = ref_count;
  return D.20332;
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.20334;
  unsigned int D.20335;

  D.20335 = __sync_sub_and_fetch_4 (val, 1);
  D.20334 = (gint32) D.20335;
  return D.20334;
}


cominterop_ccw_addref (struct MonoCCWInterface * ccwe)
{
  _Bool D.20337;
  long int D.20338;
  long int D.20339;
  unsigned int D.20342;
  _Bool D.20343;
  long int D.20344;
  long int D.20345;
  guint32 * D.20350;
  _Bool D.20353;
  long int D.20354;
  long int D.20355;
  struct MonoObject * D.20358;
  unsigned int D.20359;
  int D.20360;
  gint32 ref_count;
  struct MonoCCW * ccw;

  ref_count = 0;
  ccw = ccwe->ccw;
  D.20337 = ccw == 0B;
  D.20338 = (long int) D.20337;
  D.20339 = __builtin_expect (D.20338, 0);
  if (D.20339 != 0) goto <D.20340>; else goto <D.20341>;
  <D.20340>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2253, "ccw");
  <D.20341>:
  D.20342 = ccw->gc_handle;
  D.20343 = D.20342 == 0;
  D.20344 = (long int) D.20343;
  D.20345 = __builtin_expect (D.20344, 0);
  if (D.20345 != 0) goto <D.20346>; else goto <D.20347>;
  <D.20346>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2254, "ccw->gc_handle");
  <D.20347>:
  if (0 != 0) goto <D.20348>; else goto <D.20349>;
  <D.20348>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2255, "ccw->ref_count >= 0");
  <D.20349>:
  D.20350 = &ccw->ref_count;
  ref_count = InterlockedIncrement (D.20350);
  if (ref_count == 1) goto <D.20351>; else goto <D.20352>;
  <D.20351>:
  {
    guint32 oldhandle;

    oldhandle = ccw->gc_handle;
    D.20353 = oldhandle == 0;
    D.20354 = (long int) D.20353;
    D.20355 = __builtin_expect (D.20354, 0);
    if (D.20355 != 0) goto <D.20356>; else goto <D.20357>;
    <D.20356>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2259, "oldhandle");
    <D.20357>:
    D.20358 = mono_gchandle_get_target (oldhandle);
    D.20359 = mono_gchandle_new (D.20358, 0);
    ccw->gc_handle = D.20359;
    mono_gchandle_free (oldhandle);
  }
  <D.20352>:
  D.20360 = ref_count;
  return D.20360;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.20362;
  unsigned int D.20363;

  D.20363 = __sync_add_and_fetch_4 (val, 1);
  D.20362 = (gint32) D.20363;
  return D.20362;
}


cominterop_ccw_queryinterface (struct MonoCCWInterface * ccwe, guint8 * riid, void * * ppv)
{
  unsigned int D.20365;
  _Bool D.20366;
  long int D.20367;
  long int D.20368;
  struct MonoVTable * D.20371;
  struct MonoDomain * D.20374;
  struct MonoDomain * D.20377;
  struct MonoClass * D.20378;
  int D.20379;
  struct MonoClass * D.20382;
  void * D.20383;
  void * D.20384;
  int D.20385;
  struct MonoClass * D.20386;
  int D.20387;
  int D.20390;
  struct MonoClass * D.20393;
  void * D.20394;
  int D.20395;
  _Bool D.20396;
  long int D.20397;
  long int D.20398;
  void * * D.20403;
  long unsigned int D.20404;
  long unsigned int D.20405;
  void * * D.20406;
  int D.20407;
  unsigned int D.20410;
  unsigned int i.52;
  struct MonoClass * D.20414;
  void * D.20417;
  struct MonoError error;
  struct GPtrArray * ifaces;
  struct MonoClass * itf;
  int i;
  struct MonoCCW * ccw;
  struct MonoClass * klass;
  struct MonoClass * klass_iter;
  struct MonoObject * object;

  try
    {
      itf = 0B;
      ccw = ccwe->ccw;
      klass = 0B;
      klass_iter = 0B;
      D.20365 = ccw->gc_handle;
      object = mono_gchandle_get_target (D.20365);
      D.20366 = object == 0B;
      D.20367 = (long int) D.20366;
      D.20368 = __builtin_expect (D.20367, 0);
      if (D.20368 != 0) goto <D.20369>; else goto <D.20370>;
      <D.20369>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2324, "object");
      <D.20370>:
      D.20371 = object->vtable;
      klass = D.20371->klass;
      if (ppv != 0B) goto <D.20372>; else goto <D.20373>;
      <D.20372>:
      *ppv = 0B;
      <D.20373>:
      D.20374 = mono_domain_get ();
      if (D.20374 == 0B) goto <D.20375>; else goto <D.20376>;
      <D.20375>:
      D.20377 = mono_get_root_domain ();
      mono_thread_attach (D.20377);
      <D.20376>:
      D.20378 = mono_class_get_iunknown_class ();
      D.20379 = cominterop_class_guid_equal (riid, D.20378);
      if (D.20379 != 0) goto <D.20380>; else goto <D.20381>;
      <D.20380>:
      D.20382 = mono_class_get_iunknown_class ();
      D.20383 = cominterop_get_ccw (object, D.20382);
      *ppv = D.20383;
      D.20384 = *ppv;
      cominterop_ccw_addref (D.20384);
      D.20385 = 0;
      return D.20385;
      <D.20381>:
      D.20386 = mono_class_get_idispatch_class ();
      D.20387 = cominterop_class_guid_equal (riid, D.20386);
      if (D.20387 != 0) goto <D.20388>; else goto <D.20389>;
      <D.20388>:
      D.20390 = cominterop_can_support_dispatch (klass);
      if (D.20390 == 0) goto <D.20391>; else goto <D.20392>;
      <D.20391>:
      D.20385 = -2147467262;
      return D.20385;
      <D.20392>:
      D.20393 = mono_class_get_idispatch_class ();
      D.20394 = cominterop_get_ccw (object, D.20393);
      *ppv = D.20394;
      D.20384 = *ppv;
      cominterop_ccw_addref (D.20384);
      D.20385 = 0;
      return D.20385;
      <D.20389>:
      klass_iter = klass;
      goto <D.19413>;
      <D.19412>:
      ifaces = mono_class_get_implemented_interfaces (klass_iter, &error);
      D.20395 = mono_error_ok (&error);
      D.20396 = D.20395 == 0;
      D.20397 = (long int) D.20396;
      D.20398 = __builtin_expect (D.20397, 0);
      if (D.20398 != 0) goto <D.20399>; else goto <D.20400>;
      <D.20399>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2361, "mono_error_ok (&error)");
      <D.20400>:
      if (ifaces != 0B) goto <D.20401>; else goto <D.20402>;
      <D.20401>:
      i = 0;
      goto <D.19410>;
      <D.19409>:
      {
        struct MonoClass * ic;

        ic = 0B;
        D.20403 = ifaces->pdata;
        D.20404 = (long unsigned int) i;
        D.20405 = D.20404 * 8;
        D.20406 = D.20403 + D.20405;
        ic = *D.20406;
        D.20407 = cominterop_class_guid_equal (riid, ic);
        if (D.20407 != 0) goto <D.20408>; else goto <D.20409>;
        <D.20408>:
        itf = ic;
        goto <D.19408>;
        <D.20409>:
      }
      i = i + 1;
      <D.19410>:
      D.20410 = ifaces->len;
      i.52 = (unsigned int) i;
      if (D.20410 > i.52) goto <D.19409>; else goto <D.19408>;
      <D.19408>:
      monoeg_g_ptr_array_free (ifaces, 1);
      <D.20402>:
      if (itf != 0B) goto <D.19411>; else goto <D.20412>;
      <D.20412>:
      klass_iter = klass_iter->parent;
      <D.19413>:
      if (klass_iter != 0B) goto <D.20413>; else goto <D.19411>;
      <D.20413>:
      D.20414 = mono_defaults.object_class;
      if (D.20414 != klass_iter) goto <D.19412>; else goto <D.19411>;
      <D.19411>:
      if (itf != 0B) goto <D.20415>; else goto <D.20416>;
      <D.20415>:
      D.20417 = cominterop_get_ccw (object, itf);
      *ppv = D.20417;
      D.20384 = *ppv;
      cominterop_ccw_addref (D.20384);
      D.20385 = 0;
      return D.20385;
      <D.20416>:
      D.20385 = -2147467262;
      return D.20385;
    }
  finally
    {
      error = {CLOBBER};
    }
}


cominterop_can_support_dispatch (struct MonoClass * klass)
{
  unsigned int D.20420;
  unsigned int D.20421;
  gboolean D.20424;
  int D.20425;

  D.20420 = klass->flags;
  D.20421 = D.20420 & 1;
  if (D.20421 == 0) goto <D.20422>; else goto <D.20423>;
  <D.20422>:
  D.20424 = 0;
  return D.20424;
  <D.20423>:
  D.20425 = cominterop_com_visible (klass);
  if (D.20425 == 0) goto <D.20426>; else goto <D.20427>;
  <D.20426>:
  D.20424 = 0;
  return D.20424;
  <D.20427>:
  D.20424 = 1;
  return D.20424;
}


cominterop_com_visible (struct MonoClass * klass)
{
  struct MonoClass * ComVisibleAttribute.53;
  struct MonoImage * D.20432;
  struct MonoClass * ComVisibleAttribute.54;
  int D.20438;
  gboolean D.20443;
  int D.20444;
  _Bool D.20445;
  long int D.20446;
  long int D.20447;
  void * * D.20452;
  long unsigned int D.20453;
  long unsigned int D.20454;
  void * * D.20455;
  unsigned int D.20456;
  unsigned int D.20457;
  unsigned int D.20460;
  unsigned int i.55;
  static struct MonoClass * ComVisibleAttribute = 0B;
  struct MonoError error;
  struct MonoCustomAttrInfo * cinfo;
  struct GPtrArray * ifaces;
  MonoBoolean visible;

  try
    {
      visible = 1;
      ComVisibleAttribute.53 = ComVisibleAttribute;
      if (ComVisibleAttribute.53 == 0B) goto <D.20430>; else goto <D.20431>;
      <D.20430>:
      D.20432 = mono_defaults.corlib;
      ComVisibleAttribute.54 = mono_class_from_name (D.20432, "System.Runtime.InteropServices", "ComVisibleAttribute");
      ComVisibleAttribute = ComVisibleAttribute.54;
      <D.20431>:
      cinfo = mono_custom_attrs_from_class (klass);
      if (cinfo != 0B) goto <D.20434>; else goto <D.20435>;
      <D.20434>:
      {
        struct MonoReflectionComVisibleAttribute * attr;

        ComVisibleAttribute.53 = ComVisibleAttribute;
        attr = mono_custom_attrs_get_attr (cinfo, ComVisibleAttribute.53);
        if (attr != 0B) goto <D.20436>; else goto <D.20437>;
        <D.20436>:
        visible = attr->visible;
        <D.20437>:
        D.20438 = cinfo->cached;
        if (D.20438 == 0) goto <D.20439>; else goto <D.20440>;
        <D.20439>:
        mono_custom_attrs_free (cinfo);
        <D.20440>:
        if (visible != 0) goto <D.20441>; else goto <D.20442>;
        <D.20441>:
        D.20443 = 1;
        return D.20443;
        <D.20442>:
      }
      <D.20435>:
      ifaces = mono_class_get_implemented_interfaces (klass, &error);
      D.20444 = mono_error_ok (&error);
      D.20445 = D.20444 == 0;
      D.20446 = (long int) D.20445;
      D.20447 = __builtin_expect (D.20446, 0);
      if (D.20447 != 0) goto <D.20448>; else goto <D.20449>;
      <D.20448>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 434, "mono_error_ok (&error)");
      <D.20449>:
      if (ifaces != 0B) goto <D.20450>; else goto <D.20451>;
      <D.20450>:
      {
        int i;

        i = 0;
        goto <D.18978>;
        <D.18977>:
        {
          struct MonoClass * ic;

          ic = 0B;
          D.20452 = ifaces->pdata;
          D.20453 = (long unsigned int) i;
          D.20454 = D.20453 * 8;
          D.20455 = D.20452 + D.20454;
          ic = *D.20455;
          D.20456 = ic->flags;
          D.20457 = D.20456 & 4096;
          if (D.20457 != 0) goto <D.20458>; else goto <D.20459>;
          <D.20458>:
          visible = 1;
          <D.20459>:
        }
        i = i + 1;
        <D.18978>:
        D.20460 = ifaces->len;
        i.55 = (unsigned int) i;
        if (D.20460 > i.55) goto <D.18977>; else goto <D.18979>;
        <D.18979>:
        monoeg_g_ptr_array_free (ifaces, 1);
      }
      <D.20451>:
      D.20443 = (gboolean) visible;
      return D.20443;
    }
  finally
    {
      error = {CLOBBER};
    }
}


cominterop_class_guid_equal (guint8 * guid, struct MonoClass * klass)
{
  int D.20464;
  gboolean D.20467;
  int D.20468;
  _Bool D.20469;
  guint8 klass_guid[16];

  try
    {
      D.20464 = cominterop_class_guid (klass, &klass_guid);
      if (D.20464 != 0) goto <D.20465>; else goto <D.20466>;
      <D.20465>:
      D.20468 = memcmp (guid, &klass_guid, 16);
      D.20469 = D.20468 == 0;
      D.20467 = (gboolean) D.20469;
      return D.20467;
      <D.20466>:
      D.20467 = 0;
      return D.20467;
    }
  finally
    {
      klass_guid = {CLOBBER};
    }
}


cominterop_get_com_slot_begin (struct MonoClass * klass)
{
  struct MonoClass * interface_type_attribute.56;
  struct MonoImage * D.20475;
  struct MonoClass * interface_type_attribute.57;
  int D.20479;
  unsigned int D.20484;
  int D.20486;
  static struct MonoClass * interface_type_attribute = 0B;
  struct MonoCustomAttrInfo * cinfo;
  struct MonoInterfaceTypeAttribute * itf_attr;

  cinfo = 0B;
  itf_attr = 0B;
  interface_type_attribute.56 = interface_type_attribute;
  if (interface_type_attribute.56 == 0B) goto <D.20473>; else goto <D.20474>;
  <D.20473>:
  D.20475 = mono_defaults.corlib;
  interface_type_attribute.57 = mono_class_from_name (D.20475, "System.Runtime.InteropServices", "InterfaceTypeAttribute");
  interface_type_attribute = interface_type_attribute.57;
  <D.20474>:
  cinfo = mono_custom_attrs_from_class (klass);
  if (cinfo != 0B) goto <D.20477>; else goto <D.20478>;
  <D.20477>:
  interface_type_attribute.56 = interface_type_attribute;
  itf_attr = mono_custom_attrs_get_attr (cinfo, interface_type_attribute.56);
  D.20479 = cinfo->cached;
  if (D.20479 == 0) goto <D.20480>; else goto <D.20481>;
  <D.20480>:
  mono_custom_attrs_free (cinfo);
  <D.20481>:
  <D.20478>:
  if (itf_attr != 0B) goto <D.20483>; else goto <D.20482>;
  <D.20483>:
  D.20484 = itf_attr->intType;
  if (D.20484 == 1) goto <D.20485>; else goto <D.20482>;
  <D.20485>:
  D.20486 = 3;
  return D.20486;
  <D.20482>:
  D.20486 = 7;
  return D.20486;
}


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

  D.20489 = __builtin_object_size (__dest, 0);
  D.20488 = __builtin___memcpy_chk (__dest, __src, __len, D.20489);
  return D.20488;
}


cominterop_get_managed_wrapper_adjusted (struct MonoMethod * method)
{
  short unsigned int D.20491;
  int D.20492;
  struct MonoMethod * get_hr_for_exception.58;
  struct MonoClass * D.20496;
  struct MonoMethod * get_hr_for_exception.59;
  struct MonoClass * D.20498;
  const char * D.20499;
  short unsigned int D.20500;
  int D.20501;
  int D.20502;
  long unsigned int D.20503;
  long unsigned int D.20504;
  short unsigned int D.20505;
  sizetype D.20506;
  sizetype D.20507;
  sizetype D.20508;
  struct MonoMarshalSpec * * D.20509;
  long unsigned int D.20510;
  long unsigned int D.20511;
  struct MonoMarshalSpec * * D.20512;
  struct MonoMarshalSpec * D.20513;
  struct MonoMarshalSpec * * D.20514;
  struct MonoType * D.20517;
  int D.20518;
  long unsigned int D.20521;
  long unsigned int D.20522;
  struct MonoMarshalSpec * * D.20523;
  struct MonoMarshalSpec * D.20524;
  struct MonoClass * D.20527;
  struct MonoType * D.20528;
  int D.20530;
  int D.20533;
  unsigned int D.20534;
  int D.20537;
  int D.20540;
  unsigned int D.20541;
  int D.20542;
  unsigned int D.20543;
  int D.20544;
  int D.20545;
  long unsigned int D.20550;
  long unsigned int D.20551;
  unsigned int D.20555;
  unsigned char D.20556;
  unsigned int hr.60;
  unsigned int D.20559;
  int D.20560;
  unsigned int D.20561;
  unsigned int D.20562;
  unsigned int D.20563;
  struct MonoClass * D.20564;
  int D.20565;
  unsigned int D.20566;
  long unsigned int D.20572;
  long unsigned int D.20573;
  unsigned char D.20575;
  unsigned char D.20576;
  int D.20577;
  unsigned int D.20578;
  unsigned int D.20579;
  unsigned int D.20580;
  unsigned int pos_leave.61;
  int D.20585;
  _Bool D.20588;
  long int D.20589;
  long int D.20590;
  int D.20593;
  _Bool D.20596;
  long int D.20597;
  long int D.20598;
  struct MonoMethod * D.20603;
  static struct MonoMethod * get_hr_for_exception = 0B;
  struct MonoMethod * res;
  struct MonoMethodBuilder * mb;
  struct MonoMarshalSpec * * mspecs;
  struct MonoMethodSignature * sig;
  struct MonoMethodSignature * sig_native;
  struct MonoExceptionClause * main_clause;
  int pos_leave;
  int hr;
  int i;
  gboolean preserve_sig;

  res = 0B;
  main_clause = 0B;
  hr = 0;
  D.20491 = method->iflags;
  D.20492 = (int) D.20491;
  preserve_sig = D.20492 & 128;
  get_hr_for_exception.58 = get_hr_for_exception;
  if (get_hr_for_exception.58 == 0B) goto <D.20494>; else goto <D.20495>;
  <D.20494>:
  D.20496 = mono_defaults.marshal_class;
  get_hr_for_exception.59 = mono_class_get_method_from_name (D.20496, "GetHRForException", -1);
  get_hr_for_exception = get_hr_for_exception.59;
  <D.20495>:
  sig = mono_method_signature (method);
  D.20498 = method->klass;
  D.20499 = method->name;
  mb = mono_mb_new (D.20498, D.20499, 27);
  sig_native = cominterop_method_signature (method);
  D.20500 = sig_native->param_count;
  D.20501 = (int) D.20500;
  D.20502 = D.20501 + 1;
  D.20503 = (long unsigned int) D.20502;
  D.20504 = D.20503 * 8;
  mspecs = monoeg_malloc0 (D.20504);
  mono_method_get_marshal_info (method, mspecs);
  D.20505 = sig->param_count;
  i = (int) D.20505;
  goto <D.19356>;
  <D.19355>:
  D.20506 = (sizetype) i;
  D.20507 = D.20506 + 1;
  D.20508 = D.20507 * 8;
  D.20509 = mspecs + D.20508;
  D.20510 = (long unsigned int) i;
  D.20511 = D.20510 * 8;
  D.20512 = mspecs + D.20511;
  D.20513 = *D.20512;
  *D.20509 = D.20513;
  i = i + -1;
  <D.19356>:
  if (i > 0) goto <D.19355>; else goto <D.19357>;
  <D.19357>:
  D.20514 = mspecs + 8;
  *D.20514 = 0B;
  if (preserve_sig == 0) goto <D.20515>; else goto <D.20516>;
  <D.20515>:
  D.20517 = sig->ret;
  D.20518 = mono_type_is_void (D.20517);
  if (D.20518 == 0) goto <D.20519>; else goto <D.20520>;
  <D.20519>:
  D.20500 = sig_native->param_count;
  D.20521 = (long unsigned int) D.20500;
  D.20522 = D.20521 * 8;
  D.20523 = mspecs + D.20522;
  D.20524 = *mspecs;
  *D.20523 = D.20524;
  <D.20520>:
  <D.20516>:
  *mspecs = 0B;
  if (preserve_sig == 0) goto <D.20525>; else goto <D.20526>;
  <D.20525>:
  D.20527 = mono_defaults.int32_class;
  D.20528 = &D.20527->byval_arg;
  hr = mono_mb_add_local (mb, D.20528);
  goto <D.20529>;
  <D.20526>:
  D.20517 = sig->ret;
  D.20530 = mono_type_is_void (D.20517);
  if (D.20530 == 0) goto <D.20531>; else goto <D.20532>;
  <D.20531>:
  D.20517 = sig->ret;
  hr = mono_mb_add_local (mb, D.20517);
  <D.20532>:
  <D.20529>:
  main_clause = monoeg_malloc0 (32);
  D.20533 = mono_mb_get_label (mb);
  D.20534 = (unsigned int) D.20533;
  main_clause->try_offset = D.20534;
  if (preserve_sig == 0) goto <D.20535>; else goto <D.20536>;
  <D.20535>:
  D.20517 = sig->ret;
  D.20537 = mono_type_is_void (D.20517);
  if (D.20537 == 0) goto <D.20538>; else goto <D.20539>;
  <D.20538>:
  D.20500 = sig_native->param_count;
  D.20501 = (int) D.20500;
  D.20540 = D.20501 + -1;
  D.20541 = (unsigned int) D.20540;
  mono_mb_emit_ldarg (mb, D.20541);
  <D.20539>:
  <D.20536>:
  mono_mb_emit_ldarg (mb, 0);
  mono_mb_emit_icon (mb, 0);
  mono_mb_emit_icall (mb, cominterop_get_ccw_object);
  i = 0;
  goto <D.19359>;
  <D.19358>:
  D.20542 = i + 1;
  D.20543 = (unsigned int) D.20542;
  mono_mb_emit_ldarg (mb, D.20543);
  i = i + 1;
  <D.19359>:
  D.20505 = sig->param_count;
  D.20544 = (int) D.20505;
  if (D.20544 > i) goto <D.19358>; else goto <D.19360>;
  <D.19360>:
  mono_mb_emit_managed_call (mb, method, 0B);
  D.20517 = sig->ret;
  D.20545 = mono_type_is_void (D.20517);
  if (D.20545 == 0) goto <D.20546>; else goto <D.20547>;
  <D.20546>:
  if (preserve_sig == 0) goto <D.20548>; else goto <D.20549>;
  <D.20548>:
  {
    struct MonoClass * rclass;

    D.20517 = sig->ret;
    rclass = mono_class_from_mono_type (D.20517);
    D.20550 = BIT_FIELD_REF <*rclass, 64, 256>;
    D.20551 = D.20550 & 1152921504606846976;
    if (D.20551 != 0) goto <D.20552>; else goto <D.20553>;
    <D.20552>:
    mono_mb_emit_op (mb, 129, rclass);
    goto <D.20554>;
    <D.20553>:
    D.20517 = sig->ret;
    D.20555 = mono_type_to_stind (D.20517);
    D.20556 = (unsigned char) D.20555;
    mono_mb_emit_byte (mb, D.20556);
    <D.20554>:
  }
  goto <D.20557>;
  <D.20549>:
  hr.60 = (unsigned int) hr;
  mono_mb_emit_stloc (mb, hr.60);
  <D.20557>:
  <D.20547>:
  D.20559 = mono_mb_emit_branch (mb, 221);
  pos_leave = (int) D.20559;
  main_clause->flags = 0;
  D.20560 = mono_mb_get_pos (mb);
  D.20561 = (unsigned int) D.20560;
  D.20562 = main_clause->try_offset;
  D.20563 = D.20561 - D.20562;
  main_clause->try_len = D.20563;
  D.20564 = mono_defaults.object_class;
  main_clause->data.catch_class = D.20564;
  D.20565 = mono_mb_get_label (mb);
  D.20566 = (unsigned int) D.20565;
  main_clause->handler_offset = D.20566;
  if (preserve_sig == 0) goto <D.20567>; else goto <D.20570>;
  <D.20570>:
  D.20517 = sig->ret;
  if (D.20517 != 0B) goto <D.20571>; else goto <D.20568>;
  <D.20571>:
  D.20517 = sig->ret;
  D.20572 = BIT_FIELD_REF <*D.20517, 64, 64>;
  D.20573 = D.20572 & 8589934592;
  if (D.20573 == 0) goto <D.20574>; else goto <D.20568>;
  <D.20574>:
  D.20517 = sig->ret;
  D.20575 = D.20517->type;
  D.20576 = D.20575 + 248;
  if (D.20576 <= 1) goto <D.20567>; else goto <D.20568>;
  <D.20567>:
  get_hr_for_exception.58 = get_hr_for_exception;
  mono_mb_emit_managed_call (mb, get_hr_for_exception.58, 0B);
  hr.60 = (unsigned int) hr;
  mono_mb_emit_stloc (mb, hr.60);
  goto <D.20569>;
  <D.20568>:
  mono_mb_emit_byte (mb, 38);
  <D.20569>:
  mono_mb_emit_branch (mb, 221);
  D.20577 = mono_mb_get_pos (mb);
  D.20578 = (unsigned int) D.20577;
  D.20579 = main_clause->handler_offset;
  D.20580 = D.20578 - D.20579;
  main_clause->handler_len = D.20580;
  mono_mb_set_clauses (mb, 1, main_clause);
  pos_leave.61 = (unsigned int) pos_leave;
  mono_mb_patch_branch (mb, pos_leave.61);
  if (preserve_sig == 0) goto <D.20582>; else goto <D.20584>;
  <D.20584>:
  D.20517 = sig->ret;
  D.20585 = mono_type_is_void (D.20517);
  if (D.20585 == 0) goto <D.20582>; else goto <D.20583>;
  <D.20582>:
  hr.60 = (unsigned int) hr;
  mono_mb_emit_ldloc (mb, hr.60);
  <D.20583>:
  mono_mb_emit_byte (mb, 42);
  {
    int ret;

    ret = pthread_mutex_lock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.20586>; else goto <D.20587>;
    <D.20586>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20587>:
    D.20588 = ret != 0;
    D.20589 = (long int) D.20588;
    D.20590 = __builtin_expect (D.20589, 0);
    if (D.20590 != 0) goto <D.20591>; else goto <D.20592>;
    <D.20591>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2209, "ret == 0");
    <D.20592>:
  }
  D.20500 = sig_native->param_count;
  D.20501 = (int) D.20500;
  D.20593 = D.20501 + 16;
  res = mono_mb_create_method (mb, sig_native, D.20593);
  {
    int ret;

    ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.20594>; else goto <D.20595>;
    <D.20594>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20595>:
    D.20596 = ret != 0;
    D.20597 = (long int) D.20596;
    D.20598 = __builtin_expect (D.20597, 0);
    if (D.20598 != 0) goto <D.20599>; else goto <D.20600>;
    <D.20599>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2211, "ret == 0");
    <D.20600>:
  }
  mono_mb_free (mb);
  D.20500 = sig_native->param_count;
  i = (int) D.20500;
  goto <D.19365>;
  <D.19364>:
  D.20510 = (long unsigned int) i;
  D.20511 = D.20510 * 8;
  D.20512 = mspecs + D.20511;
  D.20513 = *D.20512;
  if (D.20513 != 0B) goto <D.20601>; else goto <D.20602>;
  <D.20601>:
  D.20510 = (long unsigned int) i;
  D.20511 = D.20510 * 8;
  D.20512 = mspecs + D.20511;
  D.20513 = *D.20512;
  mono_metadata_free_marshal_spec (D.20513);
  <D.20602>:
  i = i + -1;
  <D.19365>:
  if (i >= 0) goto <D.19364>; else goto <D.19366>;
  <D.19366>:
  monoeg_g_free (mspecs);
  D.20603 = res;
  return D.20603;
}


cominterop_method_signature (struct MonoMethod * method)
{
  struct MonoClass * D.20605;
  short unsigned int D.20606;
  int D.20607;
  short unsigned int D.20608;
  int D.20609;
  struct MonoType * D.20612;
  int D.20613;
  unsigned int param_count.62;
  long unsigned int D.20617;
  long unsigned int D.20618;
  unsigned int D.20619;
  unsigned int D.20620;
  long unsigned int D.20621;
  int D.20622;
  struct MonoType * D.20623;
  struct MonoClass * D.20624;
  struct MonoType * D.20625;
  int D.20629;
  int D.20632;
  struct MonoType * D.20633;
  struct MonoType * D.20634;
  struct MonoClass * D.20635;
  struct MonoType * D.20636;
  short unsigned int D.20637;
  struct MonoMethodSignature * D.20638;
  struct MonoMethodSignature * res;
  struct MonoImage * image;
  struct MonoMethodSignature * sig;
  gboolean preserve_sig;
  int sigsize;
  int i;
  int param_count;

  D.20605 = method->klass;
  image = D.20605->image;
  sig = mono_method_signature (method);
  D.20606 = method->iflags;
  D.20607 = (int) D.20606;
  preserve_sig = D.20607 & 128;
  D.20608 = sig->param_count;
  D.20609 = (int) D.20608;
  param_count = D.20609 + 1;
  if (preserve_sig == 0) goto <D.20610>; else goto <D.20611>;
  <D.20610>:
  D.20612 = sig->ret;
  D.20613 = mono_type_is_void (D.20612);
  if (D.20613 == 0) goto <D.20614>; else goto <D.20615>;
  <D.20614>:
  param_count = param_count + 1;
  <D.20615>:
  <D.20611>:
  param_count.62 = (unsigned int) param_count;
  res = mono_metadata_signature_alloc (image, param_count.62);
  D.20608 = sig->param_count;
  D.20617 = (long unsigned int) D.20608;
  D.20618 = D.20617 + 2;
  D.20619 = (unsigned int) D.20618;
  D.20620 = D.20619 * 8;
  sigsize = (int) D.20620;
  D.20621 = (long unsigned int) sigsize;
  memcpy (res, sig, D.20621);
  D.20608 = sig->param_count;
  D.20609 = (int) D.20608;
  i = D.20609 + -1;
  goto <D.18912>;
  <D.18911>:
  D.20622 = i + 1;
  D.20623 = sig->params[i];
  res->params[D.20622] = D.20623;
  i = i + -1;
  <D.18912>:
  if (i >= 0) goto <D.18911>; else goto <D.18913>;
  <D.18913>:
  D.20624 = mono_defaults.int_class;
  D.20625 = &D.20624->byval_arg;
  res->params[0] = D.20625;
  if (preserve_sig != 0) goto <D.20626>; else goto <D.20627>;
  <D.20626>:
  D.20612 = sig->ret;
  res->ret = D.20612;
  goto <D.20628>;
  <D.20627>:
  D.20612 = sig->ret;
  D.20629 = mono_type_is_void (D.20612);
  if (D.20629 == 0) goto <D.20630>; else goto <D.20631>;
  <D.20630>:
  D.20632 = param_count + -1;
  D.20612 = sig->ret;
  D.20633 = mono_metadata_type_dup (image, D.20612);
  res->params[D.20632] = D.20633;
  D.20632 = param_count + -1;
  D.20634 = res->params[D.20632];
  D.20634->byref = 1;
  D.20632 = param_count + -1;
  D.20634 = res->params[D.20632];
  D.20634->attrs = 2;
  <D.20631>:
  D.20635 = mono_defaults.int32_class;
  D.20636 = &D.20635->byval_arg;
  res->ret = D.20636;
  <D.20628>:
  res->pinvoke = 0;
  res->hasthis = 0;
  D.20637 = (short unsigned int) param_count;
  res->param_count = D.20637;
  res->call_convention = 1;
  D.20638 = res;
  return D.20638;
}


cominterop_setup_marshal_context (struct EmitMarshalContext * m, struct MonoMethod * method)
{
  struct MonoClass * D.20640;
  struct MonoImage * D.20641;
  struct MonoMethodSignature * sig;
  struct MonoMethodSignature * csig;

  sig = mono_method_signature (method);
  D.20640 = method->klass;
  D.20641 = D.20640->image;
  csig = mono_metadata_signature_dup_full (D.20641, sig);
  csig->call_convention = 1;
  csig->hasthis = 0;
  csig->pinvoke = 1;
  D.20640 = method->klass;
  D.20641 = D.20640->image;
  m->image = D.20641;
  m->piinfo = 0B;
  m->retobj_var = 0;
  m->sig = sig;
  m->csig = csig;
}


cominterop_object_is_rcw (struct MonoObject * obj)
{
  gboolean D.20644;
  struct MonoVTable * D.20645;
  struct MonoClass * D.20646;
  struct MonoVTable * D.20651;
  int iftmp.63;
  struct MonoClass * D.20656;
  struct MonoClass * klass;
  struct MonoRealProxy * real_proxy;

  klass = 0B;
  real_proxy = 0B;
  if (obj == 0B) goto <D.20642>; else goto <D.20643>;
  <D.20642>:
  D.20644 = 0;
  return D.20644;
  <D.20643>:
  D.20645 = obj->vtable;
  klass = D.20645->klass;
  D.20646 = mono_defaults.transparent_proxy_class;
  if (D.20646 != klass) goto <D.20647>; else goto <D.20648>;
  <D.20647>:
  D.20644 = 0;
  return D.20644;
  <D.20648>:
  real_proxy = MEM[(struct MonoTransparentProxy *)obj].rp;
  if (real_proxy == 0B) goto <D.20649>; else goto <D.20650>;
  <D.20649>:
  D.20644 = 0;
  return D.20644;
  <D.20650>:
  D.20651 = MEM[(struct MonoObject *)real_proxy].vtable;
  klass = D.20651->klass;
  if (klass != 0B) goto <D.20655>; else goto <D.20653>;
  <D.20655>:
  D.20656 = mono_class_get_interop_proxy_class ();
  if (D.20656 == klass) goto <D.20657>; else goto <D.20653>;
  <D.20657>:
  iftmp.63 = 1;
  goto <D.20654>;
  <D.20653>:
  iftmp.63 = 0;
  <D.20654>:
  D.20644 = iftmp.63;
  return D.20644;
}


cominterop_get_function_pointer (void * itf, int slot)
{
  void * * D.20659;
  long unsigned int D.20660;
  long unsigned int D.20661;
  void * * D.20662;
  void * D.20663;
  void * func;

  D.20659 = MEM[(void * * *)itf];
  D.20660 = (long unsigned int) slot;
  D.20661 = D.20660 * 8;
  D.20662 = D.20659 + D.20661;
  func = *D.20662;
  D.20663 = func;
  return D.20663;
}


cominterop_get_method_interface (struct MonoMethod * method)
{
  struct MonoClass * D.20665;
  unsigned int D.20666;
  unsigned int D.20667;
  unsigned char D.20670;
  int D.20675;
  _Bool D.20676;
  long int D.20677;
  long int D.20678;
  void * * D.20683;
  long unsigned int D.20684;
  long unsigned int D.20685;
  void * * D.20686;
  struct MonoMethod * * D.20687;
  int D.20688;
  long unsigned int D.20689;
  long unsigned int D.20690;
  struct MonoMethod * * D.20691;
  struct MonoMethod * D.20692;
  unsigned int D.20695;
  unsigned int j.64;
  unsigned int D.20698;
  unsigned int i.65;
  _Bool D.20702;
  long int D.20703;
  long int D.20704;
  int iftmp.66;
  unsigned int D.20710;
  unsigned int D.20711;
  unsigned char D.20713;
  _Bool D.20716;
  long int D.20717;
  long int D.20718;
  struct MonoClass * D.20721;
  struct MonoError error;
  struct MonoClass * ic;

  try
    {
      ic = method->klass;
      D.20665 = method->klass;
      D.20666 = D.20665->flags;
      D.20667 = D.20666 & 32;
      if (D.20667 == 0) goto <D.20668>; else goto <D.20669>;
      <D.20668>:
      D.20665 = method->klass;
      D.20670 = D.20665->byval_arg.type;
      if (D.20670 != 19) goto <D.20671>; else goto <D.20672>;
      <D.20671>:
      D.20665 = method->klass;
      D.20670 = D.20665->byval_arg.type;
      if (D.20670 != 30) goto <D.20673>; else goto <D.20674>;
      <D.20673>:
      {
        struct GPtrArray * ifaces;

        D.20665 = method->klass;
        ifaces = mono_class_get_implemented_interfaces (D.20665, &error);
        D.20675 = mono_error_ok (&error);
        D.20676 = D.20675 == 0;
        D.20677 = (long int) D.20676;
        D.20678 = __builtin_expect (D.20677, 0);
        if (D.20678 != 0) goto <D.20679>; else goto <D.20680>;
        <D.20679>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 315, "mono_error_ok (&error)");
        <D.20680>:
        if (ifaces != 0B) goto <D.20681>; else goto <D.20682>;
        <D.20681>:
        {
          int i;

          D.20665 = method->klass;
          mono_class_setup_vtable (D.20665);
          i = 0;
          goto <D.18945>;
          <D.18944>:
          {
            int j;
            int offset;
            gboolean found;

            found = 0;
            D.20683 = ifaces->pdata;
            D.20684 = (long unsigned int) i;
            D.20685 = D.20684 * 8;
            D.20686 = D.20683 + D.20685;
            ic = *D.20686;
            D.20665 = method->klass;
            offset = mono_class_interface_offset (D.20665, ic);
            j = 0;
            goto <D.18942>;
            <D.18941>:
            D.20665 = method->klass;
            D.20687 = D.20665->vtable;
            D.20688 = j + offset;
            D.20689 = (long unsigned int) D.20688;
            D.20690 = D.20689 * 8;
            D.20691 = D.20687 + D.20690;
            D.20692 = *D.20691;
            if (D.20692 == method) goto <D.20693>; else goto <D.20694>;
            <D.20693>:
            found = 1;
            goto <D.18940>;
            <D.20694>:
            j = j + 1;
            <D.18942>:
            D.20695 = ic->method.count;
            j.64 = (unsigned int) j;
            if (D.20695 > j.64) goto <D.18941>; else goto <D.18940>;
            <D.18940>:
            if (found != 0) goto <D.18943>; else goto <D.20697>;
            <D.20697>:
            ic = 0B;
          }
          i = i + 1;
          <D.18945>:
          D.20698 = ifaces->len;
          i.65 = (unsigned int) i;
          if (D.20698 > i.65) goto <D.18944>; else goto <D.18943>;
          <D.18943>:
          monoeg_g_ptr_array_free (ifaces, 1);
        }
        <D.20682>:
      }
      <D.20674>:
      <D.20672>:
      <D.20669>:
      if (ic == 0B) goto <D.20700>; else goto <D.20701>;
      <D.20700>:
      D.20702 = ic == 0B;
      D.20703 = (long int) D.20702;
      D.20704 = __builtin_expect (D.20703, 0);
      if (D.20704 != 0) goto <D.20705>; else goto <D.20706>;
      <D.20705>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 339, "ic");
      <D.20706>:
      <D.20701>:
      D.20710 = ic->flags;
      D.20711 = D.20710 & 32;
      if (D.20711 == 0) goto <D.20712>; else goto <D.20708>;
      <D.20712>:
      D.20713 = ic->byval_arg.type;
      if (D.20713 != 19) goto <D.20714>; else goto <D.20708>;
      <D.20714>:
      D.20713 = ic->byval_arg.type;
      if (D.20713 != 30) goto <D.20715>; else goto <D.20708>;
      <D.20715>:
      iftmp.66 = 1;
      goto <D.20709>;
      <D.20708>:
      iftmp.66 = 0;
      <D.20709>:
      D.20716 = iftmp.66 != 0;
      D.20717 = (long int) D.20716;
      D.20718 = __builtin_expect (D.20717, 0);
      if (D.20718 != 0) goto <D.20719>; else goto <D.20720>;
      <D.20719>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 340, "MONO_CLASS_IS_INTERFACE (ic)");
      <D.20720>:
      D.20721 = ic;
      return D.20721;
    }
  finally
    {
      error = {CLOBBER};
    }
}


__attribute__((__gnu_inline__, nothrow, leaf, pure))
strcmp (const char * __s1, const char * __s2)
{
  int iftmp.67;
  int iftmp.68;
  int D.20732;
  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.20725>; else goto <D.20726>;
  <D.20725>:
  if (__ret == 1) goto <D.20728>; else goto <D.20729>;
  <D.20728>:
  iftmp.68 = -1;
  goto <D.20730>;
  <D.20729>:
  iftmp.68 = 1;
  <D.20730>:
  iftmp.67 = iftmp.68;
  goto <D.20731>;
  <D.20726>:
  iftmp.67 = 0;
  <D.20731>:
  __ret = iftmp.67;
  D.20732 = __ret;
  return D.20732;
}


register_icall (void * func, const char * name, const char * sigstr, gboolean save)
{
  struct MonoMethodSignature * sig;

  sig = mono_create_icall_signature (sigstr);
  mono_register_jit_icall (func, name, sig, save);
}


__attribute__((visibility ("hidden")))
mono_cominterop_cleanup ()
{
  DeleteCriticalSection (&cominterop_mutex);
}


__attribute__((visibility ("hidden")))
mono_mb_emit_cominterop_call (struct MonoMethodBuilder * mb, struct MonoMethodSignature * sig, struct MonoMethod * method)
{
  int D.20734;

  mono_mb_emit_ldarg (mb, 0);
  D.20734 = cominterop_get_com_slot_for_method (method);
  mono_mb_emit_icon (mb, D.20734);
  mono_mb_emit_icall (mb, cominterop_get_function_pointer);
  mono_mb_emit_byte (mb, 240);
  mono_mb_emit_byte (mb, 9);
  mono_mb_emit_calli (mb, sig);
  mono_mb_emit_byte (mb, 240);
  mono_mb_emit_byte (mb, 10);
}


cominterop_get_com_slot_for_method (struct MonoMethod * method)
{
  short int D.20735;
  unsigned int D.20736;
  unsigned int D.20737;
  unsigned char D.20740;
  struct MonoClass * D.20745;
  _Bool D.20746;
  long int D.20747;
  long int D.20748;
  struct MonoMethod * * D.20751;
  int D.20752;
  long unsigned int D.20753;
  long unsigned int D.20754;
  struct MonoMethod * * D.20755;
  struct MonoMethod * D.20756;
  struct MonoMethod * * D.20759;
  long unsigned int D.20760;
  long unsigned int D.20761;
  struct MonoMethod * * D.20762;
  struct MonoMethod * D.20763;
  short int D.20764;
  unsigned int D.20765;
  unsigned int i.69;
  _Bool D.20767;
  long int D.20768;
  long int D.20769;
  int iftmp.70;
  _Bool D.20778;
  long int D.20779;
  long int D.20780;
  int D.20783;
  int D.20784;
  unsigned int D.20785;
  unsigned int D.20786;
  guint32 slot;
  struct MonoClass * ic;

  D.20735 = method->slot;
  slot = (guint32) D.20735;
  ic = method->klass;
  D.20736 = ic->flags;
  D.20737 = D.20736 & 32;
  if (D.20737 == 0) goto <D.20738>; else goto <D.20739>;
  <D.20738>:
  D.20740 = ic->byval_arg.type;
  if (D.20740 != 19) goto <D.20741>; else goto <D.20742>;
  <D.20741>:
  D.20740 = ic->byval_arg.type;
  if (D.20740 != 30) goto <D.20743>; else goto <D.20744>;
  <D.20743>:
  {
    int offset;
    int i;

    offset = 0;
    i = 0;
    ic = cominterop_get_method_interface (method);
    D.20745 = method->klass;
    offset = mono_class_interface_offset (D.20745, ic);
    D.20746 = offset < 0;
    D.20747 = (long int) D.20746;
    D.20748 = __builtin_expect (D.20747, 0);
    if (D.20748 != 0) goto <D.20749>; else goto <D.20750>;
    <D.20749>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 363, "offset >= 0");
    <D.20750>:
    i = 0;
    goto <D.18955>;
    <D.18954>:
    D.20745 = method->klass;
    D.20751 = D.20745->vtable;
    D.20752 = i + offset;
    D.20753 = (long unsigned int) D.20752;
    D.20754 = D.20753 * 8;
    D.20755 = D.20751 + D.20754;
    D.20756 = *D.20755;
    if (D.20756 == method) goto <D.20757>; else goto <D.20758>;
    <D.20757>:
    D.20759 = ic->methods;
    D.20760 = (long unsigned int) i;
    D.20761 = D.20760 * 8;
    D.20762 = D.20759 + D.20761;
    D.20763 = *D.20762;
    D.20764 = D.20763->slot;
    slot = (guint32) D.20764;
    goto <D.18953>;
    <D.20758>:
    i = i + 1;
    <D.18955>:
    D.20765 = ic->method.count;
    i.69 = (unsigned int) i;
    if (D.20765 > i.69) goto <D.18954>; else goto <D.18953>;
    <D.18953>:
  }
  <D.20744>:
  <D.20742>:
  <D.20739>:
  D.20767 = ic == 0B;
  D.20768 = (long int) D.20767;
  D.20769 = __builtin_expect (D.20768, 0);
  if (D.20769 != 0) goto <D.20770>; else goto <D.20771>;
  <D.20770>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 373, "ic");
  <D.20771>:
  D.20736 = ic->flags;
  D.20737 = D.20736 & 32;
  if (D.20737 == 0) goto <D.20775>; else goto <D.20773>;
  <D.20775>:
  D.20740 = ic->byval_arg.type;
  if (D.20740 != 19) goto <D.20776>; else goto <D.20773>;
  <D.20776>:
  D.20740 = ic->byval_arg.type;
  if (D.20740 != 30) goto <D.20777>; else goto <D.20773>;
  <D.20777>:
  iftmp.70 = 1;
  goto <D.20774>;
  <D.20773>:
  iftmp.70 = 0;
  <D.20774>:
  D.20778 = iftmp.70 != 0;
  D.20779 = (long int) D.20778;
  D.20780 = __builtin_expect (D.20779, 0);
  if (D.20780 != 0) goto <D.20781>; else goto <D.20782>;
  <D.20781>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 374, "MONO_CLASS_IS_INTERFACE (ic)");
  <D.20782>:
  D.20784 = cominterop_get_com_slot_begin (ic);
  D.20785 = (unsigned int) D.20784;
  D.20786 = D.20785 + slot;
  D.20783 = (int) D.20786;
  return D.20783;
}


__attribute__((visibility ("hidden")))
mono_cominterop_emit_ptr_to_object_conv (struct MonoMethodBuilder * mb, struct MonoType * type, MonoMarshalConv conv, struct MonoMarshalSpec * mspec)
{
  struct MonoClass * com_interop_proxy_class.71;
  struct MonoImage * D.20791;
  struct MonoClass * com_interop_proxy_class.72;
  struct MonoMethod * com_interop_proxy_get_proxy.73;
  struct MonoMethod * com_interop_proxy_get_proxy.74;
  struct MonoMethod * get_transparent_proxy.75;
  struct MonoClass * D.20800;
  struct MonoMethod * get_transparent_proxy.76;
  struct MonoType * D.20802;
  struct MonoClass * D.20803;
  struct MonoType * D.20804;
  _Bool D.20807;
  long int D.20808;
  long int D.20809;

  switch (conv) <default: <D.19038>, case 25: <D.19026>, case 26: <D.19028>, case 27: <D.19027>>
  <D.19026>:
  <D.19027>:
  <D.19028>:
  {
    static struct MonoClass * com_interop_proxy_class = 0B;
    static struct MonoMethod * com_interop_proxy_get_proxy = 0B;
    static struct MonoMethod * get_transparent_proxy = 0B;
    int real_proxy;
    guint32 pos_null;
    guint32 pos_ccw;
    guint32 pos_end;
    struct MonoClass * klass;

    pos_null = 0;
    pos_ccw = 0;
    pos_end = 0;
    klass = 0B;
    klass = mono_class_from_mono_type (type);
    mono_mb_emit_ldloc (mb, 1);
    mono_mb_emit_byte (mb, 20);
    mono_mb_emit_byte (mb, 81);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 77);
    pos_null = mono_mb_emit_short_branch (mb, 44);
    mono_mb_emit_ldloc (mb, 1);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 77);
    mono_mb_emit_icon (mb, 1);
    mono_mb_emit_icall (mb, cominterop_get_ccw_object);
    pos_ccw = mono_mb_emit_short_branch (mb, 45);
    com_interop_proxy_class.71 = com_interop_proxy_class;
    if (com_interop_proxy_class.71 == 0B) goto <D.20789>; else goto <D.20790>;
    <D.20789>:
    D.20791 = mono_defaults.corlib;
    com_interop_proxy_class.72 = mono_class_from_name (D.20791, "Mono.Interop", "ComInteropProxy");
    com_interop_proxy_class = com_interop_proxy_class.72;
    <D.20790>:
    com_interop_proxy_get_proxy.73 = com_interop_proxy_get_proxy;
    if (com_interop_proxy_get_proxy.73 == 0B) goto <D.20794>; else goto <D.20795>;
    <D.20794>:
    com_interop_proxy_class.71 = com_interop_proxy_class;
    com_interop_proxy_get_proxy.74 = mono_class_get_method_from_name_flags (com_interop_proxy_class.71, "GetProxy", 2, 1);
    com_interop_proxy_get_proxy = com_interop_proxy_get_proxy.74;
    <D.20795>:
    get_transparent_proxy.75 = get_transparent_proxy;
    if (get_transparent_proxy.75 == 0B) goto <D.20798>; else goto <D.20799>;
    <D.20798>:
    D.20800 = mono_defaults.real_proxy_class;
    get_transparent_proxy.76 = mono_class_get_method_from_name (D.20800, "GetTransparentProxy", 0);
    get_transparent_proxy = get_transparent_proxy.76;
    <D.20799>:
    com_interop_proxy_class.71 = com_interop_proxy_class;
    D.20802 = &com_interop_proxy_class.71->byval_arg;
    real_proxy = mono_mb_add_local (mb, D.20802);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 77);
    D.20803 = mono_class_get_com_object_class ();
    D.20804 = &D.20803->byval_arg;
    mono_mb_emit_ptr (mb, D.20804);
    mono_mb_emit_icall (mb, cominterop_type_from_handle);
    com_interop_proxy_get_proxy.73 = com_interop_proxy_get_proxy;
    mono_mb_emit_managed_call (mb, com_interop_proxy_get_proxy.73, 0B);
    get_transparent_proxy.75 = get_transparent_proxy;
    mono_mb_emit_managed_call (mb, get_transparent_proxy.75, 0B);
    if (conv == 25) goto <D.20805>; else goto <D.20806>;
    <D.20805>:
    D.20807 = klass == 0B;
    D.20808 = (long int) D.20807;
    D.20809 = __builtin_expect (D.20808, 0);
    if (D.20809 != 0) goto <D.20810>; else goto <D.20811>;
    <D.20810>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 631, "klass");
    <D.20811>:
    mono_mb_emit_op (mb, 116, klass);
    <D.20806>:
    mono_mb_emit_byte (mb, 81);
    pos_end = mono_mb_emit_short_branch (mb, 43);
    mono_mb_patch_short_branch (mb, pos_ccw);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 77);
    mono_mb_emit_icon (mb, 1);
    mono_mb_emit_icall (mb, cominterop_get_ccw_object);
    if (conv == 25) goto <D.20812>; else goto <D.20813>;
    <D.20812>:
    D.20807 = klass == 0B;
    D.20808 = (long int) D.20807;
    D.20809 = __builtin_expect (D.20808, 0);
    if (D.20809 != 0) goto <D.20814>; else goto <D.20815>;
    <D.20814>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 645, "klass");
    <D.20815>:
    mono_mb_emit_op (mb, 116, klass);
    <D.20813>:
    mono_mb_emit_byte (mb, 81);
    mono_mb_patch_short_branch (mb, pos_end);
    mono_mb_patch_short_branch (mb, pos_null);
    goto <D.19037>;
  }
  <D.19038>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 656);
  <D.19037>:
}


__attribute__((visibility ("hidden")))
mono_cominterop_emit_object_to_ptr_conv (struct MonoMethodBuilder * mb, struct MonoType * type, MonoMarshalConv conv, struct MonoMarshalSpec * mspec)
{
  struct MonoClass * D.20818;
  struct MonoProperty * iunknown.77;
  struct MonoClass * D.20825;
  struct MonoProperty * iunknown.78;
  struct MonoMethod * D.20827;
  struct MonoProperty * idispatch.79;
  struct MonoClass * D.20834;
  struct MonoProperty * idispatch.80;
  struct MonoMethod * D.20836;
  struct MonoClass * D.20840;
  struct MonoClass * D.20844;
  struct MonoClass * D.20848;

  switch (conv) <default: <D.19054>, case 25: <D.19045>, case 26: <D.19046>, case 27: <D.19047>>
  <D.19045>:
  <D.19046>:
  <D.19047>:
  {
    guint32 pos_null;
    guint32 pos_rcw;
    guint32 pos_end;

    pos_null = 0;
    pos_rcw = 0;
    pos_end = 0;
    mono_mb_emit_ldloc (mb, 1);
    mono_mb_emit_icon (mb, 0);
    mono_mb_emit_byte (mb, 224);
    mono_mb_emit_byte (mb, 223);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 80);
    pos_null = mono_mb_emit_short_branch (mb, 44);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 80);
    mono_mb_emit_icall (mb, cominterop_object_is_rcw);
    pos_rcw = mono_mb_emit_short_branch (mb, 44);
    mono_mb_emit_ldloc (mb, 1);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 80);
    mono_mb_emit_ldflda (mb, 16);
    mono_mb_emit_byte (mb, 80);
    mono_mb_emit_ldflda (mb, 80);
    mono_mb_emit_byte (mb, 80);
    if (conv == 25) goto <D.20816>; else goto <D.20817>;
    <D.20816>:
    D.20818 = mono_type_get_class (type);
    mono_mb_emit_ptr (mb, D.20818);
    mono_mb_emit_icon (mb, 1);
    mono_mb_emit_icall (mb, cominterop_get_interface);
    goto <D.20819>;
    <D.20817>:
    if (conv == 27) goto <D.20820>; else goto <D.20821>;
    <D.20820>:
    {
      static struct MonoProperty * iunknown = 0B;

      iunknown.77 = iunknown;
      if (iunknown.77 == 0B) goto <D.20823>; else goto <D.20824>;
      <D.20823>:
      D.20825 = mono_class_get_com_object_class ();
      iunknown.78 = mono_class_get_property_from_name (D.20825, "IUnknown");
      iunknown = iunknown.78;
      <D.20824>:
      iunknown.77 = iunknown;
      D.20827 = iunknown.77->get;
      mono_mb_emit_managed_call (mb, D.20827, 0B);
    }
    goto <D.20828>;
    <D.20821>:
    if (conv == 26) goto <D.20829>; else goto <D.20830>;
    <D.20829>:
    {
      static struct MonoProperty * idispatch = 0B;

      idispatch.79 = idispatch;
      if (idispatch.79 == 0B) goto <D.20832>; else goto <D.20833>;
      <D.20832>:
      D.20834 = mono_class_get_com_object_class ();
      idispatch.80 = mono_class_get_property_from_name (D.20834, "IDispatch");
      idispatch = idispatch.80;
      <D.20833>:
      idispatch.79 = idispatch;
      D.20836 = idispatch.79->get;
      mono_mb_emit_managed_call (mb, D.20836, 0B);
    }
    goto <D.20837>;
    <D.20830>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 719);
    <D.20837>:
    <D.20828>:
    <D.20819>:
    mono_mb_emit_byte (mb, 223);
    pos_end = mono_mb_emit_short_branch (mb, 43);
    mono_mb_patch_short_branch (mb, pos_rcw);
    mono_mb_emit_ldloc (mb, 1);
    mono_mb_emit_ldloc (mb, 0);
    mono_mb_emit_byte (mb, 80);
    if (conv == 25) goto <D.20838>; else goto <D.20839>;
    <D.20838>:
    D.20840 = mono_type_get_class (type);
    mono_mb_emit_ptr (mb, D.20840);
    goto <D.20841>;
    <D.20839>:
    if (conv == 27) goto <D.20842>; else goto <D.20843>;
    <D.20842>:
    D.20844 = mono_class_get_iunknown_class ();
    mono_mb_emit_ptr (mb, D.20844);
    goto <D.20845>;
    <D.20843>:
    if (conv == 26) goto <D.20846>; else goto <D.20847>;
    <D.20846>:
    D.20848 = mono_class_get_idispatch_class ();
    mono_mb_emit_ptr (mb, D.20848);
    goto <D.20849>;
    <D.20847>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 739);
    <D.20849>:
    <D.20845>:
    <D.20841>:
    mono_mb_emit_icall (mb, cominterop_get_ccw);
    mono_mb_emit_byte (mb, 223);
    mono_mb_patch_short_branch (mb, pos_end);
    mono_mb_patch_short_branch (mb, pos_null);
    goto <D.19053>;
  }
  <D.19054>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 748);
  <D.19053>:
}


__attribute__((visibility ("hidden")))
mono_cominterop_get_native_wrapper (struct MonoMethod * method)
{
  _Bool D.20850;
  long int D.20851;
  long int D.20852;
  struct MonoClass * D.20855;
  struct MonoImage * D.20856;
  struct GHashTable * * D.20857;
  struct MonoMethod * D.20860;
  struct MonoMethod * * D.20861;
  struct MonoMethod * * D.20864;
  unsigned char D.20867;
  _Bool D.20868;
  long int D.20869;
  long int D.20870;
  const char * D.20873;
  unsigned int D.20874;
  unsigned int D.20875;
  int D.20878;
  struct MonoMethod * ctor.81;
  struct MonoClass * D.20884;
  struct MonoMethod * ctor.82;
  short unsigned int D.20887;
  int D.20888;
  struct MonoClass * D.20889;
  struct MonoType * D.20890;
  struct MonoType * D.20891;
  int D.20892;
  unsigned int ptr_this.83;
  unsigned int i.84;
  short unsigned int D.20897;
  int D.20898;
  int D.20899;
  unsigned int retval.85;
  struct MonoMethod * ThrowExceptionForHR.86;
  struct MonoClass * D.20910;
  struct MonoMethod * ThrowExceptionForHR.87;
  int D.20912;
  short unsigned int D.20916;
  int D.20917;
  int D.20918;
  struct MonoMethod * res;
  struct GHashTable * cache;
  struct MonoMethodBuilder * mb;
  struct MonoMethodSignature * sig;
  struct MonoMethodSignature * csig;

  D.20850 = method == 0B;
  D.20851 = (long int) D.20850;
  D.20852 = __builtin_expect (D.20851, 0);
  if (D.20852 != 0) goto <D.20853>; else goto <D.20854>;
  <D.20853>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 869, "method");
  <D.20854>:
  D.20855 = method->klass;
  D.20856 = D.20855->image;
  D.20857 = &D.20856->cominterop_wrapper_cache;
  cache = mono_marshal_get_cache (D.20857, mono_aligned_addr_hash, 0B);
  res = mono_marshal_find_in_cache (cache, method);
  if (res != 0B) goto <D.20858>; else goto <D.20859>;
  <D.20858>:
  D.20860 = res;
  return D.20860;
  <D.20859>:
  D.20855 = method->klass;
  D.20861 = D.20855->vtable;
  if (D.20861 == 0B) goto <D.20862>; else goto <D.20863>;
  <D.20862>:
  D.20855 = method->klass;
  mono_class_setup_vtable (D.20855);
  <D.20863>:
  D.20855 = method->klass;
  D.20864 = D.20855->methods;
  if (D.20864 == 0B) goto <D.20865>; else goto <D.20866>;
  <D.20865>:
  D.20855 = method->klass;
  mono_class_setup_methods (D.20855);
  <D.20866>:
  D.20855 = method->klass;
  D.20867 = D.20855->exception_type;
  D.20868 = D.20867 != 0;
  D.20869 = (long int) D.20868;
  D.20870 = __builtin_expect (D.20869, 0);
  if (D.20870 != 0) goto <D.20871>; else goto <D.20872>;
  <D.20871>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 880, "!method->klass->exception_type");
  <D.20872>:
  sig = mono_method_signature (method);
  D.20855 = method->klass;
  D.20873 = method->name;
  mb = mono_mb_new (D.20855, D.20873, 27);
  D.20855 = method->klass;
  D.20874 = D.20855->flags;
  D.20875 = D.20874 & 4096;
  if (D.20875 != 0) goto <D.20876>; else goto <D.20877>;
  <D.20876>:
  D.20873 = method->name;
  D.20878 = strcmp (D.20873, ".ctor");
  if (D.20878 == 0) goto <D.20879>; else goto <D.20880>;
  <D.20879>:
  {
    static struct MonoMethod * ctor = 0B;

    ctor.81 = ctor;
    if (ctor.81 == 0B) goto <D.20882>; else goto <D.20883>;
    <D.20882>:
    D.20884 = mono_class_get_com_object_class ();
    ctor.82 = mono_class_get_method_from_name (D.20884, ".ctor", 0);
    ctor = ctor.82;
    <D.20883>:
    mono_mb_emit_ldarg (mb, 0);
    ctor.81 = ctor;
    mono_mb_emit_managed_call (mb, ctor.81, 0B);
    mono_mb_emit_byte (mb, 42);
  }
  goto <D.20886>;
  <D.20880>:
  {
    static struct MonoMethod * ThrowExceptionForHR = 0B;
    struct MonoMethod * adjusted_method;
    int retval;
    int ptr_this;
    int i;
    gboolean preserve_sig;

    retval = 0;
    D.20887 = method->iflags;
    D.20888 = (int) D.20887;
    preserve_sig = D.20888 & 128;
    D.20889 = mono_defaults.int_class;
    D.20890 = &D.20889->byval_arg;
    ptr_this = mono_mb_add_local (mb, D.20890);
    D.20891 = sig->ret;
    D.20892 = mono_type_is_void (D.20891);
    if (D.20892 == 0) goto <D.20893>; else goto <D.20894>;
    <D.20893>:
    D.20891 = sig->ret;
    retval = mono_mb_add_local (mb, D.20891);
    <D.20894>:
    mono_mb_emit_ldarg (mb, 0);
    mono_mb_emit_ptr (mb, method);
    mono_mb_emit_icall (mb, cominterop_get_method_interface);
    mono_mb_emit_icon (mb, 1);
    mono_mb_emit_icall (mb, cominterop_get_interface);
    ptr_this.83 = (unsigned int) ptr_this;
    mono_mb_emit_stloc (mb, ptr_this.83);
    ptr_this.83 = (unsigned int) ptr_this;
    mono_mb_emit_ldloc (mb, ptr_this.83);
    i = 1;
    goto <D.19091>;
    <D.19090>:
    i.84 = (unsigned int) i;
    mono_mb_emit_ldarg (mb, i.84);
    i = i + 1;
    <D.19091>:
    D.20897 = sig->param_count;
    D.20898 = (int) D.20897;
    if (D.20898 >= i) goto <D.19090>; else goto <D.19092>;
    <D.19092>:
    D.20891 = sig->ret;
    D.20899 = mono_type_is_void (D.20891);
    if (D.20899 == 0) goto <D.20900>; else goto <D.20901>;
    <D.20900>:
    if (preserve_sig == 0) goto <D.20902>; else goto <D.20903>;
    <D.20902>:
    retval.85 = (unsigned int) retval;
    mono_mb_emit_ldloc_addr (mb, retval.85);
    <D.20903>:
    <D.20901>:
    adjusted_method = cominterop_get_native_wrapper_adjusted (method);
    mono_mb_emit_managed_call (mb, adjusted_method, 0B);
    if (preserve_sig == 0) goto <D.20905>; else goto <D.20906>;
    <D.20905>:
    ThrowExceptionForHR.86 = ThrowExceptionForHR;
    if (ThrowExceptionForHR.86 == 0B) goto <D.20908>; else goto <D.20909>;
    <D.20908>:
    D.20910 = mono_defaults.marshal_class;
    ThrowExceptionForHR.87 = mono_class_get_method_from_name (D.20910, "ThrowExceptionForHR", 1);
    ThrowExceptionForHR = ThrowExceptionForHR.87;
    <D.20909>:
    ThrowExceptionForHR.86 = ThrowExceptionForHR;
    mono_mb_emit_managed_call (mb, ThrowExceptionForHR.86, 0B);
    D.20891 = sig->ret;
    D.20912 = mono_type_is_void (D.20891);
    if (D.20912 == 0) goto <D.20913>; else goto <D.20914>;
    <D.20913>:
    retval.85 = (unsigned int) retval;
    mono_mb_emit_ldloc (mb, retval.85);
    <D.20914>:
    <D.20906>:
    mono_mb_emit_byte (mb, 42);
  }
  <D.20886>:
  goto <D.20915>;
  <D.20877>:
  {
    char * msg;

    msg = monoeg_strdup ("non imported interfaces on \t\t\timported classes is not yet implemented.");
    mono_mb_emit_exception (mb, "NotSupportedException", msg);
  }
  <D.20915>:
  D.20855 = method->klass;
  D.20856 = D.20855->image;
  csig = mono_metadata_signature_dup_full (D.20856, sig);
  csig->pinvoke = 0;
  D.20916 = csig->param_count;
  D.20917 = (int) D.20916;
  D.20918 = D.20917 + 16;
  res = mono_mb_create_and_cache (cache, method, mb, csig, D.20918);
  mono_mb_free (mb);
  D.20860 = res;
  return D.20860;
}


cominterop_get_native_wrapper_adjusted (struct MonoMethod * method)
{
  struct MonoClass * D.20920;
  const char * D.20921;
  short unsigned int D.20922;
  int D.20923;
  int D.20924;
  long unsigned int D.20925;
  long unsigned int D.20926;
  short unsigned int D.20927;
  sizetype D.20928;
  sizetype D.20929;
  sizetype D.20930;
  struct MonoMarshalSpec * * D.20931;
  long unsigned int D.20932;
  long unsigned int D.20933;
  struct MonoMarshalSpec * * D.20934;
  struct MonoMarshalSpec * D.20935;
  struct MonoMarshalSpec * * D.20936;
  short unsigned int D.20937;
  int D.20938;
  int D.20939;
  struct MonoType * D.20942;
  int D.20943;
  long unsigned int D.20946;
  long unsigned int D.20947;
  struct MonoMarshalSpec * * D.20948;
  struct MonoMarshalSpec * D.20949;
  long unsigned int D.20950;
  long unsigned int D.20951;
  struct MonoMarshalSpec * * D.20952;
  struct MonoMarshalSpec * D.20953;
  struct MonoType * D.20956;
  unsigned char D.20957;
  void * D.20960;
  void * D.20964;
  void * D.20968;
  void * D.20972;
  int D.20975;
  unsigned char D.20980;
  void * D.20983;
  void * D.20987;
  void * D.20991;
  void * D.20995;
  struct MonoImage * D.20996;
  void * D.20997;
  int D.20998;
  struct MonoMethod * D.21001;
  struct MonoMethod * res;
  struct MonoMethodBuilder * mb_native;
  struct MonoMarshalSpec * * mspecs;
  struct MonoMethodSignature * sig;
  struct MonoMethodSignature * sig_native;
  struct MonoMethodPInvoke * piinfo;
  int i;

  piinfo = method;
  sig = mono_method_signature (method);
  D.20920 = method->klass;
  D.20921 = method->name;
  mb_native = mono_mb_new (D.20920, D.20921, 6);
  sig_native = cominterop_method_signature (method);
  D.20922 = sig_native->param_count;
  D.20923 = (int) D.20922;
  D.20924 = D.20923 + 1;
  D.20925 = (long unsigned int) D.20924;
  D.20926 = D.20925 * 8;
  mspecs = monoeg_malloc (D.20926);
  D.20922 = sig_native->param_count;
  D.20923 = (int) D.20922;
  D.20924 = D.20923 + 1;
  D.20925 = (long unsigned int) D.20924;
  D.20926 = D.20925 * 8;
  memset (mspecs, 0, D.20926);
  mono_method_get_marshal_info (method, mspecs);
  D.20927 = sig->param_count;
  i = (int) D.20927;
  goto <D.19066>;
  <D.19065>:
  D.20928 = (sizetype) i;
  D.20929 = D.20928 + 1;
  D.20930 = D.20929 * 8;
  D.20931 = mspecs + D.20930;
  D.20932 = (long unsigned int) i;
  D.20933 = D.20932 * 8;
  D.20934 = mspecs + D.20933;
  D.20935 = *D.20934;
  *D.20931 = D.20935;
  i = i + -1;
  <D.19066>:
  if (i > 0) goto <D.19065>; else goto <D.19067>;
  <D.19067>:
  D.20936 = mspecs + 8;
  *D.20936 = 0B;
  D.20937 = method->iflags;
  D.20938 = (int) D.20937;
  D.20939 = D.20938 & 128;
  if (D.20939 == 0) goto <D.20940>; else goto <D.20941>;
  <D.20940>:
  D.20942 = sig->ret;
  D.20943 = mono_type_is_void (D.20942);
  if (D.20943 == 0) goto <D.20944>; else goto <D.20945>;
  <D.20944>:
  D.20922 = sig_native->param_count;
  D.20946 = (long unsigned int) D.20922;
  D.20947 = D.20946 * 8;
  D.20948 = mspecs + D.20947;
  D.20949 = *mspecs;
  *D.20948 = D.20949;
  <D.20945>:
  *mspecs = 0B;
  <D.20941>:
  i = 1;
  goto <D.19070>;
  <D.19069>:
  {
    int mspec_index;

    mspec_index = i + 1;
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20953 = *D.20952;
    if (D.20953 == 0B) goto <D.20954>; else goto <D.20955>;
    <D.20954>:
    D.20956 = sig_native->params[i];
    D.20957 = D.20956->type;
    if (D.20957 == 28) goto <D.20958>; else goto <D.20959>;
    <D.20958>:
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20960 = monoeg_malloc0 (24);
    *D.20952 = D.20960;
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20953 = *D.20952;
    D.20953->native = 27;
    goto <D.20961>;
    <D.20959>:
    D.20956 = sig_native->params[i];
    D.20957 = D.20956->type;
    if (D.20957 == 14) goto <D.20962>; else goto <D.20963>;
    <D.20962>:
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20964 = monoeg_malloc0 (24);
    *D.20952 = D.20964;
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20953 = *D.20952;
    D.20953->native = 19;
    goto <D.20965>;
    <D.20963>:
    D.20956 = sig_native->params[i];
    D.20957 = D.20956->type;
    if (D.20957 == 18) goto <D.20966>; else goto <D.20967>;
    <D.20966>:
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20968 = monoeg_malloc0 (24);
    *D.20952 = D.20968;
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20953 = *D.20952;
    D.20953->native = 28;
    goto <D.20969>;
    <D.20967>:
    D.20956 = sig_native->params[i];
    D.20957 = D.20956->type;
    if (D.20957 == 2) goto <D.20970>; else goto <D.20971>;
    <D.20970>:
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20972 = monoeg_malloc0 (24);
    *D.20952 = D.20972;
    D.20950 = (long unsigned int) mspec_index;
    D.20951 = D.20950 * 8;
    D.20952 = mspecs + D.20951;
    D.20953 = *D.20952;
    D.20953->native = 37;
    <D.20971>:
    <D.20969>:
    <D.20965>:
    <D.20961>:
    <D.20955>:
  }
  i = i + 1;
  <D.19070>:
  D.20922 = sig_native->param_count;
  D.20923 = (int) D.20922;
  if (D.20923 > i) goto <D.19069>; else goto <D.19071>;
  <D.19071>:
  D.20937 = method->iflags;
  D.20938 = (int) D.20937;
  D.20939 = D.20938 & 128;
  if (D.20939 != 0) goto <D.20973>; else goto <D.20974>;
  <D.20973>:
  D.20942 = sig->ret;
  D.20975 = mono_type_is_void (D.20942);
  if (D.20975 == 0) goto <D.20976>; else goto <D.20977>;
  <D.20976>:
  D.20949 = *mspecs;
  if (D.20949 == 0B) goto <D.20978>; else goto <D.20979>;
  <D.20978>:
  D.20942 = sig->ret;
  D.20980 = D.20942->type;
  if (D.20980 == 28) goto <D.20981>; else goto <D.20982>;
  <D.20981>:
  D.20983 = monoeg_malloc0 (24);
  *mspecs = D.20983;
  D.20949 = *mspecs;
  D.20949->native = 27;
  goto <D.20984>;
  <D.20982>:
  D.20942 = sig->ret;
  D.20980 = D.20942->type;
  if (D.20980 == 14) goto <D.20985>; else goto <D.20986>;
  <D.20985>:
  D.20987 = monoeg_malloc0 (24);
  *mspecs = D.20987;
  D.20949 = *mspecs;
  D.20949->native = 19;
  goto <D.20988>;
  <D.20986>:
  D.20942 = sig->ret;
  D.20980 = D.20942->type;
  if (D.20980 == 18) goto <D.20989>; else goto <D.20990>;
  <D.20989>:
  D.20991 = monoeg_malloc0 (24);
  *mspecs = D.20991;
  D.20949 = *mspecs;
  D.20949->native = 28;
  goto <D.20992>;
  <D.20990>:
  D.20942 = sig->ret;
  D.20980 = D.20942->type;
  if (D.20980 == 2) goto <D.20993>; else goto <D.20994>;
  <D.20993>:
  D.20995 = monoeg_malloc0 (24);
  *mspecs = D.20995;
  D.20949 = *mspecs;
  D.20949->native = 37;
  <D.20994>:
  <D.20992>:
  <D.20988>:
  <D.20984>:
  <D.20979>:
  <D.20977>:
  <D.20974>:
  D.20920 = method->klass;
  D.20996 = D.20920->image;
  D.20997 = piinfo->addr;
  mono_marshal_emit_native_wrapper (D.20996, mb_native, sig_native, piinfo, mspecs, D.20997, 0, 1, 0);
  D.20922 = sig_native->param_count;
  D.20923 = (int) D.20922;
  D.20998 = D.20923 + 16;
  res = mono_mb_create_method (mb_native, sig_native, D.20998);
  mono_mb_free (mb_native);
  D.20922 = sig_native->param_count;
  i = (int) D.20922;
  goto <D.19073>;
  <D.19072>:
  D.20932 = (long unsigned int) i;
  D.20933 = D.20932 * 8;
  D.20934 = mspecs + D.20933;
  D.20935 = *D.20934;
  if (D.20935 != 0B) goto <D.20999>; else goto <D.21000>;
  <D.20999>:
  D.20932 = (long unsigned int) i;
  D.20933 = D.20932 * 8;
  D.20934 = mspecs + D.20933;
  D.20935 = *D.20934;
  mono_metadata_free_marshal_spec (D.20935);
  <D.21000>:
  i = i + -1;
  <D.19073>:
  if (i >= 0) goto <D.19072>; else goto <D.19074>;
  <D.19074>:
  monoeg_g_free (mspecs);
  D.21001 = res;
  return D.21001;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memset (void * __dest, int __ch, size_t __len)
{
  void * D.21003;
  long unsigned int D.21004;

  D.21004 = __builtin_object_size (__dest, 0);
  D.21003 = __builtin___memset_chk (__dest, __ch, __len, D.21004);
  return D.21003;
}


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

  if (str != 0B) goto <D.21006>; else goto <D.21007>;
  <D.21006>:
  D.21008 = __strdup (str);
  return D.21008;
  <D.21007>:
  D.21008 = 0B;
  return D.21008;
}


__attribute__((visibility ("hidden")))
mono_cominterop_get_invoke (struct MonoMethod * method)
{
  struct MonoClass * D.21010;
  struct MonoImage * D.21011;
  struct GHashTable * * D.21012;
  _Bool D.21013;
  long int D.21014;
  long int D.21015;
  struct MonoMethod * D.21020;
  long unsigned int D.21021;
  long unsigned int D.21022;
  const char * D.21025;
  struct MonoClass * D.21026;
  struct MonoType * D.21027;
  unsigned int i.88;
  short unsigned int D.21029;
  int D.21030;
  short unsigned int D.21031;
  int D.21032;
  int D.21033;
  short unsigned int D.21037;
  int D.21038;
  int D.21039;
  int D.21043;
  struct MonoClass * com_interop_proxy_class.89;
  struct MonoImage * D.21049;
  struct MonoClass * com_interop_proxy_class.90;
  struct MonoMethod * cache_proxy.91;
  struct MonoMethod * cache_proxy.92;
  int D.21055;
  struct MonoMethodSignature * sig;
  struct MonoMethodBuilder * mb;
  struct MonoMethod * res;
  int i;
  int temp_obj;
  struct GHashTable * cache;

  D.21010 = method->klass;
  D.21011 = D.21010->image;
  D.21012 = &D.21011->cominterop_invoke_cache;
  cache = mono_marshal_get_cache (D.21012, mono_aligned_addr_hash, 0B);
  D.21013 = method == 0B;
  D.21014 = (long int) D.21013;
  D.21015 = __builtin_expect (D.21014, 0);
  if (D.21015 != 0) goto <D.21016>; else goto <D.21017>;
  <D.21016>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 982, "method");
  <D.21017>:
  res = mono_marshal_find_in_cache (cache, method);
  if (res != 0B) goto <D.21018>; else goto <D.21019>;
  <D.21018>:
  D.21020 = res;
  return D.21020;
  <D.21019>:
  sig = mono_signature_no_pinvoke (method);
  D.21021 = BIT_FIELD_REF <*sig, 64, 64>;
  D.21022 = D.21021 & 512;
  if (D.21022 == 0) goto <D.21023>; else goto <D.21024>;
  <D.21023>:
  D.21020 = method;
  return D.21020;
  <D.21024>:
  D.21010 = method->klass;
  D.21025 = method->name;
  mb = mono_mb_new (D.21010, D.21025, 26);
  D.21026 = mono_defaults.object_class;
  D.21027 = &D.21026->byval_arg;
  temp_obj = mono_mb_add_local (mb, D.21027);
  mono_mb_emit_ldarg (mb, 0);
  mono_mb_emit_ldflda (mb, 16);
  mono_mb_emit_byte (mb, 80);
  mono_mb_emit_ldflda (mb, 80);
  mono_mb_emit_byte (mb, 80);
  i = 1;
  goto <D.19104>;
  <D.19103>:
  i.88 = (unsigned int) i;
  mono_mb_emit_ldarg (mb, i.88);
  i = i + 1;
  <D.19104>:
  D.21029 = sig->param_count;
  D.21030 = (int) D.21029;
  if (D.21030 >= i) goto <D.19103>; else goto <D.19105>;
  <D.19105>:
  D.21031 = method->iflags;
  D.21032 = (int) D.21031;
  D.21033 = D.21032 & 4096;
  if (D.21033 != 0) goto <D.21034>; else goto <D.21035>;
  <D.21034>:
  {
    struct MonoMethod * native_wrapper;

    native_wrapper = mono_cominterop_get_native_wrapper (method);
    mono_mb_emit_managed_call (mb, native_wrapper, 0B);
  }
  goto <D.21036>;
  <D.21035>:
  D.21037 = method->flags;
  D.21038 = (int) D.21037;
  D.21039 = D.21038 & 64;
  if (D.21039 != 0) goto <D.21040>; else goto <D.21041>;
  <D.21040>:
  mono_mb_emit_op (mb, 111, method);
  goto <D.21042>;
  <D.21041>:
  mono_mb_emit_op (mb, 40, method);
  <D.21042>:
  <D.21036>:
  D.21025 = method->name;
  D.21043 = strcmp (D.21025, ".ctor");
  if (D.21043 == 0) goto <D.21044>; else goto <D.21045>;
  <D.21044>:
  {
    static struct MonoClass * com_interop_proxy_class = 0B;
    static struct MonoMethod * cache_proxy = 0B;

    com_interop_proxy_class.89 = com_interop_proxy_class;
    if (com_interop_proxy_class.89 == 0B) goto <D.21047>; else goto <D.21048>;
    <D.21047>:
    D.21049 = mono_defaults.corlib;
    com_interop_proxy_class.90 = mono_class_from_name (D.21049, "Mono.Interop", "ComInteropProxy");
    com_interop_proxy_class = com_interop_proxy_class.90;
    <D.21048>:
    cache_proxy.91 = cache_proxy;
    if (cache_proxy.91 == 0B) goto <D.21052>; else goto <D.21053>;
    <D.21052>:
    com_interop_proxy_class.89 = com_interop_proxy_class;
    cache_proxy.92 = mono_class_get_method_from_name (com_interop_proxy_class.89, "CacheProxy", 0);
    cache_proxy = cache_proxy.92;
    <D.21053>:
    mono_mb_emit_ldarg (mb, 0);
    mono_mb_emit_ldflda (mb, 16);
    mono_mb_emit_byte (mb, 80);
    cache_proxy.91 = cache_proxy;
    mono_mb_emit_managed_call (mb, cache_proxy.91, 0B);
  }
  <D.21045>:
  mono_marshal_emit_thread_interrupt_checkpoint (mb);
  mono_mb_emit_byte (mb, 42);
  D.21029 = sig->param_count;
  D.21030 = (int) D.21029;
  D.21055 = D.21030 + 16;
  res = mono_mb_create_and_cache (cache, method, mb, sig, D.21055);
  mono_mb_free (mb);
  D.21020 = res;
  return D.21020;
}


__attribute__((visibility ("hidden")))
mono_cominterop_emit_marshal_com_interface (struct EmitMarshalContext * m, int argnum, struct MonoType * t, struct MonoMarshalSpec * spec, int conv_arg, struct MonoType * * conv_arg_type, MarshalAction action)
{
  struct MonoMethod * get_object_for_iunknown.93;
  struct MonoClass * D.21060;
  struct MonoMethod * get_object_for_iunknown.94;
  struct MonoMethod * get_iunknown_for_object_internal.95;
  struct MonoMethod * get_iunknown_for_object_internal.96;
  struct MonoMethod * get_idispatch_for_object_internal.97;
  struct MonoMethod * get_idispatch_for_object_internal.98;
  struct MonoMethod * get_com_interface_for_object_internal.99;
  struct MonoMethod * get_com_interface_for_object_internal.100;
  struct MonoMethod * marshal_release.101;
  struct MonoMethod * marshal_release.102;
  struct MonoClass * D.21078;
  struct MonoType * D.21079;
  unsigned int conv_arg.103;
  long unsigned int D.21081;
  long unsigned int D.21082;
  short unsigned int D.21085;
  int D.21086;
  int D.21087;
  unsigned int argnum.104;
  struct MonoClass * D.21097;
  <unnamed type> D.21099;
  struct MonoType * D.21114;
  unsigned int ccw_obj.105;
  unsigned int ret_ptr.106;
  unsigned int ccw_obj.107;
  struct MonoType * D.21137;
  unsigned int ccw_obj.108;
  struct MonoMethod * AddRef.109;
  struct MonoMethod * AddRef.110;
  struct MonoMethod * AddRef.111;
  unsigned int ccw_obj.112;
  int D.21194;
  struct MonoMethodBuilder * mb;
  struct MonoClass * klass;
  static struct MonoMethod * get_object_for_iunknown = 0B;
  static struct MonoMethod * get_iunknown_for_object_internal = 0B;
  static struct MonoMethod * get_com_interface_for_object_internal = 0B;
  static struct MonoMethod * get_idispatch_for_object_internal = 0B;
  static struct MonoMethod * marshal_release = 0B;
  static struct MonoMethod * AddRef = 0B;

  mb = m->mb;
  klass = t->data.klass;
  get_object_for_iunknown.93 = get_object_for_iunknown;
  if (get_object_for_iunknown.93 == 0B) goto <D.21058>; else goto <D.21059>;
  <D.21058>:
  D.21060 = mono_defaults.marshal_class;
  get_object_for_iunknown.94 = mono_class_get_method_from_name (D.21060, "GetObjectForIUnknown", 1);
  get_object_for_iunknown = get_object_for_iunknown.94;
  <D.21059>:
  get_iunknown_for_object_internal.95 = get_iunknown_for_object_internal;
  if (get_iunknown_for_object_internal.95 == 0B) goto <D.21063>; else goto <D.21064>;
  <D.21063>:
  D.21060 = mono_defaults.marshal_class;
  get_iunknown_for_object_internal.96 = mono_class_get_method_from_name (D.21060, "GetIUnknownForObjectInternal", 1);
  get_iunknown_for_object_internal = get_iunknown_for_object_internal.96;
  <D.21064>:
  get_idispatch_for_object_internal.97 = get_idispatch_for_object_internal;
  if (get_idispatch_for_object_internal.97 == 0B) goto <D.21067>; else goto <D.21068>;
  <D.21067>:
  D.21060 = mono_defaults.marshal_class;
  get_idispatch_for_object_internal.98 = mono_class_get_method_from_name (D.21060, "GetIDispatchForObjectInternal", 1);
  get_idispatch_for_object_internal = get_idispatch_for_object_internal.98;
  <D.21068>:
  get_com_interface_for_object_internal.99 = get_com_interface_for_object_internal;
  if (get_com_interface_for_object_internal.99 == 0B) goto <D.21071>; else goto <D.21072>;
  <D.21071>:
  D.21060 = mono_defaults.marshal_class;
  get_com_interface_for_object_internal.100 = mono_class_get_method_from_name (D.21060, "GetComInterfaceForObjectInternal", 2);
  get_com_interface_for_object_internal = get_com_interface_for_object_internal.100;
  <D.21072>:
  marshal_release.101 = marshal_release;
  if (marshal_release.101 == 0B) goto <D.21075>; else goto <D.21076>;
  <D.21075>:
  D.21060 = mono_defaults.marshal_class;
  marshal_release.102 = mono_class_get_method_from_name (D.21060, "Release", 1);
  marshal_release = marshal_release.102;
  <D.21076>:
  switch (action) <default: <D.19154>, case 0: <D.19129>, case 1: <D.19137>, case 2: <D.19132>, case 3: <D.19138>, case 4: <D.19144>, case 5: <D.19149>, case 6: <D.19151>>
  <D.19129>:
  {
    guint32 pos_null;

    pos_null = 0;
    D.21078 = mono_defaults.int_class;
    D.21079 = &D.21078->byval_arg;
    *conv_arg_type = D.21079;
    D.21078 = mono_defaults.int_class;
    D.21079 = &D.21078->byval_arg;
    conv_arg = mono_mb_add_local (mb, D.21079);
    mono_mb_emit_ptr (mb, 0B);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_stloc (mb, conv_arg.103);
    D.21081 = BIT_FIELD_REF <*t, 64, 64>;
    D.21082 = D.21081 & 8589934592;
    if (D.21082 != 0) goto <D.21083>; else goto <D.21084>;
    <D.21083>:
    D.21085 = t->attrs;
    D.21086 = (int) D.21085;
    D.21087 = D.21086 & 2;
    if (D.21087 != 0) goto <D.19131>; else goto <D.21088>;
    <D.21088>:
    <D.21084>:
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    D.21081 = BIT_FIELD_REF <*t, 64, 64>;
    D.21082 = D.21081 & 8589934592;
    if (D.21082 != 0) goto <D.21090>; else goto <D.21091>;
    <D.21090>:
    mono_mb_emit_byte (mb, 80);
    <D.21091>:
    pos_null = mono_mb_emit_short_branch (mb, 44);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    D.21081 = BIT_FIELD_REF <*t, 64, 64>;
    D.21082 = D.21081 & 8589934592;
    if (D.21082 != 0) goto <D.21092>; else goto <D.21093>;
    <D.21092>:
    mono_mb_emit_byte (mb, 80);
    <D.21093>:
    if (klass != 0B) goto <D.21096>; else goto <D.21094>;
    <D.21096>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21098>; else goto <D.21094>;
    <D.21098>:
    mono_mb_emit_ptr (mb, t);
    mono_mb_emit_icall (mb, cominterop_type_from_handle);
    get_com_interface_for_object_internal.99 = get_com_interface_for_object_internal;
    mono_mb_emit_managed_call (mb, get_com_interface_for_object_internal.99, 0B);
    goto <D.21095>;
    <D.21094>:
    D.21099 = spec->native;
    if (D.21099 == 25) goto <D.21100>; else goto <D.21101>;
    <D.21100>:
    get_iunknown_for_object_internal.95 = get_iunknown_for_object_internal;
    mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal.95, 0B);
    goto <D.21102>;
    <D.21101>:
    D.21099 = spec->native;
    if (D.21099 == 26) goto <D.21103>; else goto <D.21104>;
    <D.21103>:
    get_idispatch_for_object_internal.97 = get_idispatch_for_object_internal;
    mono_mb_emit_managed_call (mb, get_idispatch_for_object_internal.97, 0B);
    goto <D.21105>;
    <D.21104>:
    if (klass == 0B) goto <D.21108>; else goto <D.21106>;
    <D.21108>:
    D.21099 = spec->native;
    if (D.21099 == 28) goto <D.21109>; else goto <D.21106>;
    <D.21109>:
    get_iunknown_for_object_internal.95 = get_iunknown_for_object_internal;
    mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal.95, 0B);
    goto <D.21107>;
    <D.21106>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1128);
    <D.21107>:
    <D.21105>:
    <D.21102>:
    <D.21095>:
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_stloc (mb, conv_arg.103);
    mono_mb_patch_short_branch (mb, pos_null);
    goto <D.19131>;
  }
  <D.19132>:
  D.21081 = BIT_FIELD_REF <*t, 64, 64>;
  D.21082 = D.21081 & 8589934592;
  if (D.21082 != 0) goto <D.21110>; else goto <D.21111>;
  <D.21110>:
  D.21085 = t->attrs;
  D.21086 = (int) D.21085;
  D.21087 = D.21086 & 2;
  if (D.21087 != 0) goto <D.21112>; else goto <D.21113>;
  <D.21112>:
  {
    int ccw_obj;
    guint32 pos_null;
    guint32 pos_ccw;
    guint32 pos_end;

    pos_null = 0;
    pos_ccw = 0;
    pos_end = 0;
    D.21097 = mono_defaults.object_class;
    D.21114 = &D.21097->byval_arg;
    ccw_obj = mono_mb_add_local (mb, D.21114);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    mono_mb_emit_byte (mb, 20);
    mono_mb_emit_byte (mb, 81);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.103);
    pos_null = mono_mb_emit_short_branch (mb, 44);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.103);
    mono_mb_emit_icon (mb, 1);
    mono_mb_emit_icall (mb, cominterop_get_ccw_object);
    ccw_obj.105 = (unsigned int) ccw_obj;
    mono_mb_emit_stloc (mb, ccw_obj.105);
    ccw_obj.105 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.105);
    pos_ccw = mono_mb_emit_short_branch (mb, 45);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.103);
    get_object_for_iunknown.93 = get_object_for_iunknown;
    mono_mb_emit_managed_call (mb, get_object_for_iunknown.93, 0B);
    if (klass != 0B) goto <D.21116>; else goto <D.21117>;
    <D.21116>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21118>; else goto <D.21119>;
    <D.21118>:
    mono_mb_emit_op (mb, 116, klass);
    <D.21119>:
    <D.21117>:
    mono_mb_emit_byte (mb, 81);
    pos_end = mono_mb_emit_short_branch (mb, 43);
    mono_mb_patch_short_branch (mb, pos_ccw);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    ccw_obj.105 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.105);
    if (klass != 0B) goto <D.21120>; else goto <D.21121>;
    <D.21120>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21122>; else goto <D.21123>;
    <D.21122>:
    mono_mb_emit_op (mb, 116, klass);
    <D.21123>:
    <D.21121>:
    mono_mb_emit_byte (mb, 81);
    mono_mb_patch_short_branch (mb, pos_end);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.103);
    marshal_release.101 = marshal_release;
    mono_mb_emit_managed_call (mb, marshal_release.101, 0B);
    mono_mb_emit_byte (mb, 38);
    mono_mb_patch_short_branch (mb, pos_null);
  }
  <D.21113>:
  <D.21111>:
  goto <D.19131>;
  <D.19137>:
  D.21081 = BIT_FIELD_REF <*t, 64, 64>;
  D.21082 = D.21081 & 8589934592;
  if (D.21082 != 0) goto <D.21124>; else goto <D.21125>;
  <D.21124>:
  conv_arg.103 = (unsigned int) conv_arg;
  mono_mb_emit_ldloc_addr (mb, conv_arg.103);
  goto <D.21126>;
  <D.21125>:
  conv_arg.103 = (unsigned int) conv_arg;
  mono_mb_emit_ldloc (mb, conv_arg.103);
  <D.21126>:
  goto <D.19131>;
  <D.19138>:
  {
    int ccw_obj;
    int ret_ptr;
    guint32 pos_null;
    guint32 pos_ccw;
    guint32 pos_end;

    pos_null = 0;
    pos_ccw = 0;
    pos_end = 0;
    D.21097 = mono_defaults.object_class;
    D.21114 = &D.21097->byval_arg;
    ccw_obj = mono_mb_add_local (mb, D.21114);
    D.21078 = mono_defaults.int_class;
    D.21079 = &D.21078->byval_arg;
    ret_ptr = mono_mb_add_local (mb, D.21079);
    ret_ptr.106 = (unsigned int) ret_ptr;
    mono_mb_emit_stloc (mb, ret_ptr.106);
    ret_ptr.106 = (unsigned int) ret_ptr;
    mono_mb_emit_ldloc (mb, ret_ptr.106);
    pos_null = mono_mb_emit_short_branch (mb, 44);
    ret_ptr.106 = (unsigned int) ret_ptr;
    mono_mb_emit_ldloc (mb, ret_ptr.106);
    mono_mb_emit_icon (mb, 1);
    mono_mb_emit_icall (mb, cominterop_get_ccw_object);
    ccw_obj.107 = (unsigned int) ccw_obj;
    mono_mb_emit_stloc (mb, ccw_obj.107);
    ccw_obj.107 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.107);
    pos_ccw = mono_mb_emit_short_branch (mb, 45);
    ret_ptr.106 = (unsigned int) ret_ptr;
    mono_mb_emit_ldloc (mb, ret_ptr.106);
    get_object_for_iunknown.93 = get_object_for_iunknown;
    mono_mb_emit_managed_call (mb, get_object_for_iunknown.93, 0B);
    if (klass != 0B) goto <D.21129>; else goto <D.21130>;
    <D.21129>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21131>; else goto <D.21132>;
    <D.21131>:
    mono_mb_emit_op (mb, 116, klass);
    <D.21132>:
    <D.21130>:
    mono_mb_emit_stloc (mb, 3);
    pos_end = mono_mb_emit_short_branch (mb, 43);
    mono_mb_patch_short_branch (mb, pos_ccw);
    ccw_obj.107 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.107);
    if (klass != 0B) goto <D.21133>; else goto <D.21134>;
    <D.21133>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21135>; else goto <D.21136>;
    <D.21135>:
    mono_mb_emit_op (mb, 116, klass);
    <D.21136>:
    <D.21134>:
    mono_mb_emit_stloc (mb, 3);
    mono_mb_patch_short_branch (mb, pos_end);
    ret_ptr.106 = (unsigned int) ret_ptr;
    mono_mb_emit_ldloc (mb, ret_ptr.106);
    marshal_release.101 = marshal_release;
    mono_mb_emit_managed_call (mb, marshal_release.101, 0B);
    mono_mb_emit_byte (mb, 38);
    mono_mb_patch_short_branch (mb, pos_null);
    goto <D.19131>;
  }
  <D.19144>:
  {
    int ccw_obj;
    guint32 pos_null;
    guint32 pos_ccw;
    guint32 pos_end;

    pos_null = 0;
    pos_ccw = 0;
    pos_end = 0;
    D.21097 = mono_defaults.object_class;
    D.21114 = &D.21097->byval_arg;
    ccw_obj = mono_mb_add_local (mb, D.21114);
    klass = mono_class_from_mono_type (t);
    D.21137 = &klass->byval_arg;
    conv_arg = mono_mb_add_local (mb, D.21137);
    D.21078 = mono_defaults.int_class;
    D.21079 = &D.21078->byval_arg;
    *conv_arg_type = D.21079;
    mono_mb_emit_byte (mb, 20);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_stloc (mb, conv_arg.103);
    D.21085 = t->attrs;
    D.21086 = (int) D.21085;
    D.21087 = D.21086 & 2;
    if (D.21087 != 0) goto <D.19131>; else goto <D.21138>;
    <D.21138>:
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    D.21081 = BIT_FIELD_REF <*t, 64, 64>;
    D.21082 = D.21081 & 8589934592;
    if (D.21082 != 0) goto <D.21139>; else goto <D.21140>;
    <D.21139>:
    mono_mb_emit_byte (mb, 80);
    <D.21140>:
    pos_null = mono_mb_emit_short_branch (mb, 44);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    D.21081 = BIT_FIELD_REF <*t, 64, 64>;
    D.21082 = D.21081 & 8589934592;
    if (D.21082 != 0) goto <D.21141>; else goto <D.21142>;
    <D.21141>:
    mono_mb_emit_byte (mb, 80);
    <D.21142>:
    mono_mb_emit_icon (mb, 1);
    mono_mb_emit_icall (mb, cominterop_get_ccw_object);
    ccw_obj.108 = (unsigned int) ccw_obj;
    mono_mb_emit_stloc (mb, ccw_obj.108);
    ccw_obj.108 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.108);
    pos_ccw = mono_mb_emit_short_branch (mb, 45);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    D.21081 = BIT_FIELD_REF <*t, 64, 64>;
    D.21082 = D.21081 & 8589934592;
    if (D.21082 != 0) goto <D.21144>; else goto <D.21145>;
    <D.21144>:
    mono_mb_emit_byte (mb, 80);
    <D.21145>:
    get_object_for_iunknown.93 = get_object_for_iunknown;
    mono_mb_emit_managed_call (mb, get_object_for_iunknown.93, 0B);
    if (klass != 0B) goto <D.21146>; else goto <D.21147>;
    <D.21146>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21148>; else goto <D.21149>;
    <D.21148>:
    mono_mb_emit_op (mb, 116, klass);
    <D.21149>:
    <D.21147>:
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_stloc (mb, conv_arg.103);
    pos_end = mono_mb_emit_short_branch (mb, 43);
    mono_mb_patch_short_branch (mb, pos_ccw);
    ccw_obj.108 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.108);
    if (klass != 0B) goto <D.21150>; else goto <D.21151>;
    <D.21150>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21152>; else goto <D.21153>;
    <D.21152>:
    mono_mb_emit_op (mb, 116, klass);
    <D.21153>:
    <D.21151>:
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_stloc (mb, conv_arg.103);
    mono_mb_patch_short_branch (mb, pos_end);
    mono_mb_patch_short_branch (mb, pos_null);
    goto <D.19131>;
  }
  <D.19149>:
  D.21081 = BIT_FIELD_REF <*t, 64, 64>;
  D.21082 = D.21081 & 8589934592;
  if (D.21082 != 0) goto <D.21154>; else goto <D.21155>;
  <D.21154>:
  D.21085 = t->attrs;
  D.21086 = (int) D.21085;
  D.21087 = D.21086 & 2;
  if (D.21087 != 0) goto <D.21156>; else goto <D.21157>;
  <D.21156>:
  {
    guint32 pos_null;

    pos_null = 0;
    AddRef.109 = AddRef;
    if (AddRef.109 == 0B) goto <D.21159>; else goto <D.21160>;
    <D.21159>:
    D.21060 = mono_defaults.marshal_class;
    AddRef.110 = mono_class_get_method_from_name (D.21060, "AddRef", 1);
    AddRef = AddRef.110;
    <D.21160>:
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    mono_mb_emit_byte (mb, 22);
    mono_mb_emit_byte (mb, 223);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.103);
    pos_null = mono_mb_emit_short_branch (mb, 44);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    conv_arg.103 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.103);
    if (klass != 0B) goto <D.21164>; else goto <D.21162>;
    <D.21164>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21165>; else goto <D.21162>;
    <D.21165>:
    mono_mb_emit_ptr (mb, t);
    mono_mb_emit_icall (mb, cominterop_type_from_handle);
    get_com_interface_for_object_internal.99 = get_com_interface_for_object_internal;
    mono_mb_emit_managed_call (mb, get_com_interface_for_object_internal.99, 0B);
    goto <D.21163>;
    <D.21162>:
    D.21099 = spec->native;
    if (D.21099 == 25) goto <D.21166>; else goto <D.21167>;
    <D.21166>:
    get_iunknown_for_object_internal.95 = get_iunknown_for_object_internal;
    mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal.95, 0B);
    goto <D.21168>;
    <D.21167>:
    D.21099 = spec->native;
    if (D.21099 == 26) goto <D.21169>; else goto <D.21170>;
    <D.21169>:
    get_idispatch_for_object_internal.97 = get_idispatch_for_object_internal;
    mono_mb_emit_managed_call (mb, get_idispatch_for_object_internal.97, 0B);
    goto <D.21171>;
    <D.21170>:
    if (klass == 0B) goto <D.21174>; else goto <D.21172>;
    <D.21174>:
    D.21099 = spec->native;
    if (D.21099 == 28) goto <D.21175>; else goto <D.21172>;
    <D.21175>:
    get_iunknown_for_object_internal.95 = get_iunknown_for_object_internal;
    mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal.95, 0B);
    goto <D.21173>;
    <D.21172>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1321);
    <D.21173>:
    <D.21171>:
    <D.21168>:
    <D.21163>:
    mono_mb_emit_byte (mb, 223);
    argnum.104 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.104);
    mono_mb_emit_byte (mb, 77);
    AddRef.109 = AddRef;
    mono_mb_emit_managed_call (mb, AddRef.109, 0B);
    mono_mb_emit_byte (mb, 38);
    mono_mb_patch_short_branch (mb, pos_null);
  }
  <D.21157>:
  <D.21155>:
  goto <D.19131>;
  <D.19151>:
  {
    guint32 pos_null;
    int ccw_obj;

    pos_null = 0;
    D.21097 = mono_defaults.object_class;
    D.21114 = &D.21097->byval_arg;
    ccw_obj = mono_mb_add_local (mb, D.21114);
    AddRef.109 = AddRef;
    if (AddRef.109 == 0B) goto <D.21176>; else goto <D.21177>;
    <D.21176>:
    D.21060 = mono_defaults.marshal_class;
    AddRef.111 = mono_class_get_method_from_name (D.21060, "AddRef", 1);
    AddRef = AddRef.111;
    <D.21177>:
    ccw_obj.112 = (unsigned int) ccw_obj;
    mono_mb_emit_stloc (mb, ccw_obj.112);
    ccw_obj.112 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.112);
    pos_null = mono_mb_emit_short_branch (mb, 44);
    ccw_obj.112 = (unsigned int) ccw_obj;
    mono_mb_emit_ldloc (mb, ccw_obj.112);
    if (klass != 0B) goto <D.21182>; else goto <D.21180>;
    <D.21182>:
    D.21097 = mono_defaults.object_class;
    if (D.21097 != klass) goto <D.21183>; else goto <D.21180>;
    <D.21183>:
    mono_mb_emit_ptr (mb, t);
    mono_mb_emit_icall (mb, cominterop_type_from_handle);
    get_com_interface_for_object_internal.99 = get_com_interface_for_object_internal;
    mono_mb_emit_managed_call (mb, get_com_interface_for_object_internal.99, 0B);
    goto <D.21181>;
    <D.21180>:
    D.21099 = spec->native;
    if (D.21099 == 25) goto <D.21184>; else goto <D.21185>;
    <D.21184>:
    get_iunknown_for_object_internal.95 = get_iunknown_for_object_internal;
    mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal.95, 0B);
    goto <D.21186>;
    <D.21185>:
    D.21099 = spec->native;
    if (D.21099 == 26) goto <D.21187>; else goto <D.21188>;
    <D.21187>:
    get_idispatch_for_object_internal.97 = get_idispatch_for_object_internal;
    mono_mb_emit_managed_call (mb, get_idispatch_for_object_internal.97, 0B);
    goto <D.21189>;
    <D.21188>:
    if (klass == 0B) goto <D.21192>; else goto <D.21190>;
    <D.21192>:
    D.21099 = spec->native;
    if (D.21099 == 28) goto <D.21193>; else goto <D.21190>;
    <D.21193>:
    get_iunknown_for_object_internal.95 = get_iunknown_for_object_internal;
    mono_mb_emit_managed_call (mb, get_iunknown_for_object_internal.95, 0B);
    goto <D.21191>;
    <D.21190>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1364);
    <D.21191>:
    <D.21189>:
    <D.21186>:
    <D.21181>:
    mono_mb_emit_stloc (mb, 3);
    mono_mb_emit_ldloc (mb, 3);
    AddRef.109 = AddRef;
    mono_mb_emit_managed_call (mb, AddRef.109, 0B);
    mono_mb_emit_byte (mb, 38);
    mono_mb_patch_short_branch (mb, pos_null);
    goto <D.19131>;
  }
  <D.19154>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1376);
  <D.19131>:
  D.21194 = conv_arg;
  return D.21194;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (void * pUnk)
{
  _Bool D.21196;
  long int D.21197;
  long int D.21198;
  int D.21201;
  struct MonoIUnknown * D.21202;
  int (*<T32a0>) (void *) D.21203;

  D.21196 = pUnk == 0B;
  D.21197 = (long int) D.21196;
  D.21198 = __builtin_expect (D.21197, 0);
  if (D.21198 != 0) goto <D.21199>; else goto <D.21200>;
  <D.21199>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1399, "pUnk");
  <D.21200>:
  D.21202 = MEM[(struct MonoIUnknown * *)pUnk];
  D.21203 = D.21202->AddRef;
  D.21201 = D.21203 (pUnk);
  return D.21201;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (void * pUnk, void * riid, void * * ppv)
{
  _Bool D.21205;
  long int D.21206;
  long int D.21207;
  int D.21210;
  struct MonoIUnknown * D.21211;
  int (*<T313a>) (void *, void *, void * *) D.21212;

  D.21205 = pUnk == 0B;
  D.21206 = (long int) D.21205;
  D.21207 = __builtin_expect (D.21206, 0);
  if (D.21207 != 0) goto <D.21208>; else goto <D.21209>;
  <D.21208>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1406, "pUnk");
  <D.21209>:
  D.21211 = MEM[(struct MonoIUnknown * *)pUnk];
  D.21212 = D.21211->QueryInterface;
  D.21210 = D.21212 (pUnk, riid, ppv);
  return D.21210;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (void * pUnk)
{
  _Bool D.21214;
  long int D.21215;
  long int D.21216;
  int D.21219;
  struct MonoIUnknown * D.21220;
  int (*<T32a0>) (void *) D.21221;

  D.21214 = pUnk == 0B;
  D.21215 = (long int) D.21214;
  D.21216 = __builtin_expect (D.21215, 0);
  if (D.21216 != 0) goto <D.21217>; else goto <D.21218>;
  <D.21217>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1413, "pUnk");
  <D.21218>:
  D.21220 = MEM[(struct MonoIUnknown * *)pUnk];
  D.21221 = D.21220->Release;
  D.21219 = D.21221 (pUnk);
  return D.21219;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (struct MonoObject * object)
{
  void * D.21225;
  int D.21226;
  struct MonoVTable * D.21231;
  struct MonoClass * D.21232;
  struct MonoVTable * D.21237;
  struct MonoClass * D.21238;
  struct MonoComObject * D.21241;
  struct MonoClass * D.21244;

  if (object == 0B) goto <D.21223>; else goto <D.21224>;
  <D.21223>:
  D.21225 = 0B;
  return D.21225;
  <D.21224>:
  D.21226 = cominterop_object_is_rcw (object);
  if (D.21226 != 0) goto <D.21227>; else goto <D.21228>;
  <D.21227>:
  {
    struct MonoClass * klass;
    struct MonoRealProxy * real_proxy;

    klass = 0B;
    real_proxy = 0B;
    if (object == 0B) goto <D.21229>; else goto <D.21230>;
    <D.21229>:
    D.21225 = 0B;
    return D.21225;
    <D.21230>:
    D.21231 = object->vtable;
    klass = D.21231->klass;
    D.21232 = mono_defaults.transparent_proxy_class;
    if (D.21232 != klass) goto <D.21233>; else goto <D.21234>;
    <D.21233>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1460);
    D.21225 = 0B;
    return D.21225;
    <D.21234>:
    real_proxy = MEM[(struct MonoTransparentProxy *)object].rp;
    if (real_proxy == 0B) goto <D.21235>; else goto <D.21236>;
    <D.21235>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1466);
    D.21225 = 0B;
    return D.21225;
    <D.21236>:
    D.21237 = MEM[(struct MonoObject *)real_proxy].vtable;
    klass = D.21237->klass;
    D.21238 = mono_class_get_interop_proxy_class ();
    if (D.21238 != klass) goto <D.21239>; else goto <D.21240>;
    <D.21239>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1472);
    D.21225 = 0B;
    return D.21225;
    <D.21240>:
    D.21241 = MEM[(struct MonoComInteropProxy *)real_proxy].com_object;
    if (D.21241 == 0B) goto <D.21242>; else goto <D.21243>;
    <D.21242>:
    monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 1477);
    D.21225 = 0B;
    return D.21225;
    <D.21243>:
    D.21241 = MEM[(struct MonoComInteropProxy *)real_proxy].com_object;
    D.21225 = D.21241->iunknown;
    return D.21225;
  }
  <D.21228>:
  D.21244 = mono_class_get_iunknown_class ();
  D.21225 = cominterop_get_ccw (object, D.21244);
  return D.21225;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void * pUnk)
{
  struct MonoObject * D.21248;
  struct MonoObject * object;

  object = 0B;
  if (pUnk == 0B) goto <D.21246>; else goto <D.21247>;
  <D.21246>:
  D.21248 = 0B;
  return D.21248;
  <D.21247>:
  object = cominterop_get_ccw_object (pUnk, 1);
  D.21248 = object;
  return D.21248;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (struct MonoObject * object)
{
  void * D.21250;

  D.21250 = cominterop_get_idispatch_for_object (object);
  return D.21250;
}


cominterop_get_idispatch_for_object (struct MonoObject * object)
{
  void * D.21254;
  int D.21255;
  struct MonoRealProxy * D.21258;
  struct MonoComObject * D.21259;
  struct MonoClass * D.21260;
  struct MonoVTable * D.21261;
  int D.21262;
  struct MonoClass * D.21265;

  if (object == 0B) goto <D.21252>; else goto <D.21253>;
  <D.21252>:
  D.21254 = 0B;
  return D.21254;
  <D.21253>:
  D.21255 = cominterop_object_is_rcw (object);
  if (D.21255 != 0) goto <D.21256>; else goto <D.21257>;
  <D.21256>:
  D.21258 = MEM[(struct MonoTransparentProxy *)object].rp;
  D.21259 = MEM[(struct MonoComInteropProxy *)D.21258].com_object;
  D.21260 = mono_class_get_idispatch_class ();
  D.21254 = cominterop_get_interface (D.21259, D.21260, 1);
  return D.21254;
  <D.21257>:
  {
    struct MonoClass * klass;

    D.21261 = object->vtable;
    klass = D.21261->klass;
    D.21262 = cominterop_can_support_dispatch (klass);
    if (D.21262 == 0) goto <D.21263>; else goto <D.21264>;
    <D.21263>:
    cominterop_raise_hr_exception (-2147467262);
    <D.21264>:
    D.21265 = mono_class_get_idispatch_class ();
    D.21254 = cominterop_get_ccw (object, D.21265);
    return D.21254;
  }
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (struct MonoObject * object, struct MonoReflectionType * type)
{
  _Bool D.21267;
  long int D.21268;
  long int D.21269;
  struct MonoType * D.21272;
  _Bool D.21273;
  long int D.21274;
  long int D.21275;
  _Bool D.21278;
  long int D.21279;
  long int D.21280;
  int D.21283;
  struct MonoException * D.21286;
  _Bool D.21287;
  long int D.21288;
  long int D.21289;
  void * D.21292;
  struct MonoClass * klass;
  void * itf;

  klass = 0B;
  itf = 0B;
  D.21267 = type == 0B;
  D.21268 = (long int) D.21267;
  D.21269 = __builtin_expect (D.21268, 0);
  if (D.21269 != 0) goto <D.21270>; else goto <D.21271>;
  <D.21270>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1525, "type");
  <D.21271>:
  D.21272 = type->type;
  D.21273 = D.21272 == 0B;
  D.21274 = (long int) D.21273;
  D.21275 = __builtin_expect (D.21274, 0);
  if (D.21275 != 0) goto <D.21276>; else goto <D.21277>;
  <D.21276>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1526, "type->type");
  <D.21277>:
  D.21272 = type->type;
  klass = mono_type_get_class (D.21272);
  D.21278 = klass == 0B;
  D.21279 = (long int) D.21278;
  D.21280 = __builtin_expect (D.21279, 0);
  if (D.21280 != 0) goto <D.21281>; else goto <D.21282>;
  <D.21281>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1528, "klass");
  <D.21282>:
  D.21283 = mono_class_init (klass);
  if (D.21283 == 0) goto <D.21284>; else goto <D.21285>;
  <D.21284>:
  D.21286 = mono_class_get_exception_for_failure (klass);
  mono_raise_exception (D.21286);
  <D.21285>:
  itf = cominterop_get_ccw (object, klass);
  D.21287 = itf == 0B;
  D.21288 = (long int) D.21287;
  D.21289 = __builtin_expect (D.21288, 0);
  if (D.21289 != 0) goto <D.21290>; else goto <D.21291>;
  <D.21290>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1533, "itf");
  <D.21291>:
  D.21292 = itf;
  return D.21292;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (struct MonoObject * object)
{
  MonoBoolean D.21294;
  int D.21295;

  D.21295 = cominterop_object_is_rcw (object);
  D.21294 = (MonoBoolean) D.21295;
  return D.21294;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (struct MonoObject * object)
{
  _Bool D.21297;
  long int D.21298;
  long int D.21299;
  int D.21302;
  _Bool D.21303;
  long int D.21304;
  long int D.21305;
  _Bool D.21308;
  long int D.21309;
  long int D.21310;
  int D.21313;
  gint32 D.21316;
  gint32 * D.21317;
  _Bool D.21318;
  long int D.21319;
  long int D.21320;
  struct MonoComObject * D.21325;
  struct MonoComInteropProxy * proxy;
  gint32 ref_count;

  proxy = 0B;
  ref_count = 0;
  D.21297 = object == 0B;
  D.21298 = (long int) D.21297;
  D.21299 = __builtin_expect (D.21298, 0);
  if (D.21299 != 0) goto <D.21300>; else goto <D.21301>;
  <D.21300>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1558, "object");
  <D.21301>:
  D.21302 = cominterop_object_is_rcw (object);
  D.21303 = D.21302 == 0;
  D.21304 = (long int) D.21303;
  D.21305 = __builtin_expect (D.21304, 0);
  if (D.21305 != 0) goto <D.21306>; else goto <D.21307>;
  <D.21306>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1559, "cominterop_object_is_rcw (object)");
  <D.21307>:
  proxy = MEM[(struct MonoTransparentProxy *)object].rp;
  D.21308 = proxy == 0B;
  D.21309 = (long int) D.21308;
  D.21310 = __builtin_expect (D.21309, 0);
  if (D.21310 != 0) goto <D.21311>; else goto <D.21312>;
  <D.21311>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1562, "proxy");
  <D.21312>:
  D.21313 = proxy->ref_count;
  if (D.21313 == 0) goto <D.21314>; else goto <D.21315>;
  <D.21314>:
  D.21316 = -1;
  return D.21316;
  <D.21315>:
  D.21317 = &proxy->ref_count;
  ref_count = InterlockedDecrement (D.21317);
  D.21318 = ref_count < 0;
  D.21319 = (long int) D.21318;
  D.21320 = __builtin_expect (D.21319, 0);
  if (D.21320 != 0) goto <D.21321>; else goto <D.21322>;
  <D.21321>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1569, "ref_count >= 0");
  <D.21322>:
  if (ref_count == 0) goto <D.21323>; else goto <D.21324>;
  <D.21323>:
  D.21325 = proxy->com_object;
  ves_icall_System_ComObject_ReleaseInterfaces (D.21325);
  <D.21324>:
  D.21316 = ref_count;
  return D.21316;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (struct MonoReflectionMethod * m)
{
  guint32 D.21327;
  struct MonoMethod * D.21328;
  int D.21329;

  D.21328 = m->method;
  D.21329 = cominterop_get_com_slot_for_method (D.21328);
  D.21327 = (guint32) D.21329;
  return D.21327;
}


__attribute__((visibility ("hidden")))
ves_icall_System_ComObject_CreateRCW (struct MonoReflectionType * type)
{
  struct MonoVTable * D.21331;
  struct MonoType * D.21332;
  struct MonoVTable * D.21333;
  struct MonoObject * D.21334;
  struct MonoClass * klass;
  struct MonoDomain * domain;
  struct MonoObject * obj;

  D.21331 = MEM[(struct MonoObject *)type].vtable;
  domain = D.21331->domain;
  D.21332 = type->type;
  klass = mono_class_from_mono_type (D.21332);
  D.21333 = mono_class_vtable_full (domain, klass, 1);
  obj = mono_object_new_alloc_specific (D.21333);
  D.21334 = obj;
  return D.21334;
}


__attribute__((visibility ("hidden")))
ves_icall_System_ComObject_ReleaseInterfaces (struct MonoComObject * obj)
{
  _Bool D.21336;
  long int D.21337;
  long int D.21338;
  struct GHashTable * D.21341;
  _Bool D.21346;
  long int D.21347;
  long int D.21348;
  struct GHashTable * rcw_hash.113;
  void * D.21352;
  void * D.21353;
  long int D.21354;
  _Bool D.21359;
  long int D.21360;
  long int D.21361;

  D.21336 = obj == 0B;
  D.21337 = (long int) D.21336;
  D.21338 = __builtin_expect (D.21337, 0);
  if (D.21338 != 0) goto <D.21339>; else goto <D.21340>;
  <D.21339>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1625, "obj");
  <D.21340>:
  D.21341 = obj->itf_hash;
  if (D.21341 != 0B) goto <D.21342>; else goto <D.21343>;
  <D.21342>:
  {
    guint32 gchandle;

    gchandle = 0;
    {
      int ret;

      ret = pthread_mutex_lock (&cominterop_mutex.mutex);
      if (ret != 0) goto <D.21344>; else goto <D.21345>;
      <D.21344>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
      <D.21345>:
      D.21346 = ret != 0;
      D.21347 = (long int) D.21346;
      D.21348 = __builtin_expect (D.21347, 0);
      if (D.21348 != 0) goto <D.21349>; else goto <D.21350>;
      <D.21349>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1628, "ret == 0");
      <D.21350>:
    }
    rcw_hash.113 = rcw_hash;
    D.21352 = obj->iunknown;
    D.21353 = monoeg_g_hash_table_lookup (rcw_hash.113, D.21352);
    D.21354 = (long int) D.21353;
    gchandle = (guint32) D.21354;
    if (gchandle != 0) goto <D.21355>; else goto <D.21356>;
    <D.21355>:
    mono_gchandle_free (gchandle);
    rcw_hash.113 = rcw_hash;
    D.21352 = obj->iunknown;
    monoeg_g_hash_table_remove (rcw_hash.113, D.21352);
    <D.21356>:
    D.21341 = obj->itf_hash;
    monoeg_g_hash_table_foreach_remove (D.21341, cominterop_rcw_interface_finalizer, 0B);
    D.21341 = obj->itf_hash;
    monoeg_g_hash_table_destroy (D.21341);
    D.21352 = obj->iunknown;
    ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (D.21352);
    obj->iunknown = 0B;
    obj->itf_hash = 0B;
    {
      int ret;

      ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
      if (ret != 0) goto <D.21357>; else goto <D.21358>;
      <D.21357>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.21358>:
      D.21359 = ret != 0;
      D.21360 = (long int) D.21359;
      D.21361 = __builtin_expect (D.21360, 0);
      if (D.21361 != 0) goto <D.21362>; else goto <D.21363>;
      <D.21362>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1639, "ret == 0");
      <D.21363>:
    }
  }
  <D.21343>:
}


cominterop_rcw_interface_finalizer (void * key, void * value, void * user_data)
{
  gboolean D.21364;

  ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (value);
  D.21364 = 1;
  return D.21364;
}


__attribute__((visibility ("hidden")))
cominterop_release_all_rcws ()
{
  struct GHashTable * rcw_hash.114;
  _Bool D.21371;
  long int D.21372;
  long int D.21373;
  _Bool D.21378;
  long int D.21379;
  long int D.21380;

  rcw_hash.114 = rcw_hash;
  if (rcw_hash.114 == 0B) goto <D.21367>; else goto <D.21368>;
  <D.21367>:
  return;
  <D.21368>:
  {
    int ret;

    ret = pthread_mutex_lock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21369>; else goto <D.21370>;
    <D.21369>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21370>:
    D.21371 = ret != 0;
    D.21372 = (long int) D.21371;
    D.21373 = __builtin_expect (D.21372, 0);
    if (D.21373 != 0) goto <D.21374>; else goto <D.21375>;
    <D.21374>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1674, "ret == 0");
    <D.21375>:
  }
  rcw_hash.114 = rcw_hash;
  monoeg_g_hash_table_foreach_remove (rcw_hash.114, cominterop_rcw_finalizer, 0B);
  rcw_hash.114 = rcw_hash;
  monoeg_g_hash_table_destroy (rcw_hash.114);
  rcw_hash = 0B;
  {
    int ret;

    ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21376>; else goto <D.21377>;
    <D.21376>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21377>:
    D.21378 = ret != 0;
    D.21379 = (long int) D.21378;
    D.21380 = __builtin_expect (D.21379, 0);
    if (D.21380 != 0) goto <D.21381>; else goto <D.21382>;
    <D.21381>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1680, "ret == 0");
    <D.21382>:
  }
}


cominterop_rcw_finalizer (void * key, void * value, void * user_data)
{
  long int value.115;
  struct MonoComObject * D.21389;
  struct GHashTable * D.21390;
  void * D.21393;
  gboolean D.21396;
  guint32 gchandle;

  gchandle = 0;
  value.115 = (long int) value;
  gchandle = (guint32) value.115;
  if (gchandle != 0) goto <D.21385>; else goto <D.21386>;
  <D.21385>:
  {
    struct MonoComInteropProxy * proxy;

    proxy = mono_gchandle_get_target (gchandle);
    if (proxy != 0B) goto <D.21387>; else goto <D.21388>;
    <D.21387>:
    D.21389 = proxy->com_object;
    D.21390 = D.21389->itf_hash;
    if (D.21390 != 0B) goto <D.21391>; else goto <D.21392>;
    <D.21391>:
    D.21389 = proxy->com_object;
    D.21390 = D.21389->itf_hash;
    monoeg_g_hash_table_foreach_remove (D.21390, cominterop_rcw_interface_finalizer, 0B);
    D.21389 = proxy->com_object;
    D.21390 = D.21389->itf_hash;
    monoeg_g_hash_table_destroy (D.21390);
    <D.21392>:
    D.21389 = proxy->com_object;
    D.21393 = D.21389->iunknown;
    if (D.21393 != 0B) goto <D.21394>; else goto <D.21395>;
    <D.21394>:
    D.21389 = proxy->com_object;
    D.21393 = D.21389->iunknown;
    ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (D.21393);
    <D.21395>:
    D.21389 = proxy->com_object;
    D.21389->iunknown = 0B;
    D.21389 = proxy->com_object;
    D.21389->itf_hash = 0B;
    <D.21388>:
    mono_gchandle_free (gchandle);
  }
  <D.21386>:
  D.21396 = 1;
  return D.21396;
}


__attribute__((visibility ("hidden")))
ves_icall_System_ComObject_GetInterfaceInternal (struct MonoComObject * obj, struct MonoReflectionType * type, MonoBoolean throw_exception)
{
  struct MonoType * D.21398;
  int D.21399;
  struct MonoException * D.21402;
  void * D.21403;
  int D.21404;
  struct MonoClass * class;

  D.21398 = type->type;
  class = mono_type_get_class (D.21398);
  D.21399 = mono_class_init (class);
  if (D.21399 == 0) goto <D.21400>; else goto <D.21401>;
  <D.21400>:
  D.21402 = mono_class_get_exception_for_failure (class);
  mono_raise_exception (D.21402);
  <D.21401>:
  D.21404 = (int) throw_exception;
  D.21403 = cominterop_get_interface (obj, class, D.21404);
  return D.21403;
}


__attribute__((visibility ("hidden")))
ves_icall_Mono_Interop_ComInteropProxy_AddProxy (void * pUnk, struct MonoComInteropProxy * proxy)
{
  struct GHashTable * rcw_hash.116;
  _Bool D.21411;
  long int D.21412;
  long int D.21413;
  struct GHashTable * D.21416;
  _Bool D.21419;
  long int D.21420;
  long int D.21421;
  _Bool D.21426;
  long int D.21427;
  long int D.21428;
  long unsigned int D.21431;
  void * D.21432;
  _Bool D.21435;
  long int D.21436;
  long int D.21437;
  guint32 gchandle;

  gchandle = 0;
  rcw_hash.116 = rcw_hash;
  if (rcw_hash.116 == 0B) goto <D.21407>; else goto <D.21408>;
  <D.21407>:
  {
    int ret;

    ret = pthread_mutex_lock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21409>; else goto <D.21410>;
    <D.21409>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21410>:
    D.21411 = ret != 0;
    D.21412 = (long int) D.21411;
    D.21413 = __builtin_expect (D.21412, 0);
    if (D.21413 != 0) goto <D.21414>; else goto <D.21415>;
    <D.21414>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1703, "ret == 0");
    <D.21415>:
  }
  D.21416 = monoeg_g_hash_table_new (mono_aligned_addr_hash, 0B);
  rcw_hash = D.21416;
  {
    int ret;

    ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21417>; else goto <D.21418>;
    <D.21417>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21418>:
    D.21419 = ret != 0;
    D.21420 = (long int) D.21419;
    D.21421 = __builtin_expect (D.21420, 0);
    if (D.21421 != 0) goto <D.21422>; else goto <D.21423>;
    <D.21422>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1705, "ret == 0");
    <D.21423>:
  }
  <D.21408>:
  gchandle = mono_gchandle_new_weakref (proxy, 0);
  {
    int ret;

    ret = pthread_mutex_lock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21424>; else goto <D.21425>;
    <D.21424>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21425>:
    D.21426 = ret != 0;
    D.21427 = (long int) D.21426;
    D.21428 = __builtin_expect (D.21427, 0);
    if (D.21428 != 0) goto <D.21429>; else goto <D.21430>;
    <D.21429>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1710, "ret == 0");
    <D.21430>:
  }
  rcw_hash.116 = rcw_hash;
  D.21431 = (long unsigned int) gchandle;
  D.21432 = (void *) D.21431;
  monoeg_g_hash_table_insert_replace (rcw_hash.116, pUnk, D.21432, 0);
  {
    int ret;

    ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21433>; else goto <D.21434>;
    <D.21433>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21434>:
    D.21435 = ret != 0;
    D.21436 = (long int) D.21435;
    D.21437 = __builtin_expect (D.21436, 0);
    if (D.21437 != 0) goto <D.21438>; else goto <D.21439>;
    <D.21438>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1712, "ret == 0");
    <D.21439>:
  }
}


__attribute__((visibility ("hidden")))
ves_icall_Mono_Interop_ComInteropProxy_FindProxy (void * pUnk)
{
  _Bool D.21442;
  long int D.21443;
  long int D.21444;
  struct GHashTable * rcw_hash.117;
  void * D.21450;
  long int D.21451;
  _Bool D.21454;
  long int D.21455;
  long int D.21456;
  struct MonoComInteropProxy * D.21463;
  struct MonoComInteropProxy * proxy;
  guint32 gchandle;

  proxy = 0B;
  gchandle = 0;
  {
    int ret;

    ret = pthread_mutex_lock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21440>; else goto <D.21441>;
    <D.21440>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21441>:
    D.21442 = ret != 0;
    D.21443 = (long int) D.21442;
    D.21444 = __builtin_expect (D.21443, 0);
    if (D.21444 != 0) goto <D.21445>; else goto <D.21446>;
    <D.21445>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1725, "ret == 0");
    <D.21446>:
  }
  rcw_hash.117 = rcw_hash;
  if (rcw_hash.117 != 0B) goto <D.21448>; else goto <D.21449>;
  <D.21448>:
  rcw_hash.117 = rcw_hash;
  D.21450 = monoeg_g_hash_table_lookup (rcw_hash.117, pUnk);
  D.21451 = (long int) D.21450;
  gchandle = (guint32) D.21451;
  <D.21449>:
  {
    int ret;

    ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21452>; else goto <D.21453>;
    <D.21452>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21453>:
    D.21454 = ret != 0;
    D.21455 = (long int) D.21454;
    D.21456 = __builtin_expect (D.21455, 0);
    if (D.21456 != 0) goto <D.21457>; else goto <D.21458>;
    <D.21457>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 1728, "ret == 0");
    <D.21458>:
  }
  if (gchandle != 0) goto <D.21459>; else goto <D.21460>;
  <D.21459>:
  proxy = mono_gchandle_get_target (gchandle);
  if (proxy == 0B) goto <D.21461>; else goto <D.21462>;
  <D.21461>:
  mono_gchandle_free (gchandle);
  rcw_hash.117 = rcw_hash;
  monoeg_g_hash_table_remove (rcw_hash.117, pUnk);
  <D.21462>:
  <D.21460>:
  D.21463 = proxy;
  return D.21463;
}


__attribute__((visibility ("hidden")))
mono_marshal_free_ccw (struct MonoObject * object)
{
  struct GHashTable * ccw_hash.118;
  unsigned int D.21469;
  gboolean D.21470;
  _Bool D.21473;
  long int D.21474;
  long int D.21475;
  int D.21478;
  long int D.21479;
  const void * D.21480;
  _Bool D.21483;
  long int D.21484;
  long int D.21485;
  unsigned int D.21490;
  struct GHashTable * D.21495;
  struct GList * iftmp.119;
  struct GList * iftmp.120;
  unsigned int D.21504;
  int D.21507;
  long int D.21508;
  const void * D.21509;
  struct GList * ccw_list;
  struct GList * ccw_list_orig;
  struct GList * ccw_list_item;

  ccw_hash.118 = ccw_hash;
  if (ccw_hash.118 == 0B) goto <D.21465>; else goto <D.21468>;
  <D.21468>:
  ccw_hash.118 = ccw_hash;
  D.21469 = monoeg_g_hash_table_size (ccw_hash.118);
  if (D.21469 == 0) goto <D.21465>; else goto <D.21466>;
  <D.21465>:
  D.21470 = 0;
  return D.21470;
  <D.21466>:
  {
    int ret;

    ret = pthread_mutex_lock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21471>; else goto <D.21472>;
    <D.21471>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21472>:
    D.21473 = ret != 0;
    D.21474 = (long int) D.21473;
    D.21475 = __builtin_expect (D.21474, 0);
    if (D.21475 != 0) goto <D.21476>; else goto <D.21477>;
    <D.21476>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2050, "ret == 0");
    <D.21477>:
  }
  ccw_hash.118 = ccw_hash;
  D.21478 = mono_object_hash (object);
  D.21479 = (long int) D.21478;
  D.21480 = (const void *) D.21479;
  ccw_list_orig = monoeg_g_hash_table_lookup (ccw_hash.118, D.21480);
  ccw_list = ccw_list_orig;
  {
    int ret;

    ret = pthread_mutex_unlock (&cominterop_mutex.mutex);
    if (ret != 0) goto <D.21481>; else goto <D.21482>;
    <D.21481>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21482>:
    D.21483 = ret != 0;
    D.21484 = (long int) D.21483;
    D.21485 = __builtin_expect (D.21484, 0);
    if (D.21485 != 0) goto <D.21486>; else goto <D.21487>;
    <D.21486>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2052, "ret == 0");
    <D.21487>:
  }
  if (ccw_list == 0B) goto <D.21488>; else goto <D.21489>;
  <D.21488>:
  D.21470 = 0;
  return D.21470;
  <D.21489>:
  ccw_list_item = ccw_list;
  goto <D.19339>;
  <D.19338>:
  {
    struct MonoCCW * ccw_iter;
    struct MonoObject * handle_target;

    ccw_iter = ccw_list_item->data;
    D.21490 = ccw_iter->gc_handle;
    handle_target = mono_gchandle_get_target (D.21490);
    if (handle_target == 0B) goto <D.21491>; else goto <D.21494>;
    <D.21494>:
    if (handle_target == object) goto <D.21491>; else goto <D.21492>;
    <D.21491>:
    D.21495 = ccw_iter->vtable_hash;
    monoeg_g_hash_table_foreach_remove (D.21495, mono_marshal_free_ccw_entry, 0B);
    D.21495 = ccw_iter->vtable_hash;
    monoeg_g_hash_table_destroy (D.21495);
    if (ccw_list_item != 0B) goto <D.21497>; else goto <D.21498>;
    <D.21497>:
    iftmp.119 = ccw_list_item->next;
    goto <D.21499>;
    <D.21498>:
    iftmp.119 = 0B;
    <D.21499>:
    ccw_list_item = iftmp.119;
    ccw_list = monoeg_g_list_remove (ccw_list, ccw_iter);
    monoeg_g_free (ccw_iter);
    goto <D.21493>;
    <D.21492>:
    if (ccw_list_item != 0B) goto <D.21501>; else goto <D.21502>;
    <D.21501>:
    iftmp.120 = ccw_list_item->next;
    goto <D.21503>;
    <D.21502>:
    iftmp.120 = 0B;
    <D.21503>:
    ccw_list_item = iftmp.120;
    <D.21493>:
  }
  <D.19339>:
  if (ccw_list_item != 0B) goto <D.19338>; else goto <D.19340>;
  <D.19340>:
  D.21504 = monoeg_g_list_length (ccw_list);
  if (D.21504 == 0) goto <D.21505>; else goto <D.21506>;
  <D.21505>:
  ccw_hash.118 = ccw_hash;
  D.21507 = mono_object_hash (object);
  D.21508 = (long int) D.21507;
  D.21509 = (const void *) D.21508;
  monoeg_g_hash_table_remove (ccw_hash.118, D.21509);
  <D.21506>:
  D.21470 = 1;
  return D.21470;
}


mono_marshal_free_ccw_entry (void * key, void * value, void * user_data)
{
  struct GHashTable * ccw_interface_hash.121;
  _Bool D.21512;
  long int D.21513;
  long int D.21514;
  gboolean D.21517;

  ccw_interface_hash.121 = ccw_interface_hash;
  monoeg_g_hash_table_remove (ccw_interface_hash.121, value);
  D.21512 = value == 0B;
  D.21513 = (long int) D.21512;
  D.21514 = __builtin_expect (D.21513, 0);
  if (D.21514 != 0) goto <D.21515>; else goto <D.21516>;
  <D.21515>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2030, "value");
  <D.21516>:
  monoeg_g_free (value);
  D.21517 = 1;
  return D.21517;
}


__attribute__((visibility ("hidden")))
mono_string_to_bstr (struct MonoString * string_obj)
{
  void * D.21521;
  <unnamed type> com_provider.122;
  int D.21525;
  long unsigned int D.21526;
  long unsigned int D.21527;
  long unsigned int D.21528;
  char * D.21531;
  mono_unichar2 * D.21532;
  long unsigned int D.21533;
  long unsigned int D.21534;
  unsigned int D.21535;
  unsigned int D.21536;
  long unsigned int D.21537;
  long unsigned int D.21538;
  char * D.21539;
  long unsigned int D.21540;
  char * D.21541;
  int D.21544;
  int D.21546;
  mono_unichar2 * D.21547;
  long int D.21548;
  void * (*<T349a>) (gunichar *, guint32) sys_alloc_string_len_ms.123;

  if (string_obj == 0B) goto <D.21519>; else goto <D.21520>;
  <D.21519>:
  D.21521 = 0B;
  return D.21521;
  <D.21520>:
  com_provider.122 = com_provider;
  if (com_provider.122 == 0) goto <D.21523>; else goto <D.21524>;
  <D.21523>:
  {
    int slen;
    char * ret;

    slen = mono_string_length (string_obj);
    D.21525 = slen + 1;
    D.21526 = (long unsigned int) D.21525;
    D.21527 = D.21526 + 2;
    D.21528 = D.21527 * 2;
    ret = monoeg_malloc (D.21528);
    if (ret == 0B) goto <D.21529>; else goto <D.21530>;
    <D.21529>:
    D.21521 = 0B;
    return D.21521;
    <D.21530>:
    D.21531 = ret + 4;
    D.21532 = mono_string_chars (string_obj);
    D.21533 = (long unsigned int) slen;
    D.21534 = D.21533 * 2;
    memcpy (D.21531, D.21532, D.21534);
    D.21533 = (long unsigned int) slen;
    D.21535 = (unsigned int) D.21533;
    D.21536 = D.21535 * 2;
    MEM[(guint32 *)ret] = D.21536;
    D.21533 = (long unsigned int) slen;
    D.21537 = D.21533 + 2;
    D.21538 = D.21537 * 2;
    D.21539 = ret + D.21538;
    *D.21539 = 0;
    D.21533 = (long unsigned int) slen;
    D.21534 = D.21533 * 2;
    D.21540 = D.21534 + 5;
    D.21541 = ret + D.21540;
    *D.21541 = 0;
    D.21521 = ret + 4;
    return D.21521;
  }
  <D.21524>:
  com_provider.122 = com_provider;
  if (com_provider.122 == 1) goto <D.21543>; else goto <D.21542>;
  <D.21543>:
  D.21544 = init_com_provider_ms ();
  if (D.21544 != 0) goto <D.21545>; else goto <D.21542>;
  <D.21545>:
  {
    void * ret;
    gunichar * str;
    guint32 len;

    ret = 0B;
    str = 0B;
    D.21546 = mono_string_length (string_obj);
    len = (guint32) D.21546;
    D.21547 = mono_string_chars (string_obj);
    D.21548 = (long int) len;
    str = monoeg_g_utf16_to_ucs4 (D.21547, D.21548, 0B, 0B, 0B);
    sys_alloc_string_len_ms.123 = sys_alloc_string_len_ms;
    ret = sys_alloc_string_len_ms.123 (str, len);
    monoeg_g_free (str);
    D.21521 = ret;
    return D.21521;
  }
  <D.21542>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2605);
}


mono_string_from_bstr (void * bstr)
{
  struct MonoString * D.21553;
  <unnamed type> com_provider.124;
  struct MonoDomain * D.21557;
  guint32 * D.21558;
  unsigned int D.21559;
  unsigned int D.21560;
  int D.21561;
  int D.21564;
  guint32 (*<T1928>) (void *) sys_string_len_ms.125;
  unsigned int D.21567;
  long int D.21568;
  struct MonoDomain * D.21569;
  long int written.126;
  int D.21571;

  if (bstr == 0B) goto <D.21551>; else goto <D.21552>;
  <D.21551>:
  D.21553 = 0B;
  return D.21553;
  <D.21552>:
  com_provider.124 = com_provider;
  if (com_provider.124 == 0) goto <D.21555>; else goto <D.21556>;
  <D.21555>:
  D.21557 = mono_domain_get ();
  D.21558 = bstr + 18446744073709551612;
  D.21559 = *D.21558;
  D.21560 = D.21559 / 2;
  D.21561 = (int) D.21560;
  D.21553 = mono_string_new_utf16 (D.21557, bstr, D.21561);
  return D.21553;
  <D.21556>:
  com_provider.124 = com_provider;
  if (com_provider.124 == 1) goto <D.21563>; else goto <D.21562>;
  <D.21563>:
  D.21564 = init_com_provider_ms ();
  if (D.21564 != 0) goto <D.21565>; else goto <D.21562>;
  <D.21565>:
  {
    struct MonoString * str;
    glong written;
    gunichar2 * utf16;

    try
      {
        str = 0B;
        written = 0;
        utf16 = 0B;
        sys_string_len_ms.125 = sys_string_len_ms;
        D.21567 = sys_string_len_ms.125 (bstr);
        D.21568 = (long int) D.21567;
        utf16 = monoeg_g_ucs4_to_utf16 (bstr, D.21568, 0B, &written, 0B);
        D.21569 = mono_domain_get ();
        written.126 = written;
        D.21571 = (int) written.126;
        str = mono_string_new_utf16 (D.21569, utf16, D.21571);
        monoeg_g_free (utf16);
        D.21553 = str;
        return D.21553;
      }
    finally
      {
        written = {CLOBBER};
      }
  }
  <D.21562>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2630);
}


mono_free_bstr (void * bstr)
{
  <unnamed type> com_provider.127;
  void * D.21579;
  int D.21584;
  void (*<T34a2>) (gunichar *) sys_free_string_ms.128;

  if (bstr == 0B) goto <D.21574>; else goto <D.21575>;
  <D.21574>:
  return;
  <D.21575>:
  com_provider.127 = com_provider;
  if (com_provider.127 == 0) goto <D.21577>; else goto <D.21578>;
  <D.21577>:
  D.21579 = bstr + 18446744073709551612;
  monoeg_g_free (D.21579);
  goto <D.21580>;
  <D.21578>:
  com_provider.127 = com_provider;
  if (com_provider.127 == 1) goto <D.21583>; else goto <D.21581>;
  <D.21583>:
  D.21584 = init_com_provider_ms ();
  if (D.21584 != 0) goto <D.21585>; else goto <D.21581>;
  <D.21585>:
  sys_free_string_ms.128 = sys_free_string_ms;
  sys_free_string_ms.128 (bstr);
  goto <D.21582>;
  <D.21581>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2649);
  <D.21582>:
  <D.21580>:
}


__attribute__((visibility ("hidden")))
mono_cominterop_emit_marshal_safearray (struct EmitMarshalContext * m, int argnum, struct MonoType * t, struct MonoMarshalSpec * spec, int conv_arg, struct MonoType * * conv_arg_type, MarshalAction action)
{
  short unsigned int D.21588;
  int D.21589;
  int D.21590;
  struct MonoClass * D.21593;
  struct MonoType * D.21594;
  struct MonoClass * D.21595;
  struct MonoType * D.21596;
  long unsigned int D.21597;
  long unsigned int D.21598;
  unsigned int argnum.129;
  unsigned int safearray_var.130;
  unsigned int indices_var.131;
  unsigned int empty_var.132;
  struct MonoClass * D.21606;
  struct MonoType * D.21607;
  unsigned int index_var.133;
  int D.21609;
  struct MonoMethod * get_value_impl.134;
  struct MonoClass * D.21613;
  struct MonoMethod * get_value_impl.135;
  _Bool D.21615;
  long int D.21616;
  long int D.21617;
  struct MonoMethod * get_native_variant_for_object.136;
  struct MonoClass * D.21626;
  struct MonoMethod * get_native_variant_for_object.137;
  _Bool D.21628;
  long int D.21629;
  long int D.21630;
  struct MonoClass * D.21633;
  struct MonoType * D.21634;
  unsigned int elem_var.138;
  struct MonoMethod * variant_clear.139;
  struct MonoClass * D.21639;
  struct MonoMethod * variant_clear.140;
  short unsigned int D.21641;
  unsigned int conv_arg.141;
  int D.21646;
  int iftmp.142;
  unsigned int result_var.143;
  unsigned int indices_var.144;
  unsigned int empty_var.145;
  unsigned int index_var.146;
  int D.21661;
  struct MonoMethod * get_object_for_native_variant.147;
  struct MonoMethod * get_object_for_native_variant.148;
  _Bool D.21668;
  long int D.21669;
  long int D.21670;
  struct MonoMethod * set_value_impl.149;
  struct MonoMethod * set_value_impl.150;
  _Bool D.21677;
  long int D.21678;
  long int D.21679;
  unsigned int elem_var.151;
  short unsigned int D.21685;
  int D.21688;
  struct MonoMethodBuilder * mb;

  mb = m->mb;
  switch (action) <default: <D.19560>, case 0: <D.19533>, case 1: <D.19546>, case 2: <D.19547>>
  <D.19533>:
  D.21588 = t->attrs;
  D.21589 = (int) D.21588;
  D.21590 = D.21589 & 1;
  if (D.21590 != 0) goto <D.21591>; else goto <D.21592>;
  <D.21591>:
  {
    int safearray_var;
    int indices_var;
    int empty_var;
    int elem_var;
    int index_var;
    guint32 label1;
    guint32 label2;
    guint32 label3;
    static struct MonoMethod * get_native_variant_for_object = 0B;
    static struct MonoMethod * get_value_impl = 0B;
    static struct MonoMethod * variant_clear = 0B;

    label1 = 0;
    label2 = 0;
    label3 = 0;
    D.21593 = mono_defaults.object_class;
    D.21594 = &D.21593->byval_arg;
    safearray_var = mono_mb_add_local (mb, D.21594);
    conv_arg = safearray_var;
    D.21595 = mono_defaults.int_class;
    D.21596 = &D.21595->byval_arg;
    indices_var = mono_mb_add_local (mb, D.21596);
    D.21595 = mono_defaults.int_class;
    D.21596 = &D.21595->byval_arg;
    empty_var = mono_mb_add_local (mb, D.21596);
    D.21597 = BIT_FIELD_REF <*t, 64, 64>;
    D.21598 = D.21597 & 8589934592;
    if (D.21598 != 0) goto <D.21599>; else goto <D.21600>;
    <D.21599>:
    argnum.129 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.129);
    mono_mb_emit_byte (mb, 80);
    goto <D.21602>;
    <D.21600>:
    argnum.129 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.129);
    <D.21602>:
    safearray_var.130 = (unsigned int) safearray_var;
    mono_mb_emit_ldloc_addr (mb, safearray_var.130);
    indices_var.131 = (unsigned int) indices_var;
    mono_mb_emit_ldloc_addr (mb, indices_var.131);
    empty_var.132 = (unsigned int) empty_var;
    mono_mb_emit_ldloc_addr (mb, empty_var.132);
    mono_mb_emit_icall (mb, mono_marshal_safearray_create);
    label1 = mono_mb_emit_short_branch (mb, 44);
    empty_var.132 = (unsigned int) empty_var;
    mono_mb_emit_ldloc (mb, empty_var.132);
    label2 = mono_mb_emit_short_branch (mb, 45);
    D.21606 = mono_defaults.int32_class;
    D.21607 = &D.21606->byval_arg;
    index_var = mono_mb_add_local (mb, D.21607);
    mono_mb_emit_byte (mb, 22);
    index_var.133 = (unsigned int) index_var;
    mono_mb_emit_stloc (mb, index_var.133);
    D.21609 = mono_mb_get_label (mb);
    label3 = (guint32) D.21609;
    get_value_impl.134 = get_value_impl;
    if (get_value_impl.134 == 0B) goto <D.21611>; else goto <D.21612>;
    <D.21611>:
    D.21613 = mono_defaults.array_class;
    get_value_impl.135 = mono_class_get_method_from_name (D.21613, "GetValueImpl", 1);
    get_value_impl = get_value_impl.135;
    <D.21612>:
    get_value_impl.134 = get_value_impl;
    D.21615 = get_value_impl.134 == 0B;
    D.21616 = (long int) D.21615;
    D.21617 = __builtin_expect (D.21616, 0);
    if (D.21617 != 0) goto <D.21618>; else goto <D.21619>;
    <D.21618>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2725, "get_value_impl");
    <D.21619>:
    D.21597 = BIT_FIELD_REF <*t, 64, 64>;
    D.21598 = D.21597 & 8589934592;
    if (D.21598 != 0) goto <D.21620>; else goto <D.21621>;
    <D.21620>:
    argnum.129 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.129);
    mono_mb_emit_byte (mb, 80);
    goto <D.21622>;
    <D.21621>:
    argnum.129 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.129);
    <D.21622>:
    index_var.133 = (unsigned int) index_var;
    mono_mb_emit_ldloc (mb, index_var.133);
    get_value_impl.134 = get_value_impl;
    mono_mb_emit_managed_call (mb, get_value_impl.134, 0B);
    get_native_variant_for_object.136 = get_native_variant_for_object;
    if (get_native_variant_for_object.136 == 0B) goto <D.21624>; else goto <D.21625>;
    <D.21624>:
    D.21626 = mono_defaults.marshal_class;
    get_native_variant_for_object.137 = mono_class_get_method_from_name (D.21626, "GetNativeVariantForObject", 2);
    get_native_variant_for_object = get_native_variant_for_object.137;
    <D.21625>:
    get_native_variant_for_object.136 = get_native_variant_for_object;
    D.21628 = get_native_variant_for_object.136 == 0B;
    D.21629 = (long int) D.21628;
    D.21630 = __builtin_expect (D.21629, 0);
    if (D.21630 != 0) goto <D.21631>; else goto <D.21632>;
    <D.21631>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2739, "get_native_variant_for_object");
    <D.21632>:
    D.21633 = mono_class_get_variant_class ();
    D.21634 = &D.21633->byval_arg;
    elem_var = mono_mb_add_local (mb, D.21634);
    elem_var.138 = (unsigned int) elem_var;
    mono_mb_emit_ldloc_addr (mb, elem_var.138);
    get_native_variant_for_object.136 = get_native_variant_for_object;
    mono_mb_emit_managed_call (mb, get_native_variant_for_object.136, 0B);
    safearray_var.130 = (unsigned int) safearray_var;
    mono_mb_emit_ldloc (mb, safearray_var.130);
    indices_var.131 = (unsigned int) indices_var;
    mono_mb_emit_ldloc (mb, indices_var.131);
    elem_var.138 = (unsigned int) elem_var;
    mono_mb_emit_ldloc_addr (mb, elem_var.138);
    mono_mb_emit_icall (mb, mono_marshal_safearray_set_value);
    variant_clear.139 = variant_clear;
    if (variant_clear.139 == 0B) goto <D.21637>; else goto <D.21638>;
    <D.21637>:
    D.21639 = mono_class_get_variant_class ();
    variant_clear.140 = mono_class_get_method_from_name (D.21639, "Clear", 0);
    variant_clear = variant_clear.140;
    <D.21638>:
    elem_var.138 = (unsigned int) elem_var;
    mono_mb_emit_ldloc_addr (mb, elem_var.138);
    variant_clear.139 = variant_clear;
    mono_mb_emit_managed_call (mb, variant_clear.139, 0B);
    D.21641 = (short unsigned int) index_var;
    mono_mb_emit_add_to_local (mb, D.21641, 1);
    safearray_var.130 = (unsigned int) safearray_var;
    mono_mb_emit_ldloc (mb, safearray_var.130);
    indices_var.131 = (unsigned int) indices_var;
    mono_mb_emit_ldloc (mb, indices_var.131);
    mono_mb_emit_icall (mb, mono_marshal_safearray_next);
    mono_mb_emit_branch_label (mb, 58, label3);
    mono_mb_patch_short_branch (mb, label2);
    indices_var.131 = (unsigned int) indices_var;
    mono_mb_emit_ldloc (mb, indices_var.131);
    mono_mb_emit_icall (mb, mono_marshal_safearray_free_indices);
    mono_mb_patch_short_branch (mb, label1);
  }
  <D.21592>:
  goto <D.19545>;
  <D.19546>:
  D.21597 = BIT_FIELD_REF <*t, 64, 64>;
  D.21598 = D.21597 & 8589934592;
  if (D.21598 != 0) goto <D.21642>; else goto <D.21643>;
  <D.21642>:
  conv_arg.141 = (unsigned int) conv_arg;
  mono_mb_emit_ldloc_addr (mb, conv_arg.141);
  goto <D.21645>;
  <D.21643>:
  conv_arg.141 = (unsigned int) conv_arg;
  mono_mb_emit_ldloc (mb, conv_arg.141);
  <D.21645>:
  goto <D.19545>;
  <D.19547>:
  D.21588 = t->attrs;
  D.21589 = (int) D.21588;
  D.21646 = D.21589 & 2;
  if (D.21646 != 0) goto <D.21647>; else goto <D.21648>;
  <D.21647>:
  {
    int result_var;
    int indices_var;
    int empty_var;
    int elem_var;
    int index_var;
    guint32 label1;
    guint32 label2;
    guint32 label3;
    guint32 label4;
    static struct MonoMethod * get_object_for_native_variant = 0B;
    static struct MonoMethod * set_value_impl = 0B;
    gboolean byValue;

    label1 = 0;
    label2 = 0;
    label3 = 0;
    label4 = 0;
    D.21597 = BIT_FIELD_REF <*t, 64, 64>;
    D.21598 = D.21597 & 8589934592;
    if (D.21598 == 0) goto <D.21652>; else goto <D.21650>;
    <D.21652>:
    D.21588 = t->attrs;
    D.21589 = (int) D.21588;
    D.21590 = D.21589 & 1;
    if (D.21590 != 0) goto <D.21653>; else goto <D.21650>;
    <D.21653>:
    iftmp.142 = 1;
    goto <D.21651>;
    <D.21650>:
    iftmp.142 = 0;
    <D.21651>:
    byValue = iftmp.142;
    D.21593 = mono_defaults.object_class;
    D.21594 = &D.21593->byval_arg;
    result_var = mono_mb_add_local (mb, D.21594);
    D.21595 = mono_defaults.int_class;
    D.21596 = &D.21595->byval_arg;
    indices_var = mono_mb_add_local (mb, D.21596);
    D.21595 = mono_defaults.int_class;
    D.21596 = &D.21595->byval_arg;
    empty_var = mono_mb_add_local (mb, D.21596);
    conv_arg.141 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.141);
    result_var.143 = (unsigned int) result_var;
    mono_mb_emit_ldloc_addr (mb, result_var.143);
    indices_var.144 = (unsigned int) indices_var;
    mono_mb_emit_ldloc_addr (mb, indices_var.144);
    empty_var.145 = (unsigned int) empty_var;
    mono_mb_emit_ldloc_addr (mb, empty_var.145);
    argnum.129 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.129);
    if (byValue != 0) goto <D.21657>; else goto <D.21658>;
    <D.21657>:
    mono_mb_emit_byte (mb, 22);
    goto <D.21659>;
    <D.21658>:
    mono_mb_emit_byte (mb, 23);
    <D.21659>:
    mono_mb_emit_icall (mb, mono_marshal_safearray_begin);
    label1 = mono_mb_emit_short_branch (mb, 44);
    empty_var.145 = (unsigned int) empty_var;
    mono_mb_emit_ldloc (mb, empty_var.145);
    label2 = mono_mb_emit_short_branch (mb, 45);
    D.21595 = mono_defaults.int_class;
    D.21596 = &D.21595->byval_arg;
    index_var = mono_mb_add_local (mb, D.21596);
    mono_mb_emit_byte (mb, 22);
    index_var.146 = (unsigned int) index_var;
    mono_mb_emit_stloc (mb, index_var.146);
    D.21661 = mono_mb_get_label (mb);
    label3 = (guint32) D.21661;
    if (byValue != 0) goto <D.21662>; else goto <D.21663>;
    <D.21662>:
    index_var.146 = (unsigned int) index_var;
    mono_mb_emit_ldloc (mb, index_var.146);
    argnum.129 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.129);
    mono_mb_emit_byte (mb, 142);
    label4 = mono_mb_emit_branch (mb, 60);
    <D.21663>:
    conv_arg.141 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.141);
    indices_var.144 = (unsigned int) indices_var;
    mono_mb_emit_ldloc (mb, indices_var.144);
    mono_mb_emit_icall (mb, mono_marshal_safearray_get_value);
    get_object_for_native_variant.147 = get_object_for_native_variant;
    if (get_object_for_native_variant.147 == 0B) goto <D.21665>; else goto <D.21666>;
    <D.21665>:
    D.21626 = mono_defaults.marshal_class;
    get_object_for_native_variant.148 = mono_class_get_method_from_name (D.21626, "GetObjectForNativeVariant", 1);
    get_object_for_native_variant = get_object_for_native_variant.148;
    <D.21666>:
    get_object_for_native_variant.147 = get_object_for_native_variant;
    D.21668 = get_object_for_native_variant.147 == 0B;
    D.21669 = (long int) D.21668;
    D.21670 = __builtin_expect (D.21669, 0);
    if (D.21670 != 0) goto <D.21671>; else goto <D.21672>;
    <D.21671>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2854, "get_object_for_native_variant");
    <D.21672>:
    set_value_impl.149 = set_value_impl;
    if (set_value_impl.149 == 0B) goto <D.21674>; else goto <D.21675>;
    <D.21674>:
    D.21613 = mono_defaults.array_class;
    set_value_impl.150 = mono_class_get_method_from_name (D.21613, "SetValueImpl", 2);
    set_value_impl = set_value_impl.150;
    <D.21675>:
    set_value_impl.149 = set_value_impl;
    D.21677 = set_value_impl.149 == 0B;
    D.21678 = (long int) D.21677;
    D.21679 = __builtin_expect (D.21678, 0);
    if (D.21679 != 0) goto <D.21680>; else goto <D.21681>;
    <D.21680>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "cominterop.c", 2858, "set_value_impl");
    <D.21681>:
    D.21593 = mono_defaults.object_class;
    D.21594 = &D.21593->byval_arg;
    elem_var = mono_mb_add_local (mb, D.21594);
    get_object_for_native_variant.147 = get_object_for_native_variant;
    mono_mb_emit_managed_call (mb, get_object_for_native_variant.147, 0B);
    elem_var.151 = (unsigned int) elem_var;
    mono_mb_emit_stloc (mb, elem_var.151);
    result_var.143 = (unsigned int) result_var;
    mono_mb_emit_ldloc (mb, result_var.143);
    elem_var.151 = (unsigned int) elem_var;
    mono_mb_emit_ldloc (mb, elem_var.151);
    index_var.146 = (unsigned int) index_var;
    mono_mb_emit_ldloc (mb, index_var.146);
    set_value_impl.149 = set_value_impl;
    mono_mb_emit_managed_call (mb, set_value_impl.149, 0B);
    if (byValue != 0) goto <D.21683>; else goto <D.21684>;
    <D.21683>:
    mono_mb_patch_short_branch (mb, label4);
    <D.21684>:
    D.21685 = (short unsigned int) index_var;
    mono_mb_emit_add_to_local (mb, D.21685, 1);
    conv_arg.141 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.141);
    indices_var.144 = (unsigned int) indices_var;
    mono_mb_emit_ldloc (mb, indices_var.144);
    mono_mb_emit_icall (mb, mono_marshal_safearray_next);
    mono_mb_emit_branch_label (mb, 58, label3);
    mono_mb_patch_short_branch (mb, label2);
    conv_arg.141 = (unsigned int) conv_arg;
    mono_mb_emit_ldloc (mb, conv_arg.141);
    indices_var.144 = (unsigned int) indices_var;
    mono_mb_emit_ldloc (mb, indices_var.144);
    mono_mb_emit_icall (mb, mono_marshal_safearray_end);
    mono_mb_patch_short_branch (mb, label1);
    if (byValue == 0) goto <D.21686>; else goto <D.21687>;
    <D.21686>:
    argnum.129 = (unsigned int) argnum;
    mono_mb_emit_ldarg (mb, argnum.129);
    result_var.143 = (unsigned int) result_var;
    mono_mb_emit_ldloc (mb, result_var.143);
    mono_mb_emit_byte (mb, 81);
    <D.21687>:
  }
  <D.21648>:
  goto <D.19545>;
  <D.19560>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "cominterop.c", 2898);
  <D.19545>:
  D.21688 = conv_arg;
  return D.21688;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (void * ptr)
{
  struct MonoString * D.21690;

  D.21690 = mono_string_from_bstr (ptr);
  return D.21690;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (struct MonoString * ptr)
{
  void * D.21692;

  D.21692 = mono_string_to_bstr (ptr);
  return D.21692;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (void * ptr)
{
  mono_free_bstr (ptr);
}


