Newer
Older
AMI-Aptio-BIOS-Reversed / 117828F1-DA7D-4BC1-8B58-9A954FED5121 / JournalDisk.c
@Ajax Dong Ajax Dong 2 days ago 43 KB Init
#include "117828F1-DA7D-4BC1-8B58-9A954FED5121.h"

// JournalDisk.c - Extracted from 117828F1-DA7D-4BC1-8B58-9A954FED5121.c
// Total functions: 66

// Function: Assert_92 @ 0x11fd0 (0x95 bytes)
// Index: 485/906

char __fastcall Assert_92(_BYTE *Destination, CHAR16 **p_Destination)
{
  char v4; // bl
  CHAR16 **v5; // rax
  __int64 v6; // rdi
  __int16 v8; // [rsp+40h] [rbp+18h] BYREF

  v4 = 0; /*0x11ff2*/
  if ( Assert_111((__int64)p_Destination) ) /*0x11fed*/
  {
    v8 = 0; /*0x11ff8*/
    do /*0x12010*/
    {
      v6 = Assert_56(Source_16, &v8); /*0x1202a*/
      if ( !v6 ) /*0x12030*/
      {
        v4 = 1; /*0x12032*/
        goto LABEL_6; /*0x12032*/
      }
      v5 = JournalGetNextPtr(p_Destination); /*0x12002*/
    }
    while ( !sub_11C84((__int64)Destination, v6, (__int64)v5) ); /*0x12010*/
    *(_QWORD *)(*(_QWORD *)(v6 + 136) + 72LL) = p_Destination; /*0x1205d*/
    return 1; /*0x12061*/
  }
  else
  {
LABEL_6:
    sub_11F94(Destination, p_Destination); /*0x12034*/
    return v4; /*0x1203f*/
  }
}


// Function: Assert_39 @ 0x12068 (0xfb bytes)
// Index: 486/906

bool __fastcall Assert_39(CHAR16 *Source)
{
  char v2; // al
  CHAR16 *i_1; // rbx
  unsigned int v4; // eax
  int v5; // eax
  int v6; // eax
  __int64 v7; // rax
  _BYTE *i; // [rsp+30h] [rbp-18h] BYREF
  char v10; // [rsp+38h] [rbp-10h]
  __int16 n16; // [rsp+3Ah] [rbp-Eh]

  i = 0; /*0x12082*/
  v10 = 0; /*0x12086*/
  n16 = 16; /*0x1208f*/
  JournalStringRealloc((__int64)&i, 0); /*0x12094*/
  v2 = RstDebugEnabled(); /*0x12099*/
  i_1 = (CHAR16 *)i; /*0x1209e*/
  if ( v2 && !i ) /*0x120ab*/
  {
    DebugAssert("JournalDisk.cpp", 0x11Du, "framebuf.ptr()"); /*0x120c0*/
    i_1 = (CHAR16 *)i; /*0x120c5*/
  }
  MemZero(i_1, 0, 4096); /*0x120d5*/
  *(_DWORD *)Source = 0; /*0x120e6*/
  StrnCpy(i_1, Source, 0x18u); /*0x120e8*/
  v4 = sub_1922C(); /*0x120ed*/
  v5 = sub_19230(v4, (unsigned int *)i_1, 4096); /*0x120fd*/
  v6 = sub_19264(v5); /*0x12104*/
  *(_DWORD *)Source = v6; /*0x1210c*/
  *(_DWORD *)i_1 = v6; /*0x1210e*/
  v7 = RstHelper_1dfc(Source); /*0x12110*/
  Assert_89(Source_16, *((_QWORD *)Source + 11), 42, v7, 4096, (unsigned int)i_1); /*0x12132*/
  sub_17400((__int64)i); /*0x1213c*/
  return *(_WORD *)(Source_16 + 2720) == 0; /*0x1215d*/
}


// Function: Assert_33 @ 0x12164 (0x109 bytes)
// Index: 487/906

bool __fastcall Assert_33(CHAR16 *Destination)
{
  unsigned int *Source_1; // rbp
  __int64 v3; // rax
  unsigned int v5; // edi
  unsigned int v6; // eax
  int v7; // eax
  int v8; // ebx
  CHAR16 *Source; // [rsp+30h] [rbp-18h] BYREF
  char v10; // [rsp+38h] [rbp-10h]
  __int16 n16; // [rsp+3Ah] [rbp-Eh]

  Source = 0; /*0x12182*/
  v10 = 0; /*0x12186*/
  n16 = 16; /*0x1218e*/
  JournalStringRealloc((__int64)&Source, 0); /*0x12193*/
  if ( RstDebugEnabled() && !Source ) /*0x121a6*/
    DebugAssert("JournalDisk.cpp", 0x13Au, "framebuf.ptr()"); /*0x121bb*/
  Source_1 = (unsigned int *)Source; /*0x121c0*/
  v3 = RstHelper_1dfc(Destination); /*0x121c8*/
  Assert_89(Source_16, *((_QWORD *)Destination + 11), 40, v3, 4096, (unsigned int)Source); /*0x121ee*/
  if ( *(_WORD *)(Source_16 + 2720) ) /*0x121fa*/
  {
    sub_17400((__int64)Source); /*0x12209*/
    return 0; /*0x1220e*/
  }
  else
  {
    v5 = *Source_1; /*0x12212*/
    *Source_1 = 0; /*0x12215*/
    v6 = sub_1922C(); /*0x12218*/
    v7 = sub_19230(v6, Source_1, 4096); /*0x12228*/
    v8 = sub_19264(v7); /*0x12240*/
    StrnCpy(Destination, (const CHAR16 *)Source_1, 0x18u); /*0x12242*/
    sub_17400((__int64)Source); /*0x1224c*/
    *(_DWORD *)Destination = v8; /*0x12253*/
    return v5 == v8; /*0x12255*/
  }
}


// Function: Assert_103 @ 0x12270 (0x53 bytes)
// Index: 488/906

bool __fastcall Assert_103(__int64 Destination, __int64 a2, char a3)
{
  CHAR16 *Destination_1; // rcx
  bool result; // al

  *(_QWORD *)(Destination + 88) = a2; /*0x12280*/
  RstHelper_1d08(Destination); /*0x12284*/
  Destination_1 = (CHAR16 *)Destination; /*0x12289*/
  if ( !a3 ) /*0x1228e*/
  {
    if ( Assert_33((CHAR16 *)Destination) ) /*0x122a0*/
      return 1; /*0x122a7*/
    RstHelper_1d08(Destination); /*0x122ac*/
    Destination_1 = (CHAR16 *)Destination; /*0x122b1*/
  }
  result = Assert_39(Destination_1); /*0x12290*/
  if ( !result ) /*0x12297*/
  {
    *(_QWORD *)(Destination + 88) = 0; /*0x12299*/
    return result; /*0x1229e*/
  }
  return 1; /*0x122bd*/
}


// Function: Assert_55 @ 0x122c4 (0xa3 bytes)
// Index: 489/906

void __fastcall Assert_55(_BYTE *Source, __int64 a2)
{
  CHAR16 *v2; // rbx
  __int64 v5; // rdx
  __int64 v6; // rcx
  __int64 v7; // rdx

  v2 = *(CHAR16 **)(a2 + 72); /*0x122d3*/
  if ( (unsigned __int8)RstDebugEnabled(Source, a2) ) /*0x122dd*/
  {
    if ( v2 ) /*0x122e9*/
    {
LABEL_7:
      *(_BYTE *)(JournalGetNextPtr(v2) + 4) = 0; /*0x1232b*/
      Assert_40(v2); /*0x1233a*/
      v7 = *(_QWORD *)(a2 + 72); /*0x1233f*/
      *(_DWORD *)(a2 + 80) = 5; /*0x12346*/
      sub_11F94((__int64)Source, v7); /*0x1234d*/
      *(_QWORD *)(a2 + 72) = 0; /*0x12352*/
      return; /*0x12352*/
    }
    DebugAssert("JournalDisk.cpp", 0xB2u, "jdPplMpbMgr != 0"); /*0x122fe*/
  }
  if ( v2 ) /*0x12306*/
    goto LABEL_7; /*0x12306*/
  if ( (unsigned __int8)RstDebugEnabled(v6, v5) ) /*0x12308*/
    DebugAssert("JournalDisk.cpp", 0xB4u, "((BOOLEAN)(0==1))"); /*0x12324*/
}


// Function: Assert_50 @ 0x12368 (0xad bytes)
// Index: 490/906

__int64 __fastcall Assert_50(__int64 Destination)
{
  unsigned int v1; // esi
  _BYTE *i; // rdi
  __int64 result; // rax
  CHAR16 *p_Destination; // rbx

  v1 = 0; /*0x12381*/
  for ( i = (_BYTE *)(Destination + 24); ; i += 64 ) /*0x12386*/
  {
    result = *(unsigned int *)(Destination + 4); /*0x1238e*/
    if ( (unsigned int)result > 1 ) /*0x12394*/
      result = 1; /*0x12394*/
    if ( v1 >= (unsigned int)result ) /*0x1239a*/
      break; /*0x1239a*/
    if ( *i ) /*0x1239c*/
    {
      if ( RstDebugEnabled() ) /*0x123d0*/
        DebugAssert("JournalDisk.cpp", 0xD2u, "((BOOLEAN)(0==1))"); /*0x123ec*/
    }
    else
    {
      p_Destination = (CHAR16 *)(((unsigned __int64)v1 << 6) + Destination + 32); /*0x123ac*/
      JournalSetCallback((__int64)p_Destination, v1, Destination); /*0x123b4*/
      Assert_43(p_Destination); /*0x123bc*/
      *i = Assert_92((_BYTE *)Destination, (CHAR16 **)p_Destination); /*0x123cc*/
    }
    ++v1; /*0x123f1*/
  }
  return result; /*0x1240e*/
}


// Function: Assert_48 @ 0x12418 (0xb5 bytes)
// Index: 491/906

char __fastcall Assert_48(__int64 Source)
{
  char v2; // di
  __int64 v3; // rdx
  __int64 v4; // rcx
  unsigned int v5; // r12d
  _BYTE *v6; // rbp
  unsigned int v7; // eax
  char v8; // al

  v2 = 0; /*0x12433*/
  if ( Assert_39((CHAR16 *)Source) ) /*0x12436*/
  {
    v5 = 0; /*0x12445*/
    v6 = (_BYTE *)(Source + 24); /*0x12448*/
    v2 = 1; /*0x1244c*/
    do /*0x124af*/
    {
      v7 = *(_DWORD *)(Source + 4); /*0x1244f*/
      if ( v7 > 1 ) /*0x12455*/
        v7 = 1; /*0x12455*/
      if ( v5 >= v7 ) /*0x1245c*/
        break; /*0x1245c*/
      if ( (unsigned __int8)RstDebugEnabled(v4, v3) && *v6 ) /*0x12467*/
        DebugAssert("JournalDisk.cpp", 0x10Du, "!m_jmm[ n ].m_bUsed"); /*0x12480*/
      *(_BYTE *)(JournalGetNextPtr(((unsigned __int64)v5 << 6) + Source + 32) + 4) = 0; /*0x1249c*/
      v8 = Assert_40((CHAR16 *)(((unsigned __int64)v5++ << 6) + Source + 32)); /*0x124a0*/
      v6 += 64; /*0x124a8*/
      v2 &= v8; /*0x124ac*/
    }
    while ( v2 ); /*0x124af*/
  }
  return v2; /*0x124c3*/
}


// Function: Assert_93 @ 0x124d0 (0x8f bytes)
// Index: 492/906

__int64 __fastcall Assert_93(_BYTE *Source)
{
  __int64 v2; // rsi
  __int64 v3; // rbx
  _QWORD *v4; // rax
  __int64 result; // rax
  __int16 v6; // [rsp+38h] [rbp+10h] BYREF

  v6 = 0; /*0x124e9*/
  while ( 1 ) /*0x12540*/
  {
    result = Assert_56(Source_16, &v6); /*0x12540*/
    if ( !result ) /*0x12548*/
      break; /*0x12548*/
    v2 = *(_QWORD *)(result + 136); /*0x124ef*/
    v3 = *(_QWORD *)(Source_16 + 216); /*0x12501*/
    v4 = sub_EFD8(v3, *((_QWORD *)Source + 11)); /*0x1250b*/
    LOBYTE(v3) = sub_EFB0(v3, v4); /*0x1251e*/
    if ( sub_14420(v2) == (_BYTE)v3 ) /*0x12527*/
      Assert_55(Source, v2); /*0x1252f*/
  }
  return result; /*0x12559*/
}


// Function: JournalInitEntries @ 0x12560 (0x44 bytes)
// Index: 493/906

__int64 __fastcall JournalInitEntries(_BYTE *a1)
{
  _BYTE *v1; // rbx
  _BYTE *Destination; // rdi
  __int64 n24; // rsi
  __int64 result; // rax

  v1 = a1; /*0x1256f*/
  Destination = a1 + 8; /*0x12572*/
  n24 = 24; /*0x12576*/
  do /*0x12592*/
  {
    *v1 = 0; /*0x1257e*/
    result = sub_11E3C((__int64)Destination); /*0x12581*/
    Destination += 104; /*0x12586*/
    v1 += 104; /*0x1258a*/
    --n24; /*0x1258e*/
  }
  while ( n24 ); /*0x12592*/
  return result; /*0x1259e*/
}


// Function: Assert_106 @ 0x125a4 (0x46 bytes)
// Index: 494/906

__int64 __fastcall Assert_106(_BYTE *a1)
{
  _BYTE *v1; // rbx
  _BYTE *Destination; // rdi
  __int64 n24; // rsi
  __int64 result; // rax

  v1 = a1; /*0x125b3*/
  Destination = a1 + 8; /*0x125b6*/
  n24 = 24; /*0x125ba*/
  do /*0x125d8*/
  {
    if ( *v1 ) /*0x125bf*/
      result = Assert_50((__int64)Destination); /*0x125c7*/
    Destination += 104; /*0x125cc*/
    v1 += 104; /*0x125d0*/
    --n24; /*0x125d4*/
  }
  while ( n24 ); /*0x125d8*/
  return result; /*0x125e4*/
}


// Function: Assert_130 @ 0x125ec (0x5b bytes)
// Index: 495/906

__int64 __fastcall Assert_130(_BYTE *a1, _BYTE *Source)
{
  _BYTE *v3; // rbx
  _BYTE *Source_1; // rdi
  __int64 n24; // rsi
  __int64 result; // rax

  v3 = a1; /*0x12603*/
  Source_1 = a1 + 8; /*0x12606*/
  n24 = 24; /*0x1260a*/
  do /*0x12630*/
  {
    if ( !*v3 && Source_1 == Source ) /*0x12617*/
    {
      result = Assert_93(Source_1); /*0x1261c*/
      *v3 = 0; /*0x12621*/
    }
    Source_1 += 104; /*0x12624*/
    v3 += 104; /*0x12628*/
    --n24; /*0x1262c*/
  }
  while ( n24 ); /*0x12630*/
  return result; /*0x12641*/
}


// Function: JournalFindEntry @ 0x12648 (0x39 bytes)
// Index: 496/906

__int64 __fastcall JournalFindEntry(__int64 a1, __int64 a2)
{
  int v3; // eax
  __int64 v4; // rdx
  __int64 n24; // r9

  if ( !a2 ) /*0x1264e*/
    return 0; /*0x12672*/
  v3 = 0; /*0x12650*/
  v4 = a1; /*0x12652*/
  n24 = 0; /*0x12655*/
  while ( !*(_BYTE *)v4 || *(_QWORD *)(v4 + 96) != a2 ) /*0x12661*/
  {
    ++n24; /*0x12663*/
    ++v3; /*0x12666*/
    v4 += 104; /*0x12668*/
    if ( n24 >= 24 ) /*0x12670*/
      return 0; /*0x12670*/
  }
  return 104LL * v3 + a1 + 8; /*0x12674*/
}


// Function: JournalCompareName @ 0x12684 (0x68 bytes)
// Index: 497/906

char __fastcall JournalCompareName(_BYTE *i, __int64 a2)
{
  __int64 n24; // rdi

  n24 = 0; /*0x126a0*/
  while ( !*i || StrnCpy16((_BYTE *)(a2 + 28), (_BYTE *)(*((_QWORD *)i + 12) + 28LL), 0xFFFF) ) /*0x126c2*/
  {
    ++n24; /*0x126c4*/
    i += 104; /*0x126c7*/
    if ( n24 >= 24 ) /*0x126cf*/
      return 0; /*0x126d1*/
  }
  return 1; /*0x126e2*/
}


// Function: Assert_51 @ 0x126ec (0xad bytes)
// Index: 498/906

_BYTE *__fastcall Assert_51(_BYTE *i, __int64 a2, char a3)
{
  __int64 v6; // rdx
  __int64 v7; // rcx
  int v8; // ebx
  _BYTE *j; // rsi
  __int64 v10; // rax

  if ( JournalCompareName((__int64)i, a2) ) /*0x1270e*/
  {
    if ( (unsigned __int8)RstDebugEnabled(v7, v6) ) /*0x1275b*/
      DebugAssert("JournalDisksMgr.cpp", 0x46u, "((BOOLEAN)(0==1))"); /*0x12777*/
    return 0; /*0x1277c*/
  }
  else
  {
    v8 = 0; /*0x12717*/
    for ( j = i; *j || !Assert_103((__int64)&i[104 * v8 + 8], a2, a3); j += 104 ) /*0x12719*/
    {
      if ( ++v8 >= 24 ) /*0x12745*/
        return 0; /*0x12745*/
    }
    v10 = 104LL * v8; /*0x1274c*/
    i[v10] = 1; /*0x12750*/
    return &i[v10 + 8]; /*0x12754*/
  }
}


// Function: JournalAlloc @ 0x1279c (0x47 bytes)
// Index: 499/906

_QWORD *__fastcall JournalAlloc(_QWORD *a1)
{
  _QWORD *v1; // rdi
  _QWORD *v3; // rax

  v1 = 0; /*0x127a6*/
  a1[1] = 0; /*0x127ab*/
  *a1 = 0; /*0x127af*/
  a1[5] = 0; /*0x127b2*/
  v3 = (_QWORD *)sub_10A10(64); /*0x127b9*/
  if ( v3 ) /*0x127c1*/
    v1 = sub_1926C(v3, (__int64)a1); /*0x127ce*/
  a1[8] = v1; /*0x127d1*/
  return a1; /*0x127dd*/
}


// Function: JournalClearStatus @ 0x127e4 (0xa bytes)
// Index: 500/906

__int64 __fastcall JournalClearStatus(__int64 a1)
{
  *(_WORD *)(a1 + 56) = 0; /*0x127e6*/
  *(_DWORD *)(a1 + 76) = 0; /*0x127ea*/
  return 0; /*0x127ed*/
}


// Function: JournalFilterFlags @ 0x127f0 (0x11 bytes)
// Index: 501/906

__int64 __fastcall JournalFilterFlags(__int64 a1, int a2, unsigned int n513)
{
  if ( (a2 & 4) != 0 ) /*0x127f3*/
    a2 &= ~1u; /*0x127f5*/
  return sub_10278(*(_QWORD *)(a1 + 48), a2, n513);
}


// Function: JournalSetActive @ 0x12804 (0x53 bytes)
// Index: 502/906

__int64 __fastcall JournalSetActive(__int64 a1, char a2)
{
  if ( a2 ) /*0x12814*/
  {
    *(_DWORD *)(a1 + 76) = 1; /*0x12816*/
    RstDeviceSetFlags(*(_QWORD *)(a1 + 48), 33554720); /*0x12821*/
    return RstDeviceClearFlags(*(_QWORD *)(a1 + 48), 64); /*0x1282f*/
  }
  else
  {
    *(_DWORD *)(a1 + 76) = 0; /*0x12836*/
    RstDeviceClearFlags(*(_QWORD *)(a1 + 48), 33554720); /*0x1283e*/
    return RstDeviceSetFlags(*(_QWORD *)(a1 + 48), 64); /*0x1284c*/
  }
}


// Function: JournalGetStatus @ 0x12858 (0x4 bytes)
// Index: 503/906

__int64 __fastcall JournalGetStatus(__int64 a1)
{
  return *(unsigned int *)(a1 + 76); /*0x1285b*/
}


// Function: JournalSetSlot @ 0x1285c (0x50 bytes)
// Index: 504/906

__int64 __fastcall JournalSetSlot(__int64 i, __int64 a2)
{
  __int64 result; // rax

  if ( a2 ) /*0x12874*/
  {
    RstDeviceSetFlags(*(_QWORD *)(i + 48), 2); /*0x1288a*/
    result = RstDeviceClearFlags(*(_QWORD *)(i + 48), 1); /*0x12898*/
    *(_QWORD *)(i + 40) = a2; /*0x1289d*/
  }
  else
  {
    *(_QWORD *)(i + 40) = 0; /*0x12876*/
    return RstDeviceClearFlags(*(_QWORD *)(i + 48), 2); /*0x1287f*/
  }
  return result; /*0x128a6*/
}


// Function: JournalSetFlag4 @ 0x128ac (0xe bytes)
// Index: 505/906

__int64 __fastcall JournalSetFlag4(__int64 a1)
{
  return RstDeviceSetFlags(*(_QWORD *)(a1 + 48), 4u);
}


// Function: JournalIsActive @ 0x128bc (0x20 bytes)
// Index: 506/906

char __fastcall JournalIsActive(__int64 a1)
{
  char v1; // dl

  v1 = 1; /*0x128bc*/
  if ( *(_DWORD *)(a1 + 76) != 1 || (*(_DWORD *)(*(_QWORD *)(a1 + 48) + 136LL) & 0x2000000) == 0 ) /*0x128d5*/
    return 0; /*0x128d7*/
  return v1; /*0x128db*/
}


// Function: JournalCheckSuffix @ 0x128dc (0xa7 bytes)
// Index: 507/906

char __fastcall JournalCheckSuffix(__int64 a1)
{
  __int16 n2; // ax
  __int64 v3; // rdi
  char v4; // bl

  n2 = StrLenA((_BYTE *)(a1 + 18)); /*0x128f2*/
  if ( (unsigned __int16)n2 < 2u ) /*0x128ff*/
    return 0; /*0x12971*/
  v3 = (unsigned __int16)(n2 - 2) + a1 + 18; /*0x12916*/
  v4 = 0; /*0x12923*/
  if ( sub_8260(v3, "-A", 2u) || sub_8260(v3, "-1", 2u) || sub_8260(v3, "-B", 2u) || sub_8260(v3, "-2", 2u) ) /*0x12962*/
    return 1; /*0x1296b*/
  return v4; /*0x1297d*/
}


// Function: JournalInitEntry @ 0x12984 (0x7e bytes)
// Index: 508/906

unsigned __int8 __fastcall JournalInitEntry(__int64 *i, const CHAR16 *Source, __int64 a3)
{
  unsigned __int8 result; // al
  _QWORD *i_1; // rdx
  __int64 v7; // rcx

  *((_WORD *)i + 28) = 0; /*0x129a0*/
  *((_DWORD *)i + 19) = 0; /*0x129a4*/
  result = (unsigned __int8)StrnCpy((CHAR16 *)i + 9, Source, 0x10u); /*0x129af*/
  *((_BYTE *)i + 34) = 0; /*0x129b4*/
  i_1 = (_QWORD *)i[5]; /*0x129b8*/
  i[6] = a3; /*0x129bc*/
  if ( i_1 ) /*0x129c3*/
  {
    result = sub_E790(*(_QWORD *)(Source_16 + 216), i_1); /*0x129d3*/
    if ( !result ) /*0x129db*/
    {
      v7 = i[6]; /*0x129dd*/
      i[5] = 0; /*0x129e4*/
      return RstDeviceClearFlags(v7, 2); /*0x129e8*/
    }
  }
  return result; /*0x129fc*/
}


// Function: JournalSetupEntry @ 0x12a04 (0xe3 bytes)
// Index: 509/906

unsigned __int8 __fastcall JournalSetupEntry(__int64 i, __int64 Source)
{
  int v2; // ebx
  int v5; // esi
  __int64 v6; // rax
  __int64 Source_1; // rbx
  unsigned __int64 v8; // rax

  v2 = *(_DWORD *)(Source + 24); /*0x12a1d*/
  v5 = v2 & ((unsigned __int8)sub_19488((_BYTE *)Source) != 0 ? 46269063 : 12714631);
  *(_DWORD *)(i + 76) = (unsigned __int8)sub_19488((_BYTE *)Source) != 0; /*0x12a58*/
  StrnCpy((CHAR16 *)(i + 18), (const CHAR16 *)Source, 0x10u); /*0x12a5f*/
  *(_BYTE *)(i + 34) = 0; /*0x12a64*/
  v6 = sub_16484(Source_16 + 2984, (_BYTE *)(i + 18)); /*0x12a7a*/
  *(_QWORD *)(i + 48) = v6; /*0x12a7f*/
  if ( v6 ) /*0x12a86*/
  {
    RstDeviceSetFlags(v6, v5); /*0x12a8d*/
  }
  else
  {
    Source_1 = Source_16; /*0x12a94*/
    v8 = sub_19420(Source); /*0x12a9e*/
    *(_QWORD *)(i + 48) = sub_16284(Source_1 + 2984, (_BYTE *)(i + 18), v5, v8); /*0x12ab9*/
  }
  return JournalInitEntry((__int64 *)i, (const CHAR16 *)(i + 18), *(_QWORD *)(i + 48)); /*0x12adc*/
}


// Function: JournalCheckMembers @ 0x12ae8 (0x3e bytes)
// Index: 510/906

char __fastcall JournalCheckMembers(__int64 a1)
{
  __int16 v1; // r8

  v1 = 0; /*0x12aed*/
  if ( !*(_BYTE *)(a1 + 20) ) /*0x12ae8*/
    return 1; /*0x12b20*/
  while ( (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8LL * v1 + 24) + 48LL) + 136LL) & 0x10) == 0 ) /*0x12b11*/
  {
    if ( ++v1 >= (int)*(unsigned __int8 *)(a1 + 20) ) /*0x12b1e*/
      return 1; /*0x12b1e*/
  }
  return 0; /*0x12b22*/
}


// Function: JournalCheckSlots @ 0x12b28 (0x45 bytes)
// Index: 511/906

char __fastcall JournalCheckSlots(__int64 a1)
{
  __int16 v1; // r8

  v1 = 0; /*0x12b39*/
  if ( !*(_BYTE *)(a1 + 224) ) /*0x12b28*/
    return 0; /*0x12b67*/
  while ( *(_WORD *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 8LL * v1 + 232) + 56LL) + 40LL) + 4LL) ) /*0x12b58*/
  {
    if ( ++v1 >= (int)*(unsigned __int8 *)(a1 + 224) ) /*0x12b65*/
      return 0; /*0x12b65*/
  }
  return 1; /*0x12b69*/
}


// Function: JournalFindById @ 0x12b70 (0x3f bytes)
// Index: 512/906

__int64 __fastcall JournalFindById(__int64 a1, __int64 a2)
{
  __int16 i_1; // cx
  __int16 i; // r9

  i_1 = *(_WORD *)(a1 + 408); /*0x12b73*/
  for ( i = 0; ; ++i ) /*0x12b7a*/
  {
    if ( i >= i_1 ) /*0x12b99*/
      return 0; /*0x12b9d*/
    if ( *(_QWORD *)(a1 + 24LL * i + 416) == a2 ) /*0x12b8f*/
      break; /*0x12b8f*/
  }
  return a1 + 24LL * i + 416; /*0x12b9d*/
}


// Function: JournalRemove @ 0x12bb0 (0xdd bytes)
// Index: 513/906

__int64 __fastcall JournalRemove(__int64 a1, __int64 a2)
{
  __int64 result; // rax
  __int64 v5; // r11
  int n3; // eax
  _QWORD *v7; // r10
  int v8; // edx
  __int64 v9; // rcx

  result = JournalFindById(a1, a2); /*0x12bc0*/
  v5 = 0; /*0x12bc5*/
  while ( 1 ) /*0x12c1a*/
  {
    v7 = (_QWORD *)result; /*0x12c1a*/
    if ( result == v5 ) /*0x12c20*/
      break; /*0x12c20*/
    --*(_WORD *)(a1 + 408); /*0x12bca*/
    n3 = 3; /*0x12bd9*/
    if ( *(__int16 *)(a1 + 408) < 4 ) /*0x12be5*/
      n3 = *(__int16 *)(a1 + 408); /*0x12be5*/
    *v7 = *(_QWORD *)(a1 + 24LL * n3 + 416); /*0x12bf7*/
    v7[1] = *(_QWORD *)(a1 + 24LL * n3 + 424); /*0x12c02*/
    v7[2] = *(_QWORD *)(a1 + 24LL * n3 + 432); /*0x12c11*/
    result = JournalFindById(a1, a2); /*0x12c15*/
  }
  v8 = *(unsigned __int8 *)(a1 + 224); /*0x12c22*/
  if ( v8 > (int)v5 ) /*0x12c2c*/
  {
    while ( 1 ) /*0x12c2e*/
    {
      result = (__int16)v5; /*0x12c2e*/
      LOWORD(v5) = v5 + 1; /*0x12c32*/
      if ( a2 == *(_QWORD *)(a1 + 8 * result + 232) ) /*0x12c3e*/
        break; /*0x12c3e*/
      if ( (__int16)v5 >= *(unsigned __int8 *)(a1 + 224) ) /*0x12c4b*/
        return result; /*0x12c4b*/
    }
    result = (unsigned int)(__int16)v5; /*0x12c4f*/
    if ( (int)result < v8 ) /*0x12c55*/
    {
      do /*0x12c7a*/
      {
        v9 = (__int16)v5; /*0x12c57*/
        LOWORD(v5) = v5 + 1; /*0x12c5b*/
        result = *(_QWORD *)(a1 + 8 * v9 + 232); /*0x12c5f*/
        *(_QWORD *)(a1 + 8 * v9 + 224) = result; /*0x12c67*/
      }
      while ( (__int16)v5 < *(unsigned __int8 *)(a1 + 224) ); /*0x12c7a*/
    }
    --*(_BYTE *)(a1 + 224); /*0x12c7c*/
  }
  return result; /*0x12c87*/
}


// Function: JournalGetPtr @ 0x12c90 (0x2b bytes)
// Index: 514/906

unsigned __int8 __fastcall JournalGetPtr(__int64 a1)
{
  unsigned __int8 n24; // al
  unsigned __int8 n0x18; // cl

  if ( !*(_BYTE *)(a1 + 224) ) /*0x12c90*/
    return 0; /*0x12c99*/
  n0x18 = *(_BYTE *)(*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 232) + 56LL) + 40LL) + 6LL); /*0x12cab*/
  n24 = 24; /*0x12cae*/
  if ( n0x18 <= 0x18u ) /*0x12cb5*/
    return n0x18; /*0x12cb7*/
  return n24; /*0x12c9b*/
}


// Function: JournalCompareDevice @ 0x12cbc (0x2e bytes)
// Index: 515/906

__int16 __fastcall JournalCompareDevice(_QWORD *a1)
{
  _QWORD *v1; // r8
  __int16 result; // ax

  v1 = *(_QWORD **)(*(_QWORD *)(Source_16 + 216) + 264LL); /*0x12cca*/
  result = 0; /*0x12cd3*/
  while ( v1 && v1 != a1 ) /*0x12cdb*/
  {
    v1 = (_QWORD *)*v1; /*0x12cdd*/
    ++result; /*0x12ce0*/
  }
  return result; /*0x12ce8*/
}


// Function: Assert_26 @ 0x12cec (0x15d bytes)
// Index: 516/906

__int64 __fastcall Assert_26(__int64 a1, unsigned __int64 a2, unsigned __int8 a3)
{
  __int64 v6; // rdx
  __int64 v7; // rcx
  int v8; // r12d
  unsigned int v9; // esi
  __int64 v10; // rdx
  __int64 v11; // rcx
  unsigned int v12; // edi

  if ( (unsigned __int8)RstDebugEnabled(a1, a2) ) /*0x12d0d*/
  {
    if ( (unsigned __int8)RstDebugEnabled(v7, v6) ) /*0x12d1c*/
    {
      if ( *(_DWORD *)(a1 + 280) ) /*0x12d25*/
        goto LABEL_7; /*0x12d2c*/
      DebugAssert("d:\\qba1\\workspace\\27822\\src\\lib\\ism\\CfgArray.h", 0x8Cu, "m_nBlockSize != ( 0 )"); /*0x12d3f*/
    }
    if ( !*(_DWORD *)(a1 + 280) ) /*0x12d44*/
      DebugAssert("CfgArray.cpp", 0x124u, "GetBlockSize() != ( 0 )"); /*0x12d60*/
  }
LABEL_7:
  if ( (unsigned __int8)RstDebugEnabled(v7, v6) && !*(_DWORD *)(a1 + 280) ) /*0x12d6e*/
    DebugAssert("d:\\qba1\\workspace\\27822\\src\\lib\\ism\\CfgArray.h", 0x8Cu, "m_nBlockSize != ( 0 )"); /*0x12d88*/
  v8 = a3; /*0x12d94*/
  v9 = a3 * (unsigned int)(a2 / (0x100000u / *(_DWORD *)(a1 + 280))); /*0x12dab*/
  if ( (unsigned __int8)RstDebugEnabled(0x100000u / *(_DWORD *)(a1 + 280), a2 % (0x100000u / *(_DWORD *)(a1 + 280))) /*0x12db8*/
    && !*(_DWORD *)(a1 + 280) )
  {
    DebugAssert("d:\\qba1\\workspace\\27822\\src\\lib\\ism\\CfgArray.h", 0x8Cu, "m_nBlockSize != ( 0 )"); /*0x12dd2*/
  }
  v12 = *(_DWORD *)(a1 + 280); /*0x12dd7*/
  if ( (unsigned __int8)RstDebugEnabled(v11, v10) && !*(_DWORD *)(a1 + 280) ) /*0x12de6*/
    DebugAssert("d:\\qba1\\workspace\\27822\\src\\lib\\ism\\CfgArray.h", 0x8Cu, "m_nBlockSize != ( 0 )"); /*0x12e00*/
  return v9 + v8 * ((unsigned int)a2 & (0x100000 / v12 - 1)) / (0x100000u / *(_DWORD *)(a1 + 280)); /*0x12e3f*/
}


// Function: Assert_45 @ 0x17988 (0xb7 bytes)
// Index: 650/906

char __fastcall Assert_45(__int64 a1)
{
  __int64 v1; // rax
  __int64 v2; // rbx
  __int64 v3; // rcx
  __int64 v4; // rdi

  *(_WORD *)(a1 + 44) = 0; /*0x179a1*/
  while ( 1 ) /*0x179a5*/
  {
    v1 = sub_17964(); /*0x179a5*/
    v2 = v1; /*0x179aa*/
    if ( !v1 ) /*0x179b0*/
      break; /*0x179b0*/
    v3 = *(_QWORD *)(v1 + 48); /*0x179b2*/
    if ( (*(_DWORD *)(v3 + 136) & 0x10) != 0 ) /*0x179c2*/
    {
      v4 = *(_QWORD *)(v1 + 40); /*0x179c4*/
      if ( (unsigned __int8)RstDebugEnabled(v3, *(_DWORD *)(v3 + 136) >> 4) && !*(_DWORD *)(v4 + 280) ) /*0x179d2*/
        DebugAssert("d:\\qba1\\workspace\\27822\\src\\lib\\ism\\CfgArray.h", 0x8Cu, "m_nBlockSize != ( 0 )"); /*0x179ed*/
      if ( *(_DWORD *)(v4 + 280) == 4096 && *(_DWORD *)(*(_QWORD *)(v2 + 48) + 88LL) >= 0x20000000u /*0x17a1d*/
        || (*(_QWORD *)(*(_QWORD *)(v2 + 48) + 88LL) & 0xFFFFFFFF00000000uLL) != 0 )
      {
        return 1; /*0x17a26*/
      }
    }
  }
  return 0; /*0x17a39*/
}


// Function: JournalFindByType @ 0x17a40 (0x4f bytes)
// Index: 651/906

char __fastcall JournalFindByType(__int64 a1, unsigned int a2)
{
  __int64 v3; // rbx
  __int64 v4; // rax

  v3 = a1; /*0x17a53*/
  *(_WORD *)(a1 + 44) = 0; /*0x17a56*/
  while ( 1 ) /*0x17a6f*/
  {
    v4 = sub_17964(a1); /*0x17a6f*/
    if ( !v4 ) /*0x17a77*/
      return 0; /*0x17a79*/
    if ( (unsigned __int8)RstHelper_02b4(*(_QWORD *)(v4 + 48), a2) ) /*0x17a62*/
      break; /*0x17a62*/
    a1 = v3; /*0x17a6c*/
  }
  return 1; /*0x17a85*/
}


// Function: RstHelper_7a90 @ 0x17a90 (0x58 bytes)
// Index: 652/906

__int64 __fastcall sub_17A90(__int64 a1)
{
  __int16 v1; // di
  __int64 v2; // rbx
  __int64 v3; // rax
  __int64 v4; // r8
  __int64 v5; // rcx

  v1 = *(_WORD *)(a1 + 44); /*0x17a9a*/
  v2 = a1; /*0x17aa1*/
  *(_WORD *)(a1 + 44) = 0; /*0x17aa4*/
  while ( 1 ) /*0x17aa9*/
  {
    v3 = sub_17964(a1); /*0x17aa9*/
    if ( v3 == v4 ) /*0x17ab1*/
      break; /*0x17ab1*/
    v5 = *(_QWORD *)(v3 + 48); /*0x17ab3*/
    if ( v5 != v4 && (*(_DWORD *)(v5 + 136) & 0x10) != 0 ) /*0x17ac7*/
    {
      LODWORD(v4) = HiiLibReturnZero(v5); /*0x17ad3*/
      break; /*0x17ad3*/
    }
    a1 = v2; /*0x17ac9*/
  }
  *(_WORD *)(v2 + 44) = v1; /*0x17ad6*/
  return (unsigned int)v4; /*0x17ae2*/
}


// Function: Assert_99 @ 0x17ae8 (0x6d bytes)
// Index: 653/906

__int64 __fastcall sub_17AE8(__int64 a1, __int64 a2)
{
  __int64 v2; // rdi
  __int64 result; // rax

  v2 = *(_QWORD *)(a2 + 8); /*0x17af7*/
  sub_13698(v2, a2, *(_QWORD *)(a1 + 8), *(_QWORD *)(a1 + 24)); /*0x17b09*/
  *(_WORD *)(a1 + 44) = 0; /*0x17b10*/
  while ( 1 ) /*0x17b3b*/
  {
    result = sub_17964(a1); /*0x17b3b*/
    if ( !result ) /*0x17b43*/
      break; /*0x17b43*/
    if ( (*(_DWORD *)(*(_QWORD *)(result + 48) + 136LL) & 2) == 0 || !*(_QWORD *)(result + 40) ) /*0x17b27*/
      Assert_58(v2, result); /*0x17b33*/
  }
  return result; /*0x17b4f*/
}


// Function: JournalStringRealloc @ 0x17b58 (0x52 bytes)
// Index: 654/906

__int64 __fastcall JournalStringRealloc(__int64 a1, int a2)
{
  __int64 v3; // rcx
  __int16 n16; // cx
  __int64 result; // rax

  v3 = *(_QWORD *)a1; /*0x17b65*/
  if ( v3 ) /*0x17b6d*/
    sub_17400(v3); /*0x17b6f*/
  n16 = *(_WORD *)(a1 + 10); /*0x17b74*/
  *(_BYTE *)(a1 + 8) = 0; /*0x17b7a*/
  result = sub_17390(n16, a2); /*0x17b7e*/
  *(_QWORD *)a1 = result; /*0x17b83*/
  if ( result ) /*0x17b89*/
  {
    *(_BYTE *)(a1 + 8) = 1; /*0x17b8b*/
  }
  else
  {
    result = sub_173C8(*(_WORD *)(a1 + 10), a2); /*0x17b97*/
    *(_QWORD *)a1 = result; /*0x17b9c*/
  }
  return result; /*0x17ba4*/
}


// Function: JournalSetCallback @ 0x17bac (0xf bytes)
// Index: 655/906

CHAR16 *__fastcall JournalSetCallback(CHAR16 *p_Destination, int a2, __int64 Destination)
{
  *((_DWORD *)p_Destination + 13) = a2; /*0x17bac*/
  *(_QWORD *)p_Destination = Destination; /*0x17baf*/
  return RstHelper_955c((__int64)(p_Destination + 4));
}


// Function: Assert_111 @ 0x17bbc (0x33 bytes)
// Index: 656/906

bool __fastcall Assert_111(CHAR16 **p_Destination)
{
  CHAR16 **v1; // rdi
  int v2; // ebx

  v1 = p_Destination + 1; /*0x17bc6*/
  v2 = *((_DWORD *)p_Destination + 2); /*0x17bcd*/
  return v2 == (unsigned int)Assert_46((CHAR16 *)p_Destination + 4) && StrnCpy16_w((__int64)v1); /*0x17be9*/
}


// Function: JournalGetNextPtr @ 0x17bf0 (0x5 bytes)
// Index: 657/906

CHAR16 **__fastcall JournalGetNextPtr(CHAR16 **p_Destination)
{
  return p_Destination + 1; /*0x17bf4*/
}


// Function: JournalGetBlockSize @ 0x17bf8 (0x8 bytes)
// Index: 658/906

__int64 __fastcall JournalGetBlockSize(__int64 a1)
{
  return *(_QWORD *)(*(_QWORD *)a1 + 88LL); /*0x17bff*/
}


// Function: JournalGetPtr2 @ 0x17c00 (0x4 bytes)
// Index: 659/906

__int64 __fastcall JournalGetPtr2(__int64 a1)
{
  return *(_QWORD *)a1; /*0x17c03*/
}


// Function: Assert_54 @ 0x17c04 (0xa8 bytes)
// Index: 660/906

__int64 __fastcall Assert_54(CHAR16 **p_Destination, __int64 a2)
{
  __int64 v3; // rdi
  int v4; // ebx
  __int64 v5; // rbx
  __int64 v6; // rdi
  __int64 v7; // rbx

  if ( (unsigned __int8)RstDebugEnabled(p_Destination, a2) && !*p_Destination ) /*0x17c1f*/
    DebugAssert("JdPplMpbMgr.cpp", 0xC3u, "jDisk"); /*0x17c38*/
  v3 = *((_QWORD *)*p_Destination + 11); /*0x17c42*/
  v4 = RstGetFieldSize(*p_Destination, 0); /*0x17c50*/
  v5 = (unsigned int)RstHelper_1d9c(*p_Destination, 0) * v4; /*0x17c5a*/
  v6 = (unsigned int)(*((_DWORD *)p_Destination + 13) + 1) * (v5 + 0x1000 / (unsigned int)HiiLibReturnZero(v3)); /*0x17c79*/
  v7 = RstHelper_1dfc(*p_Destination) - v6; /*0x17c8b*/
  return v7 - (unsigned int)sub_11E38(*p_Destination); /*0x17ca6*/
}


// Function: Assert_65 @ 0x17cac (0x65 bytes)
// Index: 661/906

__int64 __fastcall Assert_65(CHAR16 **p_Destination, __int64 a2)
{
  unsigned int v3; // eax

  if ( (unsigned __int8)RstDebugEnabled(p_Destination, a2) && !*p_Destination ) /*0x17cc2*/
    DebugAssert("JdPplMpbMgr.cpp", 0xD2u, "jDisk"); /*0x17cdb*/
  v3 = HiiLibReturnZero(*((_QWORD *)*p_Destination + 11)); /*0x17ce7*/
  return 0x1000 / v3 + Assert_54(p_Destination, 0x1000 % v3); /*0x17d0b*/
}


// Function: Assert_62 @ 0x17d14 (0x7f bytes)
// Index: 662/906

unsigned __int64 __fastcall Assert_62(__int64 p_Destination)
{
  int v2; // edi
  __int64 v3; // rdx
  __int64 v4; // rax
  CHAR16 *Destination; // rcx

  if ( RstDebugEnabled() && !*(_QWORD *)p_Destination ) /*0x17d2f*/
    DebugAssert("JdPplMpbMgr.cpp", 0xDBu, "jDisk"); /*0x17d48*/
  v2 = *(_DWORD *)(p_Destination + 52); /*0x17d50*/
  *(_DWORD *)(p_Destination + 52) = RstGetFieldCount(*(_QWORD *)p_Destination, 0); /*0x17d5d*/
  v4 = Assert_54((CHAR16 **)p_Destination, v3); /*0x17d60*/
  Destination = *(CHAR16 **)p_Destination; /*0x17d65*/
  *(_DWORD *)(p_Destination + 52) = v2; /*0x17d6b*/
  return v4 - (unsigned int)(v2 + 1) * (unsigned __int64)(unsigned int)RstGetFieldBlockSize(Destination); /*0x17d8d*/
}


// Function: Assert_15 @ 0x17d94 (0x1c3 bytes)
// Index: 663/906

char __fastcall Assert_15(CHAR16 **p_Destination, int n23, int a3)
{
  unsigned int v6; // esi
  unsigned int v7; // ebx
  __int64 v8; // rdx
  __int64 v9; // r15
  unsigned int v10; // r12d
  unsigned int v11; // eax
  char v12; // bl
  unsigned int v13; // r13d
  _BYTE *i_1; // rdi
  unsigned int v15; // eax
  int v16; // eax
  unsigned int v18; // esi
  __int64 Source; // rax
  unsigned int v20; // ebp
  _BYTE *i; // [rsp+30h] [rbp-38h] BYREF
  char v22; // [rsp+38h] [rbp-30h]
  __int16 n16; // [rsp+3Ah] [rbp-2Eh]

  v6 = HiiLibReturnZero(*((_QWORD *)*p_Destination + 11)); /*0x17dc9*/
  v7 = RstHelper_1d9c(*p_Destination, 1); /*0x17dd3*/
  v9 = Assert_65(p_Destination, v8) + n23 * v7; /*0x17de8*/
  v10 = 0x1000 / v6; /*0x17df4*/
  v11 = v7; /*0x17df7*/
  v12 = 0; /*0x17df9*/
  i = 0; /*0x17e00*/
  v13 = v11 / (0x1000 / v6); /*0x17e05*/
  v22 = 0; /*0x17e0b*/
  n16 = 16; /*0x17e0f*/
  JournalStringRealloc((__int64)&i, 0); /*0x17e14*/
  i_1 = i; /*0x17e19*/
  if ( RstDebugEnabled() ) /*0x17e1e*/
  {
    if ( !i_1 ) /*0x17e2a*/
      DebugAssert("JdPplMpbMgr.cpp", 0x46u, "pplHdr"); /*0x17e3d*/
  }
  MemZero(i_1, 0, 4096); /*0x17e4f*/
  MemZero(i_1, 255, 512); /*0x17e62*/
  *((_DWORD *)i_1 + 128) = a3; /*0x17e67*/
  v15 = sub_1922C(); /*0x17e6d*/
  v16 = sub_19230(v15, (unsigned int *)i_1, 4096); /*0x17e7a*/
  *((_DWORD *)i_1 + 133) = sub_19264(v16); /*0x17e8c*/
  Assert_89(Source_16, *((_QWORD *)*p_Destination + 11), 42, v9, 4096, (unsigned int)i_1); /*0x17ea8*/
  if ( *(_WORD *)(Source_16 + 2720) ) /*0x17eb4*/
  {
    sub_17400((__int64)i); /*0x17ec3*/
    return 0; /*0x17ec8*/
  }
  else
  {
    MemZero(i_1, 0, 4096); /*0x17ed4*/
    v18 = 1; /*0x17ed9*/
    if ( v13 <= 1 ) /*0x17ee1*/
    {
LABEL_10:
      v12 = 1; /*0x17f2b*/
    }
    else
    {
      Source = Source_16; /*0x17ee3*/
      v20 = v10; /*0x17eea*/
      while ( 1 ) /*0x17f0c*/
      {
        Assert_89(Source, *((_QWORD *)*p_Destination + 11), 42, v9 + v20, 4096, (unsigned int)i_1); /*0x17f0c*/
        Source = Source_16; /*0x17f11*/
        if ( *(_WORD *)(Source_16 + 2720) ) /*0x17f18*/
          break; /*0x17f18*/
        ++v18; /*0x17f21*/
        v20 += v10; /*0x17f23*/
        if ( v18 >= v13 ) /*0x17f29*/
          goto LABEL_10; /*0x17f29*/
      }
    }
    sub_17400((__int64)i); /*0x17f32*/
    return v12; /*0x17f37*/
  }
}


// Function: Assert_40 @ 0x17f58 (0xfb bytes)
// Index: 664/906

char __fastcall Assert_40(CHAR16 *p_Destination)
{
  char v2; // di
  char v3; // al
  CHAR16 *Destination_1; // rsi
  __int64 v5; // rbx
  __int64 v6; // rdx
  __int64 v7; // rax
  CHAR16 *Destination; // [rsp+30h] [rbp-18h] BYREF
  char v10; // [rsp+38h] [rbp-10h]
  __int16 n16; // [rsp+3Ah] [rbp-Eh]

  Assert_46(p_Destination + 4); /*0x17f73*/
  v2 = 0; /*0x17f78*/
  Destination = 0; /*0x17f84*/
  n16 = 16; /*0x17f89*/
  v10 = 0; /*0x17f8e*/
  JournalStringRealloc((__int64)&Destination, 0); /*0x17f93*/
  v3 = RstDebugEnabled(); /*0x17f98*/
  Destination_1 = Destination; /*0x17f9d*/
  if ( v3 && !Destination ) /*0x17faa*/
  {
    DebugAssert("JdPplMpbMgr.cpp", 0x80u, "framebuf.ptr()"); /*0x17fbf*/
    Destination_1 = Destination; /*0x17fc4*/
  }
  StrnCpy(Destination_1, p_Destination + 4, 0x2Au); /*0x17fd6*/
  MemZero((_BYTE *)Destination_1 + 42, 0, 4054); /*0x17fe7*/
  v5 = *(_QWORD *)(*(_QWORD *)p_Destination + 88LL); /*0x17ff3*/
  v7 = Assert_54((CHAR16 **)p_Destination, v6); /*0x17ff7*/
  Assert_89(Source_16, v5, 42, v7, 4096, (unsigned int)Destination_1); /*0x18018*/
  if ( !*(_WORD *)(Source_16 + 2720) ) /*0x18024*/
    v2 = 1; /*0x1802e*/
  sub_17400((__int64)Destination); /*0x18036*/
  return v2; /*0x1804d*/
}


// Function: Assert_43 @ 0x18054 (0xdf bytes)
// Index: 665/906

char __fastcall Assert_43(CHAR16 *p_Destination)
{
  char v1; // di
  __int64 v3; // rdx
  CHAR16 *Source_1; // rbp
  __int64 v5; // rbx
  __int64 v6; // rax
  CHAR16 *Source; // [rsp+30h] [rbp-18h] BYREF
  char v9; // [rsp+38h] [rbp-10h]
  __int16 n16; // [rsp+3Ah] [rbp-Eh]

  v1 = 0; /*0x18068*/
  Source = 0; /*0x18072*/
  v9 = 0; /*0x18076*/
  n16 = 16; /*0x1807f*/
  JournalStringRealloc((__int64)&Source, 0); /*0x18084*/
  if ( RstDebugEnabled() && !Source ) /*0x18098*/
    DebugAssert("JdPplMpbMgr.cpp", 0x93u, "framebuf.ptr()"); /*0x180ad*/
  Source_1 = Source; /*0x180b5*/
  v5 = *(_QWORD *)(*(_QWORD *)p_Destination + 88LL); /*0x180bd*/
  v6 = Assert_54((CHAR16 **)p_Destination, v3); /*0x180c1*/
  Assert_89(Source_16, v5, 40, v6, 4096, (unsigned int)Source); /*0x180e6*/
  if ( !*(_WORD *)(Source_16 + 2720) ) /*0x180f2*/
  {
    StrnCpy(p_Destination + 4, Source_1, 0x2Au); /*0x18109*/
    v1 = 1; /*0x1810e*/
  }
  sub_17400((__int64)Source); /*0x18116*/
  return v1; /*0x1812d*/
}


// Function: Assert_64 @ 0x18134 (0x6c bytes)
// Index: 666/906

char __fastcall Assert_64(__int64 p_Destination)
{
  unsigned int v2; // ebx

  v2 = 0; /*0x18146*/
  if ( RstDebugEnabled() && !*(_QWORD *)p_Destination ) /*0x1814c*/
    DebugAssert("JdPplMpbMgr.cpp", 0x2Eu, "jDisk"); /*0x18162*/
  if ( (unsigned int)RstGetFieldSize(*(CHAR16 **)p_Destination, 1) ) /*0x1816c*/
  {
    do /*0x18191*/
      Assert_15((CHAR16 **)p_Destination, v2++, *(_DWORD *)(p_Destination + 44)); /*0x1817e*/
    while ( v2 < (unsigned int)RstGetFieldSize(*(CHAR16 **)p_Destination, 1) ); /*0x18191*/
  }
  return 1; /*0x1819a*/
}


// Function: JournalInitList1 @ 0x181a0 (0x19 bytes)
// Index: 667/906

__int64 __fastcall JournalInitList1(__int64 a1)
{
  *(_WORD *)(a1 + 2) = 0; /*0x181a2*/
  *(_WORD *)(a1 + 4) = 0; /*0x181a6*/
  *(_WORD *)(a1 + 8) = 0; /*0x181aa*/
  *(_BYTE *)(a1 + 10) = 0; /*0x181b1*/
  *(_WORD *)(a1 + 6) = 1; /*0x181b4*/
  return 1; /*0x181b8*/
}


// Function: JournalInitList2 @ 0x181bc (0x1c bytes)
// Index: 668/906

__int64 __fastcall JournalInitList2(__int64 a1)
{
  *(_WORD *)(a1 + 2) = 0; /*0x181be*/
  *(_WORD *)(a1 + 4) = 0; /*0x181c2*/
  *(_WORD *)(a1 + 8) = 0; /*0x181c6*/
  *(_BYTE *)(a1 + 10) = 0; /*0x181cd*/
  *(_WORD *)(a1 + 6) = 1; /*0x181d0*/
  return a1; /*0x181d7*/
}


// Function: JournalInitStruct @ 0x181d8 (0x2e bytes)
// Index: 669/906

_BYTE *__fastcall JournalInitStruct(__int64 a1)
{
  _BYTE *i; // rcx

  i = (_BYTE *)(a1 + 80); /*0x181da*/
  *((_DWORD *)i - 12) = 0; /*0x181e0*/
  *((_DWORD *)i - 11) = 0; /*0x181e3*/
  *(i - 24) = 0; /*0x181e6*/
  *(i - 23) = 0; /*0x181e9*/
  *((_DWORD *)i - 10) = 0; /*0x181ec*/
  *((_DWORD *)i - 4) = 0; /*0x181ef*/
  *((_DWORD *)i - 9) = 0; /*0x181f2*/
  *(i - 22) = 0; /*0x181f5*/
  *((_DWORD *)i - 2) = 0; /*0x181f8*/
  return MemZero(i, 0, 136);
}


// Function: JournalChecksum @ 0x18208 (0x29 bytes)
// Index: 670/906

__int64 __fastcall JournalChecksum(_DWORD *a1)
{
  __int64 result; // rax
  bool v2; // zf
  _DWORD *v3; // r8
  unsigned __int64 v4; // rdx

  result = 0; /*0x18208*/
  v2 = (a1[9] & 0xFFFFFFFC) == 0; /*0x1820a*/
  v3 = a1 + 8; /*0x18211*/
  a1[8] = 0; /*0x18215*/
  if ( !v2 ) /*0x18218*/
  {
    v4 = (unsigned __int64)(unsigned int)a1[9] >> 2; /*0x1821d*/
    do /*0x1822b*/
    {
      result = (unsigned int)(*a1++ + result); /*0x18221*/
      --v4; /*0x18227*/
    }
    while ( v4 ); /*0x1822b*/
  }
  *v3 = result; /*0x1822d*/
  return result; /*0x18230*/
}


// Function: JournalFindByName @ 0x18234 (0x97 bytes)
// Index: 671/906

_BYTE *__fastcall JournalFindByName(__int64 a1, _BYTE *a2)
{
  unsigned __int16 v4; // bp
  _BYTE *v5; // rbx

  if ( !a2 ) /*0x18259*/
    return 0; /*0x18259*/
  v4 = 0; /*0x1825f*/
  v5 = (_BYTE *)(a1 + 48LL * *(unsigned __int8 *)(a1 + 56) + 216); /*0x1826a*/
  if ( !*(_BYTE *)(a1 + 57) ) /*0x18272*/
    return 0; /*0x182a9*/
  while ( StrnCpy16(a2, v5, 16) ) /*0x1828d*/
  {
    ++v4; /*0x1829e*/
    v5 = (_BYTE *)sub_1C054(v5 + 80, 0); /*0x182a1*/
    if ( v4 >= *(unsigned __int8 *)(a1 + 57) ) /*0x182a7*/
      return 0; /*0x182a7*/
  }
  return v5; /*0x182bf*/
}


// Function: JournalFillInfo @ 0x194d0 (0x73 bytes)
// Index: 710/906

__int64 __fastcall JournalFillInfo(CHAR16 *Destination, __int64 i)
{
  __int64 result; // rax

  MemZero(Destination, 0, 16); /*0x194e6*/
  sub_8304(Destination, i + 18, 16); /*0x194f8*/
  *((_DWORD *)Destination + 4) = *(_DWORD *)(*(_QWORD *)(i + 48) + 88LL); /*0x19505*/
  *((_DWORD *)Destination + 8) = HIDWORD(*(_QWORD *)(*(_QWORD *)(i + 48) + 88LL)); /*0x19515*/
  *((_DWORD *)Destination + 5) = *(_DWORD *)(*(_QWORD *)(i + 48) + 96LL); /*0x1951f*/
  result = *(_QWORD *)(i + 48); /*0x19522*/
  *((_DWORD *)Destination + 6) = *(_DWORD *)(result + 136); /*0x19531*/
  *(_QWORD *)(Destination + 18) = 0; /*0x19534*/
  *((_DWORD *)Destination + 11) = 0; /*0x19539*/
  return result; /*0x1953d*/
}


// Function: JournalSetTriple @ 0x19544 (0xc bytes)
// Index: 711/906

void __fastcall JournalSetTriple(_QWORD *a1, __int64 a2, __int64 a3, __int64 a4)
{
  *a1 = a2; /*0x19544*/
  a1[1] = a3; /*0x19547*/
  a1[2] = a4; /*0x1954b*/
}


// Function: JournalSetPair @ 0x19550 (0x9 bytes)
// Index: 712/906

void __fastcall JournalSetPair(__int64 a1, __int64 a2, __int64 a3)
{
  *(_QWORD *)(a1 + 8) = a2; /*0x19550*/
  *(_QWORD *)(a1 + 16) = a3; /*0x19554*/
}


// Function: RstHelper_955c @ 0x1955c (0x2c bytes)
// Index: 713/906

CHAR16 *__fastcall sub_1955C(__int64 a1)
{
  CHAR16 *result; // rax

  *(_DWORD *)a1 = 0; /*0x19562*/
  result = StrnCpy((CHAR16 *)(a1 + 4), "Intel Raid ISM Journaling Sig   ", 0x20u); /*0x19579*/
  *(_DWORD *)(a1 + 36) = 0; /*0x1957e*/
  return result; /*0x19582*/
}


// Function: JournalCopyInfo @ 0x19588 (0x19 bytes)
// Index: 714/906

__int64 __fastcall JournalCopyInfo(__int64 a1, __int64 a2, __int64 a3)
{
  __int64 result; // rax

  *(_DWORD *)(a1 + 36) = *(_DWORD *)(a2 + 64); /*0x1958b*/
  result = *(unsigned __int16 *)(*(_QWORD *)(*(_QWORD *)a3 + 136LL) + 64LL); /*0x19598*/
  *(_WORD *)(a1 + 40) = result; /*0x1959c*/
  return result; /*0x195a0*/
}


// Function: StrnCpy16_w @ 0x195a4 (0x25 bytes)
// Index: 715/906

bool __fastcall sub_195A4(__int64 a1)
{
  return StrnCpy16("Intel Raid ISM Journaling Sig   ", (_BYTE *)(a1 + 4), 32) == 0; /*0x195c4*/
}


// Function: Assert_46 @ 0x195cc (0xb7 bytes)
// Index: 716/906

__int64 __fastcall Assert_46(CHAR16 *Source)
{
  char v2; // al
  CHAR16 *i_1; // rbx
  unsigned int v4; // eax
  int v5; // eax
  unsigned int v6; // eax
  _BYTE *i_2; // rcx
  unsigned int v8; // ebx
  _BYTE *i; // [rsp+20h] [rbp-18h] BYREF
  char v11; // [rsp+28h] [rbp-10h]
  __int16 n16; // [rsp+2Ah] [rbp-Eh]

  *(_DWORD *)Source = 0; /*0x195d6*/
  i = 0; /*0x195d9*/
  v11 = 0; /*0x195ee*/
  n16 = 16; /*0x195f3*/
  JournalStringRealloc((__int64)&i, 0); /*0x195f8*/
  v2 = RstDebugEnabled(); /*0x195fd*/
  i_1 = (CHAR16 *)i; /*0x19602*/
  if ( v2 && !i ) /*0x1960e*/
  {
    DebugAssert("JdPplMpb.cpp", 0x43u, "framebuf.ptr()"); /*0x19621*/
    i_1 = (CHAR16 *)i; /*0x19626*/
  }
  MemZero(i_1, 0, 4096); /*0x19636*/
  StrnCpy(i_1, Source, 0x2Au); /*0x19647*/
  v4 = sub_1922C(); /*0x1964c*/
  v5 = sub_19230(v4, (unsigned int *)i_1, 4096); /*0x1965c*/
  v6 = sub_19264(v5); /*0x19663*/
  i_2 = i; /*0x19668*/
  v8 = v6; /*0x1966d*/
  *(_DWORD *)Source = v6; /*0x1966f*/
  sub_17400((__int64)i_2); /*0x19671*/
  return v8; /*0x1967d*/
}


// Function: JournalAllocVtbl @ 0x19684 (0x4c bytes)
// Index: 717/906

_QWORD *__fastcall JournalAllocVtbl(_QWORD *a1, __int64 a2)
{
  sub_18978(a1, 0x2000); /*0x19699*/
  a1[7] = a2; /*0x1969e*/
  *a1 = off_24058; /*0x196ae*/
  a1[1] = *(_QWORD *)(*(_QWORD *)(Source_16 + 208) + 8LL); /*0x196c3*/
  return a1; /*0x196ca*/
}


// Function: RstHelper_96d0 @ 0x196d0 (0x10e bytes)
// Index: 718/906

__int64 __fastcall RstHelper_96d0(__int64 a1, __int64 a2)
{
  int v4; // esi
  int v5; // esi
  __int64 v6; // rbx
  int v7; // edi
  __int64 v8; // rax
  int v9; // edi
  int v10; // ebx
  __int64 v11; // rax
  _BYTE *i; // [rsp+20h] [rbp-68h]
  _BYTE Source[80]; // [rsp+30h] [rbp-58h] BYREF

  sub_10AEC((__int64)Source); /*0x196f6*/
  if ( *(_DWORD *)(a1 + 16) > (unsigned int)HiiLibReturnZero(a2) ) /*0x19708*/
  {
    v4 = *(_DWORD *)(a1 + 8); /*0x1970a*/
    v5 = HiiLibReturnZero(a2) + v4; /*0x1971a*/
    v6 = *(_DWORD *)(a1 + 16) / (unsigned int)HiiLibReturnZero(a2) - 1; /*0x19731*/
    v7 = *(_DWORD *)(a1 + 16) - HiiLibReturnZero(a2); /*0x19741*/
    v8 = sub_10200(a2); /*0x19743*/
    LODWORD(i) = v5; /*0x19764*/
    sub_E464(Source_16, 42, v8 - v6, v7, i, Source); /*0x19768*/
    j_Assert_18(a2, (__int64)Source); /*0x19775*/
  }
  v9 = *(_DWORD *)(a1 + 8); /*0x1977a*/
  v10 = HiiLibReturnZero(a2); /*0x1978a*/
  v11 = sub_10200(a2); /*0x1978c*/
  LODWORD(i) = v9; /*0x197aa*/
  sub_E464(Source_16, 42, v11, v10, i, Source); /*0x197ae*/
  return j_Assert_18(a2, (__int64)Source); /*0x197d8*/
}


// Function: JournalNotifyMembers @ 0x197e0 (0x7f bytes)
// Index: 719/906

__int64 *__fastcall JournalNotifyMembers(__int64 a1, __int64 a2)
{
  __int64 *result; // rax
  __int64 v4; // rdi
  __int64 i; // rbx
  int v6; // ecx

  result = (__int64 *)Source_16; /*0x197ef*/
  v4 = *(_QWORD *)(Source_16 + 216); /*0x197f9*/
  for ( i = *(_QWORD *)(v4 + 16); ; i = *result ) /*0x19800*/
  {
    *(_QWORD *)(v4 + 8) = i; /*0x19846*/
    if ( !i ) /*0x1984d*/
      break; /*0x1984d*/
    if ( *(_QWORD *)(i + 40) == *(_QWORD *)(a1 + 56) ) /*0x1980e*/
    {
      v6 = *(_DWORD *)(*(_QWORD *)(i + 48) + 136LL); /*0x19814*/
      if ( (v6 & 2) == 0 ) /*0x19820*/
      {
        if ( (v6 & 8) != 0 ) /*0x19828*/
        {
          LOBYTE(a2) = 1; /*0x1982e*/
          (***(void (__fastcall ****)(_QWORD, __int64))(i + 64))(*(_QWORD *)(i + 64), a2); /*0x19833*/
        }
        JournalSetSlot(i, 0); /*0x1983a*/
      }
    }
    result = *(__int64 **)(v4 + 8); /*0x1983f*/
  }
  return result; /*0x19859*/
}


// Function: JournalUpdateStates @ 0x19860 (0x5e bytes)
// Index: 720/906

__int64 __fastcall JournalUpdateStates(__int64 a1)
{
  __int64 v2; // rcx
  _BYTE *v3; // rax
  char v5; // [rsp+30h] [rbp+8h] BYREF

  v2 = *(_QWORD *)(a1 + 56); /*0x1986d*/
  v5 = 0; /*0x19871*/
  while ( 1 ) /*0x1989e*/
  {
    v3 = (_BYTE *)sub_132B8(v2, &v5); /*0x1989e*/
    if ( !v3 ) /*0x198a9*/
      break; /*0x198a9*/
    *(_BYTE *)(*(_QWORD *)(*(_QWORD *)v3 + 160LL) + 82LL) = JournalFindByName(*(_QWORD *)(a1 + 8), v3 + 16)[90]; /*0x19892*/
    v2 = *(_QWORD *)(a1 + 56); /*0x19895*/
  }
  return nullsub_1(a1); /*0x198b8*/
}


// Function: JournalProcess @ 0x198c0 (0xb7 bytes)
// Index: 721/906

__int64 __fastcall JournalProcess(__int64 a1)
{
  __int64 v1; // rdx
  __int64 result; // rax
  __int64 v3; // rbp
  unsigned __int16 v5; // bx
  __int64 v6; // rax
  __int64 v7; // rsi
  int v8; // edx

  v1 = *(_QWORD *)(a1 + 8); /*0x198d9*/
  result = Source_16; /*0x198dd*/
  v3 = *(_QWORD *)(Source_16 + 216); /*0x198e7*/
  v5 = 0; /*0x198f1*/
  if ( *(_BYTE *)(v1 + 56) ) /*0x198f5*/
  {
    do /*0x1995a*/
    {
      v6 = sub_EFF0(v3, v1 + 48LL * v5 + 216); /*0x19910*/
      if ( v6 ) /*0x19918*/
      {
        v7 = *(_QWORD *)(v6 + 48); /*0x1991a*/
        v8 = *(_DWORD *)(v7 + 136); /*0x1991e*/
        if ( (v8 & 8) != 0 && (v8 & 2) != 0 ) /*0x19932*/
        {
          RstHelper_96d0(a1, v7); /*0x1993a*/
          RstDeviceSetFlags(v7, 256); /*0x19947*/
        }
      }
      v1 = *(_QWORD *)(a1 + 8); /*0x1994c*/
      ++v5; /*0x19950*/
      result = *(unsigned __int8 *)(v1 + 56); /*0x19953*/
    }
    while ( v5 < (unsigned __int16)result ); /*0x1995a*/
  }
  return result; /*0x19970*/
}