mono_method_has_declsec (struct MonoMethod * method)
{
  unsigned int D.21541;
  unsigned int D.21542;
  MonoBoolean D.21546;
  struct MonoClass * D.21551;
  unsigned int D.21552;
  unsigned int D.21553;
  short unsigned int D.21555;
  int D.21556;
  int D.21557;
  int D.21469;
  int iftmp.0;
  int D.21468;
  const char[7] * D.21561;
  unsigned char D.21562;
  int D.21563;
  unsigned char D.21564;
  int D.21565;
  const unsigned char * D.21570;
  unsigned char D.21571;
  int D.21572;
  const unsigned char * D.21573;
  unsigned char D.21574;
  int D.21575;
  const unsigned char * D.21580;
  unsigned char D.21581;
  int D.21582;
  const unsigned char * D.21583;
  unsigned char D.21584;
  int D.21585;
  const unsigned char * D.21590;
  unsigned char D.21591;
  int D.21592;
  const unsigned char * D.21593;
  unsigned char D.21594;
  int D.21595;
  const char * D.21597;

  InterlockedIncrement (&mono_jit_stats.cas_declsec_check);
  D.21541 = BIT_FIELD_REF <*method, 32, 160>;
  D.21542 = D.21541 & 124;
  if (D.21542 == 24) goto <D.21538>; else goto <D.21543>;
  <D.21543>:
  D.21541 = BIT_FIELD_REF <*method, 32, 160>;
  D.21542 = D.21541 & 124;
  if (D.21542 == 28) goto <D.21538>; else goto <D.21539>;
  <D.21538>:
  method = mono_marshal_method_from_wrapper (method);
  if (method == 0B) goto <D.21544>; else goto <D.21545>;
  <D.21544>:
  D.21546 = 0;
  return D.21546;
  <D.21545>:
  goto <D.21540>;
  <D.21539>:
  D.21541 = BIT_FIELD_REF <*method, 32, 160>;
  D.21542 = D.21541 & 124;
  if (D.21542 != 0) goto <D.21547>; else goto <D.21548>;
  <D.21547>:
  D.21546 = 0;
  return D.21546;
  <D.21548>:
  <D.21540>:
  D.21551 = method->klass;
  D.21552 = D.21551->flags;
  D.21553 = D.21552 & 262144;
  if (D.21553 != 0) goto <D.21549>; else goto <D.21554>;
  <D.21554>:
  D.21555 = method->flags;
  D.21556 = (int) D.21555;
  D.21557 = D.21556 & 16384;
  if (D.21557 != 0) goto <D.21549>; else goto <D.21550>;
  <D.21549>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 6;
    if (__s2_len <= 3) goto <D.21559>; else goto <D.21560>;
    <D.21559>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = method->name;
      D.21561 = ".cctor";
      D.21562 = MEM[(const unsigned char *)D.21561];
      D.21563 = (int) D.21562;
      D.21564 = *__s2;
      D.21565 = (int) D.21564;
      __result = D.21563 - D.21565;
      {
        if (__s2_len != 0) goto <D.21566>; else goto <D.21567>;
        <D.21566>:
        if (__result == 0) goto <D.21568>; else goto <D.21569>;
        <D.21568>:
        D.21570 = &MEM[(void *)".cctor" + 1B];
        D.21571 = *D.21570;
        D.21572 = (int) D.21571;
        D.21573 = __s2 + 1;
        D.21574 = *D.21573;
        D.21575 = (int) D.21574;
        __result = D.21572 - D.21575;
        if (__s2_len > 1) goto <D.21576>; else goto <D.21577>;
        <D.21576>:
        if (__result == 0) goto <D.21578>; else goto <D.21579>;
        <D.21578>:
        D.21580 = &MEM[(void *)".cctor" + 2B];
        D.21581 = *D.21580;
        D.21582 = (int) D.21581;
        D.21583 = __s2 + 2;
        D.21584 = *D.21583;
        D.21585 = (int) D.21584;
        __result = D.21582 - D.21585;
        if (__s2_len > 2) goto <D.21586>; else goto <D.21587>;
        <D.21586>:
        if (__result == 0) goto <D.21588>; else goto <D.21589>;
        <D.21588>:
        D.21590 = &MEM[(void *)".cctor" + 3B];
        D.21591 = *D.21590;
        D.21592 = (int) D.21591;
        D.21593 = __s2 + 3;
        D.21594 = *D.21593;
        D.21595 = (int) D.21594;
        __result = D.21592 - D.21595;
        <D.21589>:
        <D.21587>:
        <D.21579>:
        <D.21577>:
        <D.21569>:
        <D.21567>:
      }
      D.21468 = __result;
    }
    iftmp.0 = -D.21468;
    goto <D.21596>;
    <D.21560>:
    D.21597 = method->name;
    iftmp.0 = __builtin_strcmp (D.21597, ".cctor");
    <D.21596>:
    D.21469 = iftmp.0;
  }
  if (D.21469 != 0) goto <D.21598>; else goto <D.21599>;
  <D.21598>:
  D.21546 = 1;
  return D.21546;
  <D.21599>:
  <D.21550>:
  D.21546 = 0;
  return D.21546;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.21601;
  unsigned int D.21602;

  D.21602 = __sync_add_and_fetch_4 (val, 1);
  D.21601 = (gint32) D.21602;
  return D.21601;
}


mono_declsec_cache_stack_modifiers (struct MonoJitInfo * jinfo)
{
  unsigned int D.21606;
  _Bool D.21607;
  <unnamed-signed:1> D.21608;
  unsigned int D.21609;
  _Bool D.21610;
  <unnamed-signed:1> D.21611;
  unsigned int D.21612;
  _Bool D.21613;
  <unnamed-signed:1> D.21614;
  struct MonoClass * D.21615;
  struct MonoMethodCasInfo * info;
  struct MonoMethod * method;
  guint32 flags;

  info = mono_jit_info_get_cas_info (jinfo);
  if (info == 0B) goto <D.21604>; else goto <D.21605>;
  <D.21604>:
  return;
  <D.21605>:
  method = jinfo_get_method (jinfo);
  flags = mono_declsec_flags_from_method (method);
  D.21606 = flags & 4;
  D.21607 = D.21606 != 0;
  D.21608 = (<unnamed-signed:1>) D.21607;
  info->cas_method_assert = D.21608;
  D.21609 = flags & 8;
  D.21610 = D.21609 != 0;
  D.21611 = (<unnamed-signed:1>) D.21610;
  info->cas_method_deny = D.21611;
  D.21612 = flags & 16;
  D.21613 = D.21612 != 0;
  D.21614 = (<unnamed-signed:1>) D.21613;
  info->cas_method_permitonly = D.21614;
  D.21615 = method->klass;
  flags = mono_declsec_flags_from_class (D.21615);
  D.21606 = flags & 4;
  D.21607 = D.21606 != 0;
  D.21608 = (<unnamed-signed:1>) D.21607;
  info->cas_class_assert = D.21608;
  D.21609 = flags & 8;
  D.21610 = D.21609 != 0;
  D.21611 = (<unnamed-signed:1>) D.21610;
  info->cas_class_deny = D.21611;
  D.21612 = flags & 16;
  D.21613 = D.21612 != 0;
  D.21614 = (<unnamed-signed:1>) D.21613;
  info->cas_class_permitonly = D.21614;
}


jinfo_get_method (struct MonoJitInfo * ji)
{
  struct MonoMethod * D.21617;

  D.21617 = mono_jit_info_get_method (ji);
  return D.21617;
}


mono_declsec_create_frame (struct MonoDomain * domain, struct MonoJitInfo * jinfo)
{
  struct MonoClass * D.21619;
  unsigned int D.21622;
  unsigned int D.21623;
  unsigned char D.21626;
  struct MonoReflectionMethod * * D.21629;
  struct MonoReflectionMethod * D.21630;
  struct MonoAppDomain * * D.21631;
  struct MonoAppDomain * D.21632;
  unsigned int D.21636;
  struct MonoDeclSecurityEntry * D.21638;
  unsigned int D.21641;
  struct MonoClass * D.21644;
  unsigned int D.21648;
  struct MonoDeclSecurityEntry * D.21650;
  unsigned int D.21653;
  unsigned int D.21659;
  struct MonoDeclSecurityEntry * D.21661;
  unsigned int D.21664;
  struct MonoSecurityFrame * D.21667;
  struct MonoSecurityFrame * frame;
  struct MonoMethodCasInfo * info;
  struct MonoMethod * method;

  D.21619 = mono_defaults.runtimesecurityframe_class;
  frame = mono_object_new (domain, D.21619);
  method = jinfo_get_method (jinfo);
  info = mono_jit_info_get_cas_info (jinfo);
  if (info != 0B) goto <D.21620>; else goto <D.21621>;
  <D.21620>:
  D.21622 = BIT_FIELD_REF <*info, 32, 0>;
  D.21623 = D.21622 & 1;
  if (D.21623 == 0) goto <D.21624>; else goto <D.21625>;
  <D.21624>:
  D.21626 = mono_method_has_declsec (method);
  if (D.21626 != 0) goto <D.21627>; else goto <D.21628>;
  <D.21627>:
  mono_declsec_cache_stack_modifiers (jinfo);
  <D.21628>:
  info->cas_inited = -1;
  <D.21625>:
  <D.21621>:
  D.21629 = &frame->method;
  D.21630 = mono_method_get_object (domain, method, 0B);
  mono_gc_wbarrier_set_field (frame, D.21629, D.21630);
  D.21631 = &frame->domain;
  D.21632 = domain->domain;
  mono_gc_wbarrier_set_field (frame, D.21631, D.21632);
  if (info != 0B) goto <D.21635>; else goto <D.21633>;
  <D.21635>:
  D.21622 = BIT_FIELD_REF <*info, 32, 0>;
  D.21636 = D.21622 & 16;
  if (D.21636 != 0) goto <D.21637>; else goto <D.21633>;
  <D.21637>:
  D.21638 = &frame->assert;
  mono_declsec_get_method_action (method, 3, D.21638);
  goto <D.21634>;
  <D.21633>:
  if (info != 0B) goto <D.21639>; else goto <D.21640>;
  <D.21639>:
  D.21622 = BIT_FIELD_REF <*info, 32, 0>;
  D.21641 = D.21622 & 2;
  if (D.21641 != 0) goto <D.21642>; else goto <D.21643>;
  <D.21642>:
  D.21644 = method->klass;
  D.21638 = &frame->assert;
  mono_declsec_get_class_action (D.21644, 3, D.21638);
  <D.21643>:
  <D.21640>:
  <D.21634>:
  if (info != 0B) goto <D.21647>; else goto <D.21645>;
  <D.21647>:
  D.21622 = BIT_FIELD_REF <*info, 32, 0>;
  D.21648 = D.21622 & 32;
  if (D.21648 != 0) goto <D.21649>; else goto <D.21645>;
  <D.21649>:
  D.21650 = &frame->deny;
  mono_declsec_get_method_action (method, 4, D.21650);
  goto <D.21646>;
  <D.21645>:
  if (info != 0B) goto <D.21651>; else goto <D.21652>;
  <D.21651>:
  D.21622 = BIT_FIELD_REF <*info, 32, 0>;
  D.21653 = D.21622 & 4;
  if (D.21653 != 0) goto <D.21654>; else goto <D.21655>;
  <D.21654>:
  D.21644 = method->klass;
  D.21650 = &frame->deny;
  mono_declsec_get_class_action (D.21644, 4, D.21650);
  <D.21655>:
  <D.21652>:
  <D.21646>:
  if (info != 0B) goto <D.21658>; else goto <D.21656>;
  <D.21658>:
  D.21622 = BIT_FIELD_REF <*info, 32, 0>;
  D.21659 = D.21622 & 64;
  if (D.21659 != 0) goto <D.21660>; else goto <D.21656>;
  <D.21660>:
  D.21661 = &frame->permitonly;
  mono_declsec_get_method_action (method, 5, D.21661);
  goto <D.21657>;
  <D.21656>:
  if (info != 0B) goto <D.21662>; else goto <D.21663>;
  <D.21662>:
  D.21622 = BIT_FIELD_REF <*info, 32, 0>;
  D.21664 = D.21622 & 8;
  if (D.21664 != 0) goto <D.21665>; else goto <D.21666>;
  <D.21665>:
  D.21644 = method->klass;
  D.21661 = &frame->permitonly;
  mono_declsec_get_class_action (D.21644, 5, D.21661);
  <D.21666>:
  <D.21663>:
  <D.21657>:
  D.21667 = frame;
  return D.21667;
}


mono_declsec_linkdemand (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * callee)
{
  struct MonoClass * D.21669;
  struct MonoImage * D.21670;
  struct MonoImage * D.21671;
  struct MonoClass * D.21674;
  struct MonoImage * D.21675;
  guint32 D.21678;
  short unsigned int D.21679;
  int D.21680;
  int D.21681;
  int D.21684;
  short unsigned int D.21688;
  int D.21689;
  int D.21690;
  int D.21693;
  int D.21698;
  unsigned char D.21703;
  int D.21706;
  guint32 violation;

  violation = 0;
  D.21669 = caller->klass;
  D.21670 = D.21669->image;
  D.21671 = mono_defaults.corlib;
  if (D.21670 == D.21671) goto <D.21672>; else goto <D.21673>;
  <D.21672>:
  D.21674 = callee->klass;
  D.21675 = D.21674->image;
  D.21671 = mono_defaults.corlib;
  if (D.21675 == D.21671) goto <D.21676>; else goto <D.21677>;
  <D.21676>:
  D.21678 = violation;
  return D.21678;
  <D.21677>:
  <D.21673>:
  D.21679 = callee->iflags;
  D.21680 = (int) D.21679;
  D.21681 = D.21680 & 4096;
  if (D.21681 != 0) goto <D.21682>; else goto <D.21683>;
  <D.21682>:
  D.21684 = mono_declsec_linkdemand_icall (domain, caller, callee);
  if (D.21684 != 0) goto <D.21685>; else goto <D.21686>;
  <D.21685>:
  violation = 4;
  <D.21686>:
  goto <D.21687>;
  <D.21683>:
  D.21688 = callee->flags;
  D.21689 = (int) D.21688;
  D.21690 = D.21689 & 8192;
  if (D.21690 != 0) goto <D.21691>; else goto <D.21692>;
  <D.21691>:
  D.21693 = mono_declsec_linkdemand_pinvoke (domain, caller, callee);
  if (D.21693 != 0) goto <D.21694>; else goto <D.21695>;
  <D.21694>:
  violation = 8;
  <D.21695>:
  <D.21692>:
  <D.21687>:
  if (violation == 0) goto <D.21696>; else goto <D.21697>;
  <D.21696>:
  D.21698 = mono_declsec_linkdemand_aptc (domain, caller, callee);
  if (D.21698 != 0) goto <D.21699>; else goto <D.21700>;
  <D.21699>:
  violation = 2;
  <D.21700>:
  <D.21697>:
  if (violation == 0) goto <D.21701>; else goto <D.21702>;
  <D.21701>:
  D.21703 = mono_method_has_declsec (callee);
  if (D.21703 != 0) goto <D.21704>; else goto <D.21705>;
  <D.21704>:
  D.21706 = mono_declsec_linkdemand_standard (domain, caller, callee);
  if (D.21706 != 0) goto <D.21707>; else goto <D.21708>;
  <D.21707>:
  violation = 1;
  <D.21708>:
  <D.21705>:
  <D.21702>:
  D.21678 = violation;
  return D.21678;
}


mono_declsec_linkdemand_icall (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * icall)
{
  struct MonoClass * D.21710;
  struct MonoImage * D.21711;
  <unnamed-unsigned:2> D.21712;
  int D.21713;
  int D.21714;
  <unnamed-unsigned:2> iftmp.1;
  unsigned int size.2;
  int size.3;
  int D.21720;
  int D.21724;
  gboolean D.21727;
  struct MonoClass * D.21728;
  struct MonoImage * D.21729;
  int D.21730;
  _Bool D.21731;
  struct MonoAssembly * assembly;

  InterlockedIncrement (&mono_jit_stats.cas_linkdemand_icall);
  D.21710 = icall->klass;
  D.21711 = D.21710->image;
  assembly = mono_image_get_assembly (D.21711);
  D.21712 = assembly->ecma;
  D.21713 = (int) D.21712;
  D.21714 = D.21713 & 2;
  if (D.21714 == 0) goto <D.21715>; else goto <D.21716>;
  <D.21715>:
  {
    guint32 size;
    const char * pk;

    try
      {
        size = 0;
        D.21710 = icall->klass;
        D.21711 = D.21710->image;
        pk = mono_image_get_public_key (D.21711, &size);
        size.2 = size;
        size.3 = (int) size.2;
        D.21720 = mono_is_ecma_key (pk, size.3);
        if (D.21720 != 0) goto <D.21721>; else goto <D.21722>;
        <D.21721>:
        iftmp.1 = 3;
        goto <D.21723>;
        <D.21722>:
        iftmp.1 = 2;
        <D.21723>:
        assembly->ecma = iftmp.1;
      }
    finally
      {
        size = {CLOBBER};
      }
  }
  <D.21716>:
  D.21712 = assembly->ecma;
  D.21713 = (int) D.21712;
  D.21724 = D.21713 & 1;
  if (D.21724 != 0) goto <D.21725>; else goto <D.21726>;
  <D.21725>:
  D.21727 = 0;
  return D.21727;
  <D.21726>:
  D.21728 = caller->klass;
  D.21729 = D.21728->image;
  assembly = mono_image_get_assembly (D.21729);
  D.21730 = mono_declsec_is_assembly_fulltrust (domain, assembly);
  D.21731 = D.21730 == 0;
  D.21727 = (gboolean) D.21731;
  return D.21727;
}


mono_declsec_is_assembly_fulltrust (struct MonoDomain * domain, struct MonoAssembly * assembly)
{
  <unnamed-unsigned:2> D.21733;
  int D.21734;
  int D.21735;
  struct MonoMethod * D.21742;
  void * D.21743;
  unsigned char D.21744;
  gboolean D.21747;
  int D.21748;

  D.21733 = assembly->fulltrust;
  D.21734 = (int) D.21733;
  D.21735 = D.21734 & 2;
  if (D.21735 == 0) goto <D.21736>; else goto <D.21737>;
  <D.21736>:
  {
    struct MonoReflectionAssembly * refass;
    struct MonoSecurityManager * secman;

    refass = mono_assembly_get_object (domain, assembly);
    secman = mono_security_manager_get_methods ();
    if (secman != 0B) goto <D.21738>; else goto <D.21739>;
    <D.21738>:
    if (refass != 0B) goto <D.21740>; else goto <D.21741>;
    <D.21740>:
    {
      struct MonoObject * res;
      void * args[1];

      try
        {
          args[0] = refass;
          D.21742 = secman->linkdemandfulltrust;
          res = mono_runtime_invoke (D.21742, 0B, &args, 0B);
          D.21743 = mono_object_unbox (res);
          D.21744 = MEM[(MonoBoolean *)D.21743];
          if (D.21744 != 0) goto <D.21745>; else goto <D.21746>;
          <D.21745>:
          assembly->fulltrust = 3;
          D.21747 = 1;
          return D.21747;
          <D.21746>:
        }
      finally
        {
          args = {CLOBBER};
        }
    }
    <D.21741>:
    <D.21739>:
    assembly->fulltrust = 2;
    D.21747 = 0;
    return D.21747;
  }
  <D.21737>:
  D.21733 = assembly->fulltrust;
  D.21748 = (int) D.21733;
  D.21747 = D.21748 & 1;
  return D.21747;
}


mono_declsec_linkdemand_pinvoke (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * native)
{
  struct MonoClass * D.21752;
  struct MonoImage * D.21753;
  <unnamed-unsigned:2> D.21754;
  int D.21755;
  int D.21756;
  <unnamed-unsigned:2> D.21759;
  unsigned int D.21760;
  unsigned int D.21761;
  gboolean D.21764;
  struct MonoMethod * D.21769;
  void * D.21770;
  unsigned char D.21771;
  int D.21774;
  struct MonoAssembly * assembly;

  D.21752 = caller->klass;
  D.21753 = D.21752->image;
  assembly = mono_image_get_assembly (D.21753);
  InterlockedIncrement (&mono_jit_stats.cas_linkdemand_pinvoke);
  D.21754 = assembly->unmanaged;
  D.21755 = (int) D.21754;
  D.21756 = D.21755 & 2;
  if (D.21756 == 0) goto <D.21757>; else goto <D.21758>;
  <D.21757>:
  D.21759 = assembly->fulltrust;
  D.21760 = (unsigned int) D.21759;
  D.21761 = D.21760 & 3;
  if (D.21761 == 3) goto <D.21762>; else goto <D.21763>;
  <D.21762>:
  assembly->unmanaged = 3;
  D.21764 = 0;
  return D.21764;
  <D.21763>:
  {
    struct MonoReflectionAssembly * refass;
    struct MonoSecurityManager * secman;

    refass = mono_assembly_get_object (domain, assembly);
    secman = mono_security_manager_get_methods ();
    if (secman != 0B) goto <D.21765>; else goto <D.21766>;
    <D.21765>:
    if (refass != 0B) goto <D.21767>; else goto <D.21768>;
    <D.21767>:
    {
      struct MonoObject * res;
      void * args[1];

      try
        {
          args[0] = refass;
          D.21769 = secman->linkdemandunmanaged;
          res = mono_runtime_invoke (D.21769, 0B, &args, 0B);
          D.21770 = mono_object_unbox (res);
          D.21771 = MEM[(MonoBoolean *)D.21770];
          if (D.21771 != 0) goto <D.21772>; else goto <D.21773>;
          <D.21772>:
          assembly->unmanaged = 3;
          D.21764 = 0;
          return D.21764;
          <D.21773>:
        }
      finally
        {
          args = {CLOBBER};
        }
    }
    <D.21768>:
    <D.21766>:
  }
  assembly->unmanaged = 2;
  <D.21758>:
  D.21754 = assembly->unmanaged;
  D.21755 = (int) D.21754;
  D.21774 = D.21755 & 1;
  if (D.21774 != 0) goto <D.21775>; else goto <D.21776>;
  <D.21775>:
  D.21764 = 0;
  return D.21764;
  <D.21776>:
  D.21764 = 1;
  return D.21764;
}


mono_declsec_linkdemand_aptc (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * callee)
{
  struct MonoClass * D.21780;
  struct MonoImage * D.21781;
  struct MonoClass * D.21782;
  struct MonoImage * D.21783;
  gboolean D.21786;
  unsigned int D.21789;
  unsigned int D.21790;
  short unsigned int D.21792;
  int D.21793;
  int D.21794;
  const char * D.21797;
  unsigned int size.4;
  <unnamed-unsigned:2> D.21800;
  int D.21801;
  int D.21802;
  struct MonoClass * D.21809;
  <unnamed-unsigned:2> iftmp.5;
  int D.21816;
  int D.21819;
  struct MonoSecurityManager * secman;
  struct MonoAssembly * assembly;
  guint32 size;

  try
    {
      secman = 0B;
      size = 0;
      InterlockedIncrement (&mono_jit_stats.cas_linkdemand_aptc);
      D.21780 = caller->klass;
      D.21781 = D.21780->image;
      D.21782 = callee->klass;
      D.21783 = D.21782->image;
      if (D.21781 == D.21783) goto <D.21784>; else goto <D.21785>;
      <D.21784>:
      D.21786 = 0;
      return D.21786;
      <D.21785>:
      D.21782 = callee->klass;
      D.21789 = D.21782->flags;
      D.21790 = D.21789 & 1;
      if (D.21790 == 0) goto <D.21787>; else goto <D.21791>;
      <D.21791>:
      D.21792 = callee->flags;
      D.21793 = (int) D.21792;
      D.21794 = D.21793 & 6;
      if (D.21794 == 0) goto <D.21787>; else goto <D.21788>;
      <D.21787>:
      D.21786 = 0;
      return D.21786;
      <D.21788>:
      D.21782 = callee->klass;
      D.21783 = D.21782->image;
      D.21797 = mono_image_get_public_key (D.21783, &size);
      if (D.21797 == 0B) goto <D.21795>; else goto <D.21798>;
      <D.21798>:
      size.4 = size;
      if (size.4 <= 15) goto <D.21795>; else goto <D.21796>;
      <D.21795>:
      D.21786 = 0;
      return D.21786;
      <D.21796>:
      D.21782 = callee->klass;
      D.21783 = D.21782->image;
      assembly = mono_image_get_assembly (D.21783);
      D.21800 = assembly->aptc;
      D.21801 = (int) D.21800;
      D.21802 = D.21801 & 2;
      if (D.21802 == 0) goto <D.21803>; else goto <D.21804>;
      <D.21803>:
      {
        struct MonoCustomAttrInfo * cinfo;
        gboolean result;

        cinfo = mono_custom_attrs_from_assembly (assembly);
        result = 0;
        secman = mono_security_manager_get_methods ();
        if (secman != 0B) goto <D.21805>; else goto <D.21806>;
        <D.21805>:
        if (cinfo != 0B) goto <D.21807>; else goto <D.21808>;
        <D.21807>:
        D.21809 = secman->allowpartiallytrustedcallers;
        result = mono_custom_attrs_has_attr (cinfo, D.21809);
        <D.21808>:
        <D.21806>:
        if (cinfo != 0B) goto <D.21810>; else goto <D.21811>;
        <D.21810>:
        mono_custom_attrs_free (cinfo);
        <D.21811>:
        if (result != 0) goto <D.21813>; else goto <D.21814>;
        <D.21813>:
        iftmp.5 = 3;
        goto <D.21815>;
        <D.21814>:
        iftmp.5 = 2;
        <D.21815>:
        assembly->aptc = iftmp.5;
      }
      <D.21804>:
      D.21800 = assembly->aptc;
      D.21801 = (int) D.21800;
      D.21816 = D.21801 & 1;
      if (D.21816 != 0) goto <D.21817>; else goto <D.21818>;
      <D.21817>:
      D.21786 = 0;
      return D.21786;
      <D.21818>:
      D.21780 = caller->klass;
      D.21781 = D.21780->image;
      assembly = mono_image_get_assembly (D.21781);
      D.21819 = mono_declsec_is_assembly_fulltrust (domain, assembly);
      if (D.21819 != 0) goto <D.21820>; else goto <D.21821>;
      <D.21820>:
      D.21786 = 0;
      return D.21786;
      <D.21821>:
      D.21786 = 1;
      return D.21786;
    }
  finally
    {
      size = {CLOBBER};
    }
}


mono_declsec_linkdemand_standard (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * callee)
{
  unsigned char D.21824;
  struct MonoClass * D.21827;
  struct MonoImage * D.21828;
  struct MonoMethod * D.21829;
  gboolean D.21830;
  void * D.21831;
  unsigned char D.21832;
  _Bool D.21833;
  struct MonoDeclSecurityActions linkclass;
  struct MonoDeclSecurityActions linkmethod;

  try
    {
      InterlockedIncrement (&mono_jit_stats.cas_linkdemand);
      D.21824 = mono_declsec_get_linkdemands (callee, &linkclass, &linkmethod);
      if (D.21824 != 0) goto <D.21825>; else goto <D.21826>;
      <D.21825>:
      {
        struct MonoAssembly * assembly;
        struct MonoReflectionAssembly * refass;
        struct MonoSecurityManager * secman;
        struct MonoObject * res;
        void * args[3];

        try
          {
            D.21827 = caller->klass;
            D.21828 = D.21827->image;
            assembly = mono_image_get_assembly (D.21828);
            refass = mono_assembly_get_object (domain, assembly);
            secman = mono_security_manager_get_methods ();
            args[0] = refass;
            args[1] = &linkclass;
            args[2] = &linkmethod;
            D.21829 = secman->linkdemand;
            res = mono_runtime_invoke (D.21829, 0B, &args, 0B);
            D.21831 = mono_object_unbox (res);
            D.21832 = MEM[(MonoBoolean *)D.21831];
            D.21833 = D.21832 == 0;
            D.21830 = (gboolean) D.21833;
            return D.21830;
          }
        finally
          {
            args = {CLOBBER};
          }
      }
      <D.21826>:
      D.21830 = 0;
      return D.21830;
    }
  finally
    {
      linkclass = {CLOBBER};
      linkmethod = {CLOBBER};
    }
}


