AuthzBasepCompareUnicodeStringOperands

INT64 __fastcall AuthzBasepCompareUnicodeStringOperands(CHAR a1, INT64 a2, BOOL *a3){
  wchar_t **p_Buffer; 
  __int64 v7; 
  int OperandStringCaseForEvaluation; 
  int v9; 
  struct _UNICODE_STRING *p_Name; 
  INT64 v11; 
  bool v12; 
  struct _UNICODE_STRING *v13; 
  struct _UNICODE_STRING *p_Expression; 
  int IsNameInExpression; 
  unsigned int v16; 
  __int64 v17; 
  wchar_t **v18; 
  UINT8 v20; 
  unsigned int v21; 
  _BOOL8 v22; 
  _WORD v23[2]; 
  int v24; 
  struct _UNICODE_STRING *v25; 
  struct _UNICODE_STRING Name; 
  struct _UNICODE_STRING Expression; 
  CHAR v28; 
  v23[0] = 0;
  v28 = 0;
  p_Buffer = &Name.Buffer;
  v7 = 2i64;
  do
  {
    *p_Buffer = 0i64;
    p_Buffer += 2;
    --v7;
  }
  while( v7 );
  *a3 = 0;
  OperandStringCaseForEvaluation = AuthzBasepGetOperandStringCaseForEvaluation(a2, &v28);
  v24 = OperandStringCaseForEvaluation;
  if( OperandStringCaseForEvaluation < 0 )
  {
LABEL_25:
    *a3 = -1;
    v16 = OperandStringCaseForEvaluation;
    goto LABEL_19;
  }
  v9 = 0;
  p_Name = &Name;
  v25 = &Name;
  v11 = a2 + 16;
  do
  {
    if( *(_DWORD *)(v11 - 4) == 1 )
    {
      v12 = v28 == 0;
    }
    else
    {
      v12 = v28 == 0;
      if( v28 )
      {
        *p_Name = *(struct _UNICODE_STRING *)*(_QWORD *)(*(_QWORD *)v11 + 48i64);
        goto LABEL_9;
      }
    }
    OperandStringCaseForEvaluation = AuthzBasepUnicodeStringFromOperandValue(
                                       a2 + 40i64 * v9,
                                       v12,
                                       &Name.Length + 8 * v9,
                                       (_BYTE *)v23 + v9);
    v24 = OperandStringCaseForEvaluation;
    if( OperandStringCaseForEvaluation < 0 )
      goto LABEL_25;
    p_Name = v25;
LABEL_9:
    ++v9;
    v11 += 40i64;
    v25 = ++p_Name;
  }
  while( v9 < 2 );
  if( (unsigned __int8)(a1 + 0x80) > 1u )
  {
    if( v28 )
      v21 = AuthzBasepCompareUnicodeStringCaseSensitive(&Name, &Expression);
    else
      v21 = RtlCompareUnicodeString(&Name, &Expression, 1u);
    *a3 = v21;
    if( a1 != -126 )
    {
      if( a1 == -125 )
      {
        v22 = *a3 <= 0;
LABEL_40:
        *a3 = v22;
LABEL_43:
        v16 = v24;
        goto LABEL_19;
      }
      if( a1 == -124 )
      {
        v22 = *a3 > 0;
        goto LABEL_40;
      }
      if( a1 != -123 )
        goto LABEL_43;
      v21 = ~*a3;
    }
    LODWORD(v22) = v21 >> 31;
    goto LABEL_40;
  }
  if( *(_DWORD *)(a2 + 12) == 2 || *(_DWORD *)(a2 + 52) == 2 )
  {
    if( *(_DWORD *)(a2 + 52) == 1 )
    {
      v13 = &Name;
      p_Expression = &Expression;
    }
    else
    {
      v13 = &Expression;
      p_Expression = &Name;
    }
    IsNameInExpression = RtlIsNameInExpression(p_Expression, v13, v28 == 0, 0i64);
    *a3 = IsNameInExpression;
  }
  else
  {
    if( v28 )
      v20 = AuthzBasepEqualUnicodeStringCaseSensitive(&Name, &Expression);
    else
      v20 = RtlEqualUnicodeString(&Name, &Expression, 1u);
    IsNameInExpression = v20;
    *a3 = v20;
  }
  v12 = a1 == -127;
  v16 = v24;
  if( v12 )
    *a3 = IsNameInExpression != 1;
LABEL_19:
  v17 = 0i64;
  v18 = &Name.Buffer;
  do
  {
    if( *((_BYTE *)v23 + v17) )
      ExFreePoolWithTag(*v18, 0);
    ++v17;
    v18 += 2;
  }
  while( v17 < 2 );
  return v16;
}

Referenced by:

AuthzBasepEvaluateExpression
AuthzBasepValueInSet