// LocateHandleBuffer - decompiled from Platform.efi
__int64 __fastcall LocateHandleBuffer(__int64 a1, __int64 *a2, const void *n512)
{
  __int64 RuntimeServices; // rax
  UINTN AllocationSize; // rcx
  __int64 v6; // rdi
  void *CopyPool; // rax
  const void *n512_1; // [rsp+50h] [rbp+18h] BYREF

  n512_1 = n512; /*0x7895*/
  if ( !a2 ) /*0x78a5*/
    Assert( /*0x78ba*/
      (__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c",
      1401,
      (__int64)"Name != ((void *) 0) && Guid != ((void *) 0) && Value != ((void *) 0)");
  RuntimeServices = RuntimeServices; /*0x78bf*/
  n512_1 = 0; /*0x78cb*/
  *a2 = 0; /*0x78d8*/
  v6 = (*(__int64 (__fastcall **)(const __int16 *, void *, _QWORD, const void **, _QWORD))(RuntimeServices + 72))( /*0x78ef*/
         L"PlatformLang",
         &unk_F970,
         0,
         &n512_1,
         0);
  if ( v6 == 0x8000000000000005uLL ) /*0x78ff*/
  {
    CopyPool = AllocateCopyPool(AllocationSize, n512_1); /*0x7906*/
    *a2 = (__int64)CopyPool; /*0x790b*/
    if ( !CopyPool ) /*0x7911*/
      Assert((__int64)"e:\\hs\\MdePkg\\Library\\UefiLib\\UefiLib.c", 1421, (__int64)"*Value != ((void *) 0)"); /*0x7926*/
    if ( *a2 ) /*0x792b*/
    {
      v6 = (*(__int64 (__fastcall **)(const __int16 *, void *, _QWORD, const void **, _QWORD))(RuntimeServices + 72))( /*0x7964*/
             L"PlatformLang",
             &unk_F970,
             0,
             &n512_1,
             *a2);
      if ( v6 < 0 ) /*0x796a*/
      {
        ExtractConfig(); /*0x796f*/
        *a2 = 0; /*0x7974*/
      }
    }
    else
    {
      return 0x8000000000000009uLL; /*0x7933*/
    }
  }
  return v6; /*0x7980*/
}
