Newer
Older
AMI-Aptio-BIOS-Reversed / PurleyPlatPkg / Platform / Pei / EarlyVideoPei / ImageRenderWritePalette.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Full restructure
char *__thiscall ImageRenderWritePalette(int *this)
{
  int v1; // eax
  int n9_1; // edi
  int v3; // edx
  int n9; // esi
  int n5; // edx
  char *result; // eax
  int v7; // eax

  v1 = *(this + 5);
  if ( v1 == -1 )
  {
LABEL_19:
    v7 = *this * *(this + 3);
    *(this + 5) = 0;
    return (char *)(*(this + 1) + *(this + 2) + v7);
  }
  else
  {
    n9_1 = *this;
    while ( 1 )
    {
      v3 = *(this + 2);
      n9 = *(this + 3);
      if ( v1 )
      {
        n9 += *(this + 4);
        n5 = v3 + 1;
        *(this + 5) = v1 - 1;
      }
      else
      {
        n5 = v3 - 1;
        *(this + 5) = 1;
      }
      if ( *(this + 4) >= 0 )
      {
        if ( n9 == n9_1 )
        {
          *(this + 4) = -1;
          n9 = n9_1 - 1;
          n5 -= 2;
          if ( !*(this + 6) && n5 == 6 )
          {
            n5 = 5;
            n9 = n9_1 - 9;
          }
        }
      }
      else if ( n9 < 0 )
      {
        n5 -= 2;
        *(this + 4) = 1;
        n9 = 0;
        if ( !*(this + 6) && n5 == 6 )
        {
          n5 = 5;
          n9 = 9;
        }
      }
      if ( n5 < 0 || n9 < 0 )
        return 0;
      *(this + 2) = n5;
      *(this + 3) = n9;
      result = (char *)(n5 + *(this + 1) + n9 * n9_1);
      if ( *result >= 0 )
        return result;
      v1 = *(this + 5);
      if ( v1 == -1 )
        goto LABEL_19;
    }
  }
}