Newer
Older
AMI-Aptio-BIOS-Reversed / Platform / SetupOptionProcessor.c
@Ajax Dong Ajax Dong 2 days ago 3 KB Init
// SetupOptionProcessor - decompiled from Platform.efi
unsigned __int64 __fastcall SetupOptionProcessor(
        const CHAR16 *ZeroPool,
        unsigned __int64 n0xF4240,
        unsigned __int64 ZeroPool_1,
        UINTN n0xF4240_1)
{
  UINTN v8; // r12
  unsigned __int64 n0xF4240_2; // rbp
  const char *(Destination____((void__)_0)); // r8
  __int64 n530; // rdx
  UINTN n0xF4240_3; // rax
  unsigned __int64 n0xF4240_4; // rsi
  CHAR16 *v15; // rax

  if ( ((unsigned __int8)ZeroPool & 1) != 0 ) /*0x53a2*/
    Assert( /*0x53b3*/
      (__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c",
      518,
      (__int64)"((UINTN) Destination & 0x00000001) == 0");
  if ( (ZeroPool_1 & 1) != 0 ) /*0x53bb*/
    Assert( /*0x53cc*/
      (__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c",
      519,
      (__int64)"((UINTN) Source & 0x00000001) == 0");
  v8 = StrLen(ZeroPool); /*0x53df*/
  n0xF4240_2 = n0xF4240 - v8; /*0x53e2*/
  if ( !ZeroPool ) /*0x53e8*/
  {
    (Destination____((void__)_0)) = "(Destination != ((void *) 0))"; /*0x53ea*/
    n530 = 530; /*0x53f1*/
LABEL_7:
    Assert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", n530, (__int64)(Destination____((void__)_0))); /*0x53f6*/
    return 0x8000000000000002uLL; /*0x5408*/
  }
  if ( !ZeroPool_1 ) /*0x5410*/
  {
    (Destination____((void__)_0)) = "(Source != ((void *) 0))"; /*0x5412*/
    n530 = 531; /*0x5419*/
    goto LABEL_7; /*0x541e*/
  }
  if ( n0xF4240 > 0xF4240 ) /*0x5428*/
  {
    (Destination____((void__)_0)) = "(DestMax <= (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength))"; /*0x542a*/
    n530 = 537; /*0x5431*/
    goto LABEL_7; /*0x5436*/
  }
  if ( n0xF4240_1 > 0xF4240 ) /*0x543b*/
  {
    (Destination____((void__)_0)) = "(Length <= (_gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength))"; /*0x543d*/
    n530 = 538; /*0x5444*/
    goto LABEL_7; /*0x5449*/
  }
  if ( !n0xF4240 ) /*0x544e*/
  {
    (Destination____((void__)_0)) = "(DestMax != 0)"; /*0x5450*/
    n530 = 544; /*0x5457*/
    goto LABEL_7; /*0x545c*/
  }
  if ( !n0xF4240_2 ) /*0x5461*/
  {
    Assert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", 549, (__int64)"(CopyLen != 0)"); /*0x5472*/
    return 0x8000000000000004uLL; /*0x5481*/
  }
  n0xF4240_3 = StrLen((const CHAR16 *)ZeroPool_1); /*0x548c*/
  n0xF4240_4 = n0xF4240_3; /*0x5491*/
  if ( n0xF4240_1 >= n0xF4240_2 && n0xF4240_2 <= n0xF4240_3 ) /*0x549c*/
  {
    Assert((__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c", 556, (__int64)"(CopyLen > SourceLen)"); /*0x54ad*/
    return 0x8000000000000005uLL; /*0x54bc*/
  }
  if ( n0xF4240_3 > n0xF4240_1 ) /*0x54c4*/
    n0xF4240_4 = n0xF4240_1; /*0x54c4*/
  if ( ZeroPool_1 > (unsigned __int64)ZeroPool ) /*0x54cb*/
    goto LABEL_26; /*0x54cb*/
  if ( (unsigned __int64)ZeroPool >= ZeroPool_1 + 2 + 2 * n0xF4240_4 ) /*0x54d8*/
  {
    if ( (unsigned __int64)ZeroPool > ZeroPool_1 ) /*0x54dd*/
      goto LABEL_29; /*0x54dd*/
LABEL_26:
    if ( ZeroPool_1 >= (unsigned __int64)&ZeroPool[n0xF4240] ) /*0x54e6*/
      goto LABEL_28; /*0x54e6*/
  }
  Assert( /*0x54e8*/
    (__int64)"e:\\hs\\MdePkg\\Library\\BaseLib\\SafeString.c",
    565,
    (__int64)"InternalSafeStringNoStrOverlap (Destination, DestMax, (CHAR16 *)Source, SourceLen + 1)");
LABEL_28:
  if ( ZeroPool_1 > (unsigned __int64)ZeroPool ) /*0x54ff*/
  {
LABEL_31:
    if ( ZeroPool_1 < (unsigned __int64)&ZeroPool[n0xF4240] ) /*0x551a*/
      return 0x800000000000000FuLL; /*0x551a*/
    goto LABEL_33; /*0x551a*/
  }
LABEL_29:
  if ( (unsigned __int64)ZeroPool < ZeroPool_1 + 2 + 2 * n0xF4240_4 ) /*0x550c*/
    return 0x800000000000000FuLL; /*0x5526*/
  if ( ZeroPool_1 >= (unsigned __int64)ZeroPool ) /*0x5511*/
    goto LABEL_31; /*0x5511*/
LABEL_33:
  v15 = (CHAR16 *)&ZeroPool[v8]; /*0x5528*/
  while ( *(_WORD *)ZeroPool_1 && n0xF4240_4 ) /*0x5533*/
  {
    *v15 = *(_WORD *)ZeroPool_1; /*0x5535*/
    ZeroPool_1 += 2LL; /*0x5538*/
    ++v15; /*0x553c*/
    --n0xF4240_4; /*0x5540*/
  }
  *v15 = 0; /*0x554b*/
  return 0; /*0x555f*/
}