mono_method_has_declsec (struct MonoMethod * method)
{
  long unsigned int D.22390;
  long unsigned int D.22391;
  MonoBoolean D.22395;
  struct MonoClass * D.22400;
  unsigned int D.22401;
  unsigned int D.22402;
  short unsigned int D.22404;
  int D.22405;
  int D.22406;
  int D.22318;
  int iftmp.0;
  int D.22317;
  const char[7] * D.22410;
  unsigned char D.22411;
  int D.22412;
  unsigned char D.22413;
  int D.22414;
  const unsigned char * D.22419;
  unsigned char D.22420;
  int D.22421;
  const unsigned char * D.22422;
  unsigned char D.22423;
  int D.22424;
  const unsigned char * D.22429;
  unsigned char D.22430;
  int D.22431;
  const unsigned char * D.22432;
  unsigned char D.22433;
  int D.22434;
  const unsigned char * D.22439;
  unsigned char D.22440;
  int D.22441;
  const unsigned char * D.22442;
  unsigned char D.22443;
  int D.22444;
  const char * D.22446;

  InterlockedIncrement (&mono_jit_stats.cas_declsec_check);
  D.22390 = BIT_FIELD_REF <*method, 64, 256>;
  D.22391 = D.22390 & 124;
  if (D.22391 == 24) goto <D.22387>; else goto <D.22392>;
  <D.22392>:
  D.22390 = BIT_FIELD_REF <*method, 64, 256>;
  D.22391 = D.22390 & 124;
  if (D.22391 == 28) goto <D.22387>; else goto <D.22388>;
  <D.22387>:
  method = mono_marshal_method_from_wrapper (method);
  if (method == 0B) goto <D.22393>; else goto <D.22394>;
  <D.22393>:
  D.22395 = 0;
  return D.22395;
  <D.22394>:
  goto <D.22389>;
  <D.22388>:
  D.22390 = BIT_FIELD_REF <*method, 64, 256>;
  D.22391 = D.22390 & 124;
  if (D.22391 != 0) goto <D.22396>; else goto <D.22397>;
  <D.22396>:
  D.22395 = 0;
  return D.22395;
  <D.22397>:
  <D.22389>:
  D.22400 = method->klass;
  D.22401 = D.22400->flags;
  D.22402 = D.22401 & 262144;
  if (D.22402 != 0) goto <D.22398>; else goto <D.22403>;
  <D.22403>:
  D.22404 = method->flags;
  D.22405 = (int) D.22404;
  D.22406 = D.22405 & 16384;
  if (D.22406 != 0) goto <D.22398>; else goto <D.22399>;
  <D.22398>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = method->name;
      D.22410 = ".cctor";
      D.22411 = MEM[(const unsigned char *)D.22410];
      D.22412 = (int) D.22411;
      D.22413 = *__s2;
      D.22414 = (int) D.22413;
      __result = D.22412 - D.22414;
      {
        if (__s2_len != 0) goto <D.22415>; else goto <D.22416>;
        <D.22415>:
        if (__result == 0) goto <D.22417>; else goto <D.22418>;
        <D.22417>:
        D.22419 = &MEM[(void *)".cctor" + 1B];
        D.22420 = *D.22419;
        D.22421 = (int) D.22420;
        D.22422 = __s2 + 1;
        D.22423 = *D.22422;
        D.22424 = (int) D.22423;
        __result = D.22421 - D.22424;
        if (__s2_len > 1) goto <D.22425>; else goto <D.22426>;
        <D.22425>:
        if (__result == 0) goto <D.22427>; else goto <D.22428>;
        <D.22427>:
        D.22429 = &MEM[(void *)".cctor" + 2B];
        D.22430 = *D.22429;
        D.22431 = (int) D.22430;
        D.22432 = __s2 + 2;
        D.22433 = *D.22432;
        D.22434 = (int) D.22433;
        __result = D.22431 - D.22434;
        if (__s2_len > 2) goto <D.22435>; else goto <D.22436>;
        <D.22435>:
        if (__result == 0) goto <D.22437>; else goto <D.22438>;
        <D.22437>:
        D.22439 = &MEM[(void *)".cctor" + 3B];
        D.22440 = *D.22439;
        D.22441 = (int) D.22440;
        D.22442 = __s2 + 3;
        D.22443 = *D.22442;
        D.22444 = (int) D.22443;
        __result = D.22441 - D.22444;
        <D.22438>:
        <D.22436>:
        <D.22428>:
        <D.22426>:
        <D.22418>:
        <D.22416>:
      }
      D.22317 = __result;
    }
    iftmp.0 = -D.22317;
    goto <D.22445>;
    <D.22409>:
    D.22446 = method->name;
    iftmp.0 = __builtin_strcmp (D.22446, ".cctor");
    <D.22445>:
    D.22318 = iftmp.0;
  }
  if (D.22318 != 0) goto <D.22447>; else goto <D.22448>;
  <D.22447>:
  D.22395 = 1;
  return D.22395;
  <D.22448>:
  <D.22399>:
  D.22395 = 0;
  return D.22395;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.22450;
  unsigned int D.22451;

  D.22451 = __sync_add_and_fetch_4 (val, 1);
  D.22450 = (gint32) D.22451;
  return D.22450;
}


mono_declsec_cache_stack_modifiers (struct MonoJitInfo * jinfo)
{
  unsigned int D.22455;
  _Bool D.22456;
  <unnamed-signed:1> D.22457;
  unsigned int D.22458;
  _Bool D.22459;
  <unnamed-signed:1> D.22460;
  unsigned int D.22461;
  _Bool D.22462;
  <unnamed-signed:1> D.22463;
  struct MonoClass * D.22464;
  struct MonoMethodCasInfo * info;
  struct MonoMethod * method;
  guint32 flags;

  info = mono_jit_info_get_cas_info (jinfo);
  if (info == 0B) goto <D.22453>; else goto <D.22454>;
  <D.22453>:
  return;
  <D.22454>:
  method = jinfo_get_method (jinfo);
  flags = mono_declsec_flags_from_method (method);
  D.22455 = flags & 4;
  D.22456 = D.22455 != 0;
  D.22457 = (<unnamed-signed:1>) D.22456;
  info->cas_method_assert = D.22457;
  D.22458 = flags & 8;
  D.22459 = D.22458 != 0;
  D.22460 = (<unnamed-signed:1>) D.22459;
  info->cas_method_deny = D.22460;
  D.22461 = flags & 16;
  D.22462 = D.22461 != 0;
  D.22463 = (<unnamed-signed:1>) D.22462;
  info->cas_method_permitonly = D.22463;
  D.22464 = method->klass;
  flags = mono_declsec_flags_from_class (D.22464);
  D.22455 = flags & 4;
  D.22456 = D.22455 != 0;
  D.22457 = (<unnamed-signed:1>) D.22456;
  info->cas_class_assert = D.22457;
  D.22458 = flags & 8;
  D.22459 = D.22458 != 0;
  D.22460 = (<unnamed-signed:1>) D.22459;
  info->cas_class_deny = D.22460;
  D.22461 = flags & 16;
  D.22462 = D.22461 != 0;
  D.22463 = (<unnamed-signed:1>) D.22462;
  info->cas_class_permitonly = D.22463;
}


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

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


mono_declsec_create_frame (struct MonoDomain * domain, struct MonoJitInfo * jinfo)
{
  struct MonoClass * D.22468;
  unsigned int D.22471;
  unsigned int D.22472;
  unsigned char D.22475;
  struct MonoReflectionMethod * * D.22478;
  struct MonoReflectionMethod * D.22479;
  struct MonoAppDomain * * D.22480;
  struct MonoAppDomain * D.22481;
  unsigned int D.22485;
  struct MonoDeclSecurityEntry * D.22487;
  unsigned int D.22490;
  struct MonoClass * D.22493;
  unsigned int D.22497;
  struct MonoDeclSecurityEntry * D.22499;
  unsigned int D.22502;
  unsigned int D.22508;
  struct MonoDeclSecurityEntry * D.22510;
  unsigned int D.22513;
  struct MonoSecurityFrame * D.22516;
  struct MonoSecurityFrame * frame;
  struct MonoMethodCasInfo * info;
  struct MonoMethod * method;

  D.22468 = mono_defaults.runtimesecurityframe_class;
  frame = mono_object_new (domain, D.22468);
  method = jinfo_get_method (jinfo);
  info = mono_jit_info_get_cas_info (jinfo);
  if (info != 0B) goto <D.22469>; else goto <D.22470>;
  <D.22469>:
  D.22471 = BIT_FIELD_REF <*info, 32, 0>;
  D.22472 = D.22471 & 1;
  if (D.22472 == 0) goto <D.22473>; else goto <D.22474>;
  <D.22473>:
  D.22475 = mono_method_has_declsec (method);
  if (D.22475 != 0) goto <D.22476>; else goto <D.22477>;
  <D.22476>:
  mono_declsec_cache_stack_modifiers (jinfo);
  <D.22477>:
  info->cas_inited = -1;
  <D.22474>:
  <D.22470>:
  D.22478 = &frame->method;
  D.22479 = mono_method_get_object (domain, method, 0B);
  mono_gc_wbarrier_set_field (frame, D.22478, D.22479);
  D.22480 = &frame->domain;
  D.22481 = domain->domain;
  mono_gc_wbarrier_set_field (frame, D.22480, D.22481);
  if (info != 0B) goto <D.22484>; else goto <D.22482>;
  <D.22484>:
  D.22471 = BIT_FIELD_REF <*info, 32, 0>;
  D.22485 = D.22471 & 16;
  if (D.22485 != 0) goto <D.22486>; else goto <D.22482>;
  <D.22486>:
  D.22487 = &frame->assert;
  mono_declsec_get_method_action (method, 3, D.22487);
  goto <D.22483>;
  <D.22482>:
  if (info != 0B) goto <D.22488>; else goto <D.22489>;
  <D.22488>:
  D.22471 = BIT_FIELD_REF <*info, 32, 0>;
  D.22490 = D.22471 & 2;
  if (D.22490 != 0) goto <D.22491>; else goto <D.22492>;
  <D.22491>:
  D.22493 = method->klass;
  D.22487 = &frame->assert;
  mono_declsec_get_class_action (D.22493, 3, D.22487);
  <D.22492>:
  <D.22489>:
  <D.22483>:
  if (info != 0B) goto <D.22496>; else goto <D.22494>;
  <D.22496>:
  D.22471 = BIT_FIELD_REF <*info, 32, 0>;
  D.22497 = D.22471 & 32;
  if (D.22497 != 0) goto <D.22498>; else goto <D.22494>;
  <D.22498>:
  D.22499 = &frame->deny;
  mono_declsec_get_method_action (method, 4, D.22499);
  goto <D.22495>;
  <D.22494>:
  if (info != 0B) goto <D.22500>; else goto <D.22501>;
  <D.22500>:
  D.22471 = BIT_FIELD_REF <*info, 32, 0>;
  D.22502 = D.22471 & 4;
  if (D.22502 != 0) goto <D.22503>; else goto <D.22504>;
  <D.22503>:
  D.22493 = method->klass;
  D.22499 = &frame->deny;
  mono_declsec_get_class_action (D.22493, 4, D.22499);
  <D.22504>:
  <D.22501>:
  <D.22495>:
  if (info != 0B) goto <D.22507>; else goto <D.22505>;
  <D.22507>:
  D.22471 = BIT_FIELD_REF <*info, 32, 0>;
  D.22508 = D.22471 & 64;
  if (D.22508 != 0) goto <D.22509>; else goto <D.22505>;
  <D.22509>:
  D.22510 = &frame->permitonly;
  mono_declsec_get_method_action (method, 5, D.22510);
  goto <D.22506>;
  <D.22505>:
  if (info != 0B) goto <D.22511>; else goto <D.22512>;
  <D.22511>:
  D.22471 = BIT_FIELD_REF <*info, 32, 0>;
  D.22513 = D.22471 & 8;
  if (D.22513 != 0) goto <D.22514>; else goto <D.22515>;
  <D.22514>:
  D.22493 = method->klass;
  D.22510 = &frame->permitonly;
  mono_declsec_get_class_action (D.22493, 5, D.22510);
  <D.22515>:
  <D.22512>:
  <D.22506>:
  D.22516 = frame;
  return D.22516;
}


mono_declsec_linkdemand (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * callee)
{
  struct MonoClass * D.22518;
  struct MonoImage * D.22519;
  struct MonoImage * D.22520;
  struct MonoClass * D.22523;
  struct MonoImage * D.22524;
  guint32 D.22527;
  short unsigned int D.22528;
  int D.22529;
  int D.22530;
  int D.22533;
  short unsigned int D.22537;
  int D.22538;
  int D.22539;
  int D.22542;
  int D.22547;
  unsigned char D.22552;
  int D.22555;
  guint32 violation;

  violation = 0;
  D.22518 = caller->klass;
  D.22519 = D.22518->image;
  D.22520 = mono_defaults.corlib;
  if (D.22519 == D.22520) goto <D.22521>; else goto <D.22522>;
  <D.22521>:
  D.22523 = callee->klass;
  D.22524 = D.22523->image;
  D.22520 = mono_defaults.corlib;
  if (D.22524 == D.22520) goto <D.22525>; else goto <D.22526>;
  <D.22525>:
  D.22527 = violation;
  return D.22527;
  <D.22526>:
  <D.22522>:
  D.22528 = callee->iflags;
  D.22529 = (int) D.22528;
  D.22530 = D.22529 & 4096;
  if (D.22530 != 0) goto <D.22531>; else goto <D.22532>;
  <D.22531>:
  D.22533 = mono_declsec_linkdemand_icall (domain, caller, callee);
  if (D.22533 != 0) goto <D.22534>; else goto <D.22535>;
  <D.22534>:
  violation = 4;
  <D.22535>:
  goto <D.22536>;
  <D.22532>:
  D.22537 = callee->flags;
  D.22538 = (int) D.22537;
  D.22539 = D.22538 & 8192;
  if (D.22539 != 0) goto <D.22540>; else goto <D.22541>;
  <D.22540>:
  D.22542 = mono_declsec_linkdemand_pinvoke (domain, caller, callee);
  if (D.22542 != 0) goto <D.22543>; else goto <D.22544>;
  <D.22543>:
  violation = 8;
  <D.22544>:
  <D.22541>:
  <D.22536>:
  if (violation == 0) goto <D.22545>; else goto <D.22546>;
  <D.22545>:
  D.22547 = mono_declsec_linkdemand_aptc (domain, caller, callee);
  if (D.22547 != 0) goto <D.22548>; else goto <D.22549>;
  <D.22548>:
  violation = 2;
  <D.22549>:
  <D.22546>:
  if (violation == 0) goto <D.22550>; else goto <D.22551>;
  <D.22550>:
  D.22552 = mono_method_has_declsec (callee);
  if (D.22552 != 0) goto <D.22553>; else goto <D.22554>;
  <D.22553>:
  D.22555 = mono_declsec_linkdemand_standard (domain, caller, callee);
  if (D.22555 != 0) goto <D.22556>; else goto <D.22557>;
  <D.22556>:
  violation = 1;
  <D.22557>:
  <D.22554>:
  <D.22551>:
  D.22527 = violation;
  return D.22527;
}


mono_declsec_linkdemand_icall (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * icall)
{
  struct MonoClass * D.22559;
  struct MonoImage * D.22560;
  <unnamed-unsigned:2> D.22561;
  int D.22562;
  int D.22563;
  <unnamed-unsigned:2> iftmp.1;
  unsigned int size.2;
  int size.3;
  int D.22569;
  int D.22573;
  gboolean D.22576;
  struct MonoClass * D.22577;
  struct MonoImage * D.22578;
  int D.22579;
  _Bool D.22580;
  struct MonoAssembly * assembly;

  InterlockedIncrement (&mono_jit_stats.cas_linkdemand_icall);
  D.22559 = icall->klass;
  D.22560 = D.22559->image;
  assembly = mono_image_get_assembly (D.22560);
  D.22561 = assembly->ecma;
  D.22562 = (int) D.22561;
  D.22563 = D.22562 & 2;
  if (D.22563 == 0) goto <D.22564>; else goto <D.22565>;
  <D.22564>:
  {
    guint32 size;
    const char * pk;

    try
      {
        size = 0;
        D.22559 = icall->klass;
        D.22560 = D.22559->image;
        pk = mono_image_get_public_key (D.22560, &size);
        size.2 = size;
        size.3 = (int) size.2;
        D.22569 = mono_is_ecma_key (pk, size.3);
        if (D.22569 != 0) goto <D.22570>; else goto <D.22571>;
        <D.22570>:
        iftmp.1 = 3;
        goto <D.22572>;
        <D.22571>:
        iftmp.1 = 2;
        <D.22572>:
        assembly->ecma = iftmp.1;
      }
    finally
      {
        size = {CLOBBER};
      }
  }
  <D.22565>:
  D.22561 = assembly->ecma;
  D.22562 = (int) D.22561;
  D.22573 = D.22562 & 1;
  if (D.22573 != 0) goto <D.22574>; else goto <D.22575>;
  <D.22574>:
  D.22576 = 0;
  return D.22576;
  <D.22575>:
  D.22577 = caller->klass;
  D.22578 = D.22577->image;
  assembly = mono_image_get_assembly (D.22578);
  D.22579 = mono_declsec_is_assembly_fulltrust (domain, assembly);
  D.22580 = D.22579 == 0;
  D.22576 = (gboolean) D.22580;
  return D.22576;
}


mono_declsec_is_assembly_fulltrust (struct MonoDomain * domain, struct MonoAssembly * assembly)
{
  <unnamed-unsigned:2> D.22582;
  int D.22583;
  int D.22584;
  struct MonoMethod * D.22591;
  void * D.22592;
  unsigned char D.22593;
  gboolean D.22596;
  int D.22597;

  D.22582 = assembly->fulltrust;
  D.22583 = (int) D.22582;
  D.22584 = D.22583 & 2;
  if (D.22584 == 0) goto <D.22585>; else goto <D.22586>;
  <D.22585>:
  {
    struct MonoReflectionAssembly * refass;
    struct MonoSecurityManager * secman;

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

      try
        {
          args[0] = refass;
          D.22591 = secman->linkdemandfulltrust;
          res = mono_runtime_invoke (D.22591, 0B, &args, 0B);
          D.22592 = mono_object_unbox (res);
          D.22593 = MEM[(MonoBoolean *)D.22592];
          if (D.22593 != 0) goto <D.22594>; else goto <D.22595>;
          <D.22594>:
          assembly->fulltrust = 3;
          D.22596 = 1;
          return D.22596;
          <D.22595>:
        }
      finally
        {
          args = {CLOBBER};
        }
    }
    <D.22590>:
    <D.22588>:
    assembly->fulltrust = 2;
    D.22596 = 0;
    return D.22596;
  }
  <D.22586>:
  D.22582 = assembly->fulltrust;
  D.22597 = (int) D.22582;
  D.22596 = D.22597 & 1;
  return D.22596;
}


mono_declsec_linkdemand_pinvoke (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * native)
{
  struct MonoClass * D.22601;
  struct MonoImage * D.22602;
  <unnamed-unsigned:2> D.22603;
  int D.22604;
  int D.22605;
  <unnamed-unsigned:2> D.22608;
  unsigned int D.22609;
  unsigned int D.22610;
  gboolean D.22613;
  struct MonoMethod * D.22618;
  void * D.22619;
  unsigned char D.22620;
  int D.22623;
  struct MonoAssembly * assembly;

  D.22601 = caller->klass;
  D.22602 = D.22601->image;
  assembly = mono_image_get_assembly (D.22602);
  InterlockedIncrement (&mono_jit_stats.cas_linkdemand_pinvoke);
  D.22603 = assembly->unmanaged;
  D.22604 = (int) D.22603;
  D.22605 = D.22604 & 2;
  if (D.22605 == 0) goto <D.22606>; else goto <D.22607>;
  <D.22606>:
  D.22608 = assembly->fulltrust;
  D.22609 = (unsigned int) D.22608;
  D.22610 = D.22609 & 3;
  if (D.22610 == 3) goto <D.22611>; else goto <D.22612>;
  <D.22611>:
  assembly->unmanaged = 3;
  D.22613 = 0;
  return D.22613;
  <D.22612>:
  {
    struct MonoReflectionAssembly * refass;
    struct MonoSecurityManager * secman;

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

      try
        {
          args[0] = refass;
          D.22618 = secman->linkdemandunmanaged;
          res = mono_runtime_invoke (D.22618, 0B, &args, 0B);
          D.22619 = mono_object_unbox (res);
          D.22620 = MEM[(MonoBoolean *)D.22619];
          if (D.22620 != 0) goto <D.22621>; else goto <D.22622>;
          <D.22621>:
          assembly->unmanaged = 3;
          D.22613 = 0;
          return D.22613;
          <D.22622>:
        }
      finally
        {
          args = {CLOBBER};
        }
    }
    <D.22617>:
    <D.22615>:
  }
  assembly->unmanaged = 2;
  <D.22607>:
  D.22603 = assembly->unmanaged;
  D.22604 = (int) D.22603;
  D.22623 = D.22604 & 1;
  if (D.22623 != 0) goto <D.22624>; else goto <D.22625>;
  <D.22624>:
  D.22613 = 0;
  return D.22613;
  <D.22625>:
  D.22613 = 1;
  return D.22613;
}


mono_declsec_linkdemand_aptc (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * callee)
{
  struct MonoClass * D.22629;
  struct MonoImage * D.22630;
  struct MonoClass * D.22631;
  struct MonoImage * D.22632;
  gboolean D.22635;
  unsigned int D.22638;
  unsigned int D.22639;
  short unsigned int D.22641;
  int D.22642;
  int D.22643;
  const char * D.22646;
  unsigned int size.4;
  <unnamed-unsigned:2> D.22649;
  int D.22650;
  int D.22651;
  struct MonoClass * D.22658;
  <unnamed-unsigned:2> iftmp.5;
  int D.22665;
  int D.22668;
  struct MonoSecurityManager * secman;
  struct MonoAssembly * assembly;
  guint32 size;

  try
    {
      secman = 0B;
      size = 0;
      InterlockedIncrement (&mono_jit_stats.cas_linkdemand_aptc);
      D.22629 = caller->klass;
      D.22630 = D.22629->image;
      D.22631 = callee->klass;
      D.22632 = D.22631->image;
      if (D.22630 == D.22632) goto <D.22633>; else goto <D.22634>;
      <D.22633>:
      D.22635 = 0;
      return D.22635;
      <D.22634>:
      D.22631 = callee->klass;
      D.22638 = D.22631->flags;
      D.22639 = D.22638 & 1;
      if (D.22639 == 0) goto <D.22636>; else goto <D.22640>;
      <D.22640>:
      D.22641 = callee->flags;
      D.22642 = (int) D.22641;
      D.22643 = D.22642 & 6;
      if (D.22643 == 0) goto <D.22636>; else goto <D.22637>;
      <D.22636>:
      D.22635 = 0;
      return D.22635;
      <D.22637>:
      D.22631 = callee->klass;
      D.22632 = D.22631->image;
      D.22646 = mono_image_get_public_key (D.22632, &size);
      if (D.22646 == 0B) goto <D.22644>; else goto <D.22647>;
      <D.22647>:
      size.4 = size;
      if (size.4 <= 15) goto <D.22644>; else goto <D.22645>;
      <D.22644>:
      D.22635 = 0;
      return D.22635;
      <D.22645>:
      D.22631 = callee->klass;
      D.22632 = D.22631->image;
      assembly = mono_image_get_assembly (D.22632);
      D.22649 = assembly->aptc;
      D.22650 = (int) D.22649;
      D.22651 = D.22650 & 2;
      if (D.22651 == 0) goto <D.22652>; else goto <D.22653>;
      <D.22652>:
      {
        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.22654>; else goto <D.22655>;
        <D.22654>:
        if (cinfo != 0B) goto <D.22656>; else goto <D.22657>;
        <D.22656>:
        D.22658 = secman->allowpartiallytrustedcallers;
        result = mono_custom_attrs_has_attr (cinfo, D.22658);
        <D.22657>:
        <D.22655>:
        if (cinfo != 0B) goto <D.22659>; else goto <D.22660>;
        <D.22659>:
        mono_custom_attrs_free (cinfo);
        <D.22660>:
        if (result != 0) goto <D.22662>; else goto <D.22663>;
        <D.22662>:
        iftmp.5 = 3;
        goto <D.22664>;
        <D.22663>:
        iftmp.5 = 2;
        <D.22664>:
        assembly->aptc = iftmp.5;
      }
      <D.22653>:
      D.22649 = assembly->aptc;
      D.22650 = (int) D.22649;
      D.22665 = D.22650 & 1;
      if (D.22665 != 0) goto <D.22666>; else goto <D.22667>;
      <D.22666>:
      D.22635 = 0;
      return D.22635;
      <D.22667>:
      D.22629 = caller->klass;
      D.22630 = D.22629->image;
      assembly = mono_image_get_assembly (D.22630);
      D.22668 = mono_declsec_is_assembly_fulltrust (domain, assembly);
      if (D.22668 != 0) goto <D.22669>; else goto <D.22670>;
      <D.22669>:
      D.22635 = 0;
      return D.22635;
      <D.22670>:
      D.22635 = 1;
      return D.22635;
    }
  finally
    {
      size = {CLOBBER};
    }
}


mono_declsec_linkdemand_standard (struct MonoDomain * domain, struct MonoMethod * caller, struct MonoMethod * callee)
{
  unsigned char D.22673;
  struct MonoClass * D.22676;
  struct MonoImage * D.22677;
  struct MonoMethod * D.22678;
  gboolean D.22679;
  void * D.22680;
  unsigned char D.22681;
  _Bool D.22682;
  struct MonoDeclSecurityActions linkclass;
  struct MonoDeclSecurityActions linkmethod;

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

        try
          {
            D.22676 = caller->klass;
            D.22677 = D.22676->image;
            assembly = mono_image_get_assembly (D.22677);
            refass = mono_assembly_get_object (domain, assembly);
            secman = mono_security_manager_get_methods ();
            args[0] = refass;
            args[1] = &linkclass;
            args[2] = &linkmethod;
            D.22678 = secman->linkdemand;
            res = mono_runtime_invoke (D.22678, 0B, &args, 0B);
            D.22680 = mono_object_unbox (res);
            D.22681 = MEM[(MonoBoolean *)D.22680];
            D.22682 = D.22681 == 0;
            D.22679 = (gboolean) D.22682;
            return D.22679;
          }
        finally
          {
            args = {CLOBBER};
          }
      }
      <D.22675>:
      D.22679 = 0;
      return D.22679;
    }
  finally
    {
      linkclass = {CLOBBER};
      linkmethod = {CLOBBER};
    }
}


