Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / BitUnpack.c
@Ajax Dong Ajax Dong 2 days ago 825 bytes Full restructure
int __thiscall BitUnpack(int *this)
{
  int v2; // esi
  int result; // eax
  int v4; // edi
  char v5; // cl
  _BYTE *v6; // edx
  int i_1; // ebx
  int i; // ebp
  char v9; // al
  int v10; // esi
  int n8; // [esp+8h] [ebp-4h]

  v2 = *this;
  if ( !*this )
    return 0;
  result = PeiAllocatePool((void *)((v2 + 7) / 8));
  v4 = result;
  if ( result )
  {
    v5 = 0;
    v6 = (_BYTE *)*(this + 1);
    i_1 = 0;
    for ( i = v2 / 8; i_1 < i; ++i_1 )
    {
      v9 = 0;
      n8 = 8;
      do
      {
        v9 = *v6++ | (2 * v9);
        --n8;
      }
      while ( n8 );
      *(_BYTE *)(i_1 + v4) = v9;
    }
    v10 = v2 & 7;
    if ( v10 )
    {
      do
      {
        v5 = *v6++ | (2 * v5);
        --v10;
      }
      while ( v10 );
      *(_BYTE *)(v4 + i) = v5;
    }
    return v4;
  }
  return result;
}