ResFwFreeContext

VOID __fastcall ResFwFreeContext(VOID *Context){
  INT16 v1; 
  INT64 v2; 
  INT64 v3; 
  INT64 *v5; 
  INT64 *v6; 
  MDL *v7; 
  if( (dword_140C13310 & 0x100000) != 0 )
  {
    v5 = TxtpTextCache;
    v6 = (INT64 *)*TxtpTextCache;
    if( (INT64 **)TxtpTextCache[1] != &TxtpTextCache )
LABEL_15:
      __fastfail(3u);
    while( 1 )
    {
      if( (INT64 *)v6[1] != v5 )
        goto LABEL_15;
      TxtpTextCache = v6;
      v6[1] = (INT64)&TxtpTextCache;
      if( v5 == (INT64 *)&TxtpTextCache )
        break;
      BgpGxRectangleDestroy(v5[6]);
      BgpFwFreeMemory(v5);
      v5 = TxtpTextCache;
      if( (INT64 **)TxtpTextCache[1] != &TxtpTextCache )
        goto LABEL_15;
      v6 = (INT64 *)*TxtpTextCache;
    }
    dword_140C02C68 = 0;
    if( RasterizerInitialized )
      RaspClearCache((INT64 *)Context, v1, v2, v3);
    AnFwDisableBackgroundUpdateTimer();
    AnFwFadeCompletion();
    LogFwReport();
    if( *((_QWORD *)Context + 2) )
    {
      BgpFwReservePoolSwap(1, 0i64, 0, 0i64);
      MmFreePagesFromMdl(*((MDL **)Context + 1));
      ExFreePoolWithTag(*((PVOID *)Context + 1), 0);
    }
    dword_140C13310 &= 0xFFEFF7FD;
    qword_140C133D0 = BgpAnimationRegionSave;
    RegionHandle = BgpTextRegionSave;
    qword_140C132C0 = 0i64;
    *(_OWORD *)BgInternal = 0i64;
    xmmword_140C132B0 = 0i64;
    ResFwBackgroundTransition(1);
  }
  else
  {
    v7 = (MDL *)*((_QWORD *)Context + 1);
    if( v7 )
    {
      MmFreePagesFromMdl(v7);
      ExFreePoolWithTag(*((PVOID *)Context + 1), 0);
    }
  }
}

Referenced by:

BgFreeContext