Newer
Older
AMI-Aptio-BIOS-Reversed / MdeModulePkg / Core / DxeIplPeim / DxeIplLzmaRangeDecode.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Full restructure
/* DxeIplLzmaRangeDecode @ 0xffc16bca size=0xb7 */
unsigned __int16 __thiscall DxeIplLzmaRangeDecode(int this)
{
  __int16 v2; // ax
  __int16 v4; // ax
  unsigned int v5; // eax
  unsigned __int16 n0x1FE; // di
  unsigned int n0x80000; // ecx

  if ( !*(_WORD *)(this + 28) ) /*0xffc16bd4*/
  {
    *(_WORD *)(this + 28) = DxeIplGetDecompressAlgo(this, 0x10u); /*0xffc16bec*/
    v2 = DxeIplLzmaDecodeCore1((_DWORD *)this, 0x13u, 5u, 3); /*0xffc16bf0*/
    *(_WORD *)(this + 40) = v2; /*0xffc16bf5*/
    if ( v2 ) /*0xffc16bfe*/
      return 0; /*0xffc16bfe*/
    DxeIplLzmaDecodeCore2((_DWORD *)this); /*0xffc16c06*/
    v4 = DxeIplLzmaDecodeCore1((_DWORD *)this, 0x1Fu, *(unsigned __int8 *)(this + 13364), 0xFFFF); /*0xffc16c19*/
    *(_WORD *)(this + 40) = v4; /*0xffc16c1e*/
    if ( v4 ) /*0xffc16c27*/
      return 0; /*0xffc16c00*/
  }
  v5 = *(_DWORD *)(this + 20); /*0xffc16c29*/
  --*(_WORD *)(this + 28); /*0xffc16c31*/
  n0x1FE = *(_WORD *)(this + 2 * (v5 >> 20) + 4660); /*0xffc16c38*/
  if ( n0x1FE >= 0x1FEu ) /*0xffc16c43*/
  {
    n0x80000 = 0x80000; /*0xffc16c45*/
    do /*0xffc16c66*/
    {
      if ( (n0x80000 & *(_DWORD *)(this + 20)) != 0 ) /*0xffc16c50*/
        n0x1FE = *(_WORD *)(this + 2 * n0x1FE + 2080); /*0xffc16c52*/
      else
        n0x1FE = *(_WORD *)(this + 2 * n0x1FE + 42); /*0xffc16c5c*/
      n0x80000 >>= 1; /*0xffc16c61*/
    }
    while ( n0x1FE >= 0x1FEu ); /*0xffc16c66*/
  }
  DxeIplDecompressLzma(this, *(unsigned __int8 *)(n0x1FE + this + 4118)); /*0xffc16c75*/
  return n0x1FE; /*0xffc16c7d*/
}