Newer
Older
AMI-Aptio-BIOS-Reversed / MdeModulePkg / Core / DxeIplPeim / DxeIplDecompressLzma.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Full restructure
/* DxeIplDecompressLzma @ 0xffc16567 size=0xbb */
int __fastcall DxeIplDecompressLzma(int a1, unsigned __int16 n8_1)
{
  unsigned __int16 n8; // di
  char n8_2; // cl
  __int64 v5; // rax
  int v6; // eax
  int v7; // eax
  int v8; // ecx
  int result; // eax
  unsigned int v10; // [esp+Ch] [ebp-10h]

  n8 = n8_1; /*0xffc16574*/
  v10 = *(_DWORD *)(a1 + 20); /*0xffc16582*/
  n8_2 = n8_1; /*0xffc16585*/
  LODWORD(v5) = 0; /*0xffc16588*/
  HIDWORD(v5) = v10; /*0xffc1658a*/
  if ( (n8_2 & 0x20) == 0 ) /*0xffc16590*/
    v5 = v10; /*0xffc16592*/
  *(_DWORD *)(a1 + 20) = v5 << (n8_2 & 0x1F); /*0xffc1659f*/
  if ( n8 > *(_WORD *)(a1 + 16) ) /*0xffc165a6*/
  {
    do /*0xffc1660a*/
    {
      n8 -= *(_WORD *)(a1 + 16); /*0xffc165ab*/
      v6 = 0; /*0xffc165c2*/
      if ( (n8 & 0x20) == 0 ) /*0xffc165ca*/
        v6 = *(_DWORD *)(a1 + 24); /*0xffc165cc*/
      *(_DWORD *)(a1 + 20) |= v6 << n8; /*0xffc165d6*/
      v7 = *(_DWORD *)(a1 + 32); /*0xffc165d9*/
      if ( v7 ) /*0xffc165e1*/
      {
        v8 = *(_DWORD *)(a1 + 12); /*0xffc165e3*/
        *(_DWORD *)(a1 + 24) = 0; /*0xffc165e7*/
        *(_DWORD *)(a1 + 32) = v7 - 1; /*0xffc165eb*/
        *(_DWORD *)(a1 + 24) = *(unsigned __int8 *)(*(_DWORD *)a1 + v8); /*0xffc165f4*/
        *(_DWORD *)(a1 + 12) = v8 + 1; /*0xffc165fa*/
      }
      else
      {
        *(_DWORD *)(a1 + 24) = 0; /*0xffc165ff*/
      }
      *(_WORD *)(a1 + 16) = 8; /*0xffc16603*/
    }
    while ( n8 > 8u ); /*0xffc1660a*/
  }
  *(_WORD *)(a1 + 16) -= n8; /*0xffc1660c*/
  result = *(_DWORD *)(a1 + 24) >> *(_BYTE *)(a1 + 16); /*0xffc16616*/
  *(_DWORD *)(a1 + 20) |= result; /*0xffc16618*/
  return result; /*0xffc1661b*/
}