CmpGetBootValueData

CHAR __fastcall CmpGetBootValueData(INT64 a1, INT64 a2, CHAR *a3, UINT64 a4){
  size_t v4; 
  unsigned int v6; 
  unsigned int v8; 
  const VOID *v9; 
  __int64 v10; 
  char v11; 
  __int64 v12; 
  __int64 v13; 
  __int64 v14; 
  unsigned int v15; 
  unsigned __int16 v16; 
  const VOID *v17; 
  size_t v18; 
  int v20[2]; 
  int v21[2]; 
  __int64 v22; 
  INT64 v23; 
  int v24; 
  int v25; 

  v23 = a1;
  v4 = a4;
  v21[1] = 0;
  v6 = *(_DWORD *)(a2 + 4);
  v21[0] = -1;
  v8 = v6 + 0x80000000;
  if( v6 < 0x80000000 )
    v8 = v6;
  if( v6 >= 0x80000000 )
  {
    memmove(a3, (const VOID *)(a2 + 8), a4);
LABEL_5:
    LOBYTE(v9) = 1;
    return(char)v9;
  }
  if( (unsigned int)dword_140D5B834 < 4 || v8 - 16345 > 0x7FFFC026 )
  {
    v9 = (const VOID *)((__int64(__fastcall *)(ULONG_PTR *, _QWORD, int *))qword_140D5B768)(
                         &CmControlHive,
                         *(unsigned int *)(a2 + 8),
                         v21);
    if( !v9 )
      return(char)v9;
    memmove(a3, v9, v4);
    ((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v21);
    goto LABEL_5;
  }
  v10 = *(unsigned int *)(a2 + 8);
  v20[0] = -1;
  v20[1] = 0;
  v11 = 1;
  v25 = 0;
  v23 = 0xFFFFFFFFi64;
  v24 = -1;
  v12 = ((__int64(__fastcall *)(ULONG_PTR *, __int64, int *))qword_140D5B768)(&CmControlHive, v10, v20);
  v13 = v12;
  if( v12 )
  {
    v14 = ((__int64(__fastcall *)(ULONG_PTR *, _QWORD, int *))qword_140D5B768)(
            &CmControlHive,
            *(unsigned int *)(v12 + 4),
            &v24);
    v22 = v14;
    if( v14 )
    {
      v15 = *(_DWORD *)(a2 + 4);
      if( v15 > v4 )
        v15 = v4;
      v16 = 0;
      if( *(_WORD *)(v13 + 2) )
      {
        while( 1 )
        {
          v17 = (const VOID *)((__int64(__fastcall *)(ULONG_PTR *, _QWORD, INT64 *))qword_140D5B768)(
                                &CmControlHive,
                                *(unsigned int *)(v14 + 4i64 * v16),
                                &v23);
          if( !v17 )
            break;
          v18 = v15;
          if( v15 > 0x3FD8 )
            v18 = 16344;
          memmove(&a3[16344 * v16], v17, v18);
          ((void(__fastcall *)(ULONG_PTR *, INT64 *))qword_140D5B770)(&CmControlHive, &v23);
          if( v15 > 0x3FD8 )
          {
            v14 = v22;
            v15 -= 16344;
            if( ++v16 < *(_WORD *)(v13 + 2) )
              continue;
          }
          goto LABEL_20;
        }
        v11 = 0;
      }
LABEL_20:
      ((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, &v24);
    }
    else
    {
      v11 = 0;
    }
    ((void(__fastcall *)(ULONG_PTR *, int *))qword_140D5B770)(&CmControlHive, v20);
  }
  else
  {
    v11 = 0;
  }
  LOBYTE(v9) = v11;
  return(char)v9;
}

Referenced by:

CmpGetSystemControlValues