RtlpMuiRegConfigListAddLanguage

__int64 __fastcall RtlpMuiRegConfigListAddLanguage(ULONG_PTR *a1, __int16 *a2){
  unsigned int v2; 
  ULONG_PTR v5; 
  unsigned __int16 v6; 
  __int16 v7; 
  int v8; 
  int v9; 
  _WORD *v10; 
  unsigned __int16 v11; 
  unsigned int v12; 
  INT64 v13; 
  ULONG_PTR v14; 
  int v15; 
  __int64 v16; 
  __int64 v17; 
  int v18; 
  v2 = 0;
  if( !a1 )
    return(unsigned int)-1073741811;
  v5 = *a1;
  if( !*a1 )
    return(unsigned int)-1073741811;
  if( !a2 )
    return(unsigned int)-1073741811;
  v6 = a2[1];
  v7 = *a2;
  if( !(v6 >> 14) )
    return(unsigned int)-1073741811;
  v8 = *(unsigned __int16 *)(v5 + 4);
  v9 = 0;
  if( !*(_WORD *)(v5 + 4) )
    goto LABEL_9;
  while( 1 )
  {
    v10 = (_WORD *)(*(_QWORD *)(v5 + 8) + 12i64 * v9);
    v11 = v10[1];
    if( v11 >> 14 == v6 >> 14 && *v10 == v7 )
      break;
    if( ++v9 >= v8 )
      goto LABEL_9;
  }
  if( v9 < 0 )
  {
LABEL_9:
    v12 = *(unsigned __int16 *)(v5 + 6);
    if( (unsigned __int16)v8 >= (unsigned __int16)v12 )
    {
      v13 = (unsigned int)(v8 + 1);
      v14 = *a1;
      if( (unsigned int)v13 >= v12 )
        v14 = (ULONG_PTR)RtlpMuiRegResizeLanguageConfigList((UINT16 *)v5, v13);
      if( !v14 )
        return(unsigned int)-1073741801;
      v5 = v14;
      *a1 = v14;
    }
    v16 = *(_QWORD *)(v5 + 8);
    v17 = 3i64 * *(unsigned __int16 *)(v5 + 4);
    v18 = *((_DWORD *)a2 + 2);
    *(_QWORD *)(v16 + 4 * v17) = *(_QWORD *)a2;
    *(_DWORD *)(v16 + 4 * v17 + 8) = v18;
    ++*(_WORD *)(v5 + 4);
    return v2;
  }
  v15 = 0;
  while( (((unsigned __int16)(v11 ^ v6) >> (2 * v15)) & 3) == 0 && v10[v15 + 3] == a2[v15 + 3] )
  {
    if( ++v15 >= 3 )
      return v2;
  }
  return 0x40000000;
}

Referenced by:

RtlpPopulateLanguageConfigList